@anker-in/shopify-sdk 1.1.1 → 1.1.2-beta.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.d.mts +215 -215
- package/dist/index.d.ts +215 -215
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -10217,6 +10217,218 @@ declare module '@shopify/storefront-api-client' {
|
|
|
10217
10217
|
interface StorefrontMutations extends GeneratedMutationTypes {}
|
|
10218
10218
|
}
|
|
10219
10219
|
|
|
10220
|
+
/**
|
|
10221
|
+
* Product API Types
|
|
10222
|
+
*
|
|
10223
|
+
* Type definitions for Product-related API operations
|
|
10224
|
+
*/
|
|
10225
|
+
|
|
10226
|
+
interface NormalizedProductVariant {
|
|
10227
|
+
id: string;
|
|
10228
|
+
title: string;
|
|
10229
|
+
sku: string;
|
|
10230
|
+
availableForSale: boolean;
|
|
10231
|
+
quantityAvailable?: number;
|
|
10232
|
+
selectedOptions: Array<{
|
|
10233
|
+
name: string;
|
|
10234
|
+
value: string;
|
|
10235
|
+
}>;
|
|
10236
|
+
price: MoneyV2;
|
|
10237
|
+
compareAtPrice?: MoneyV2;
|
|
10238
|
+
image?: Image;
|
|
10239
|
+
weight?: number;
|
|
10240
|
+
weightUnit?: string;
|
|
10241
|
+
metafields?: Record<string, any>;
|
|
10242
|
+
sellingPlanAllocations?: SellingPlanAllocation[];
|
|
10243
|
+
}
|
|
10244
|
+
type NormalizedSellingPlanGroup = Omit<SellingPlanGroup, 'sellingPlans'> & {
|
|
10245
|
+
sellingPlans: SellingPlan[];
|
|
10246
|
+
};
|
|
10247
|
+
interface NormalizedProduct {
|
|
10248
|
+
id: string;
|
|
10249
|
+
handle: string;
|
|
10250
|
+
title: string;
|
|
10251
|
+
description?: string;
|
|
10252
|
+
descriptionHtml?: string;
|
|
10253
|
+
availableForSale: boolean;
|
|
10254
|
+
tags: string[];
|
|
10255
|
+
productType?: string;
|
|
10256
|
+
vendor?: string;
|
|
10257
|
+
price: MoneyV2;
|
|
10258
|
+
compareAtPrice?: MoneyV2;
|
|
10259
|
+
images: Image[];
|
|
10260
|
+
media: Media[];
|
|
10261
|
+
featuredImage?: Image;
|
|
10262
|
+
variants: NormalizedProductVariant[];
|
|
10263
|
+
options: ProductOption[];
|
|
10264
|
+
seo?: Seo;
|
|
10265
|
+
createdAt?: string;
|
|
10266
|
+
updatedAt?: string;
|
|
10267
|
+
publishedAt?: string;
|
|
10268
|
+
metafields?: Record<string, any>;
|
|
10269
|
+
sellingPlanGroups?: NormalizedSellingPlanGroup[];
|
|
10270
|
+
}
|
|
10271
|
+
/**
|
|
10272
|
+
* Options for getProduct API
|
|
10273
|
+
*/
|
|
10274
|
+
interface GetProductOptions {
|
|
10275
|
+
handle: string;
|
|
10276
|
+
locale: string;
|
|
10277
|
+
metafieldIdentifiers?: Array<{
|
|
10278
|
+
namespace: string;
|
|
10279
|
+
key: string;
|
|
10280
|
+
}>;
|
|
10281
|
+
}
|
|
10282
|
+
/**
|
|
10283
|
+
* Options for getAllProducts API
|
|
10284
|
+
*/
|
|
10285
|
+
interface GetAllProductsOptions {
|
|
10286
|
+
locale: string;
|
|
10287
|
+
first?: number;
|
|
10288
|
+
after?: string;
|
|
10289
|
+
query?: string;
|
|
10290
|
+
sortKey?: 'TITLE' | 'PRODUCT_TYPE' | 'VENDOR' | 'UPDATED_AT' | 'CREATED_AT' | 'BEST_SELLING' | 'PRICE' | 'RELEVANCE';
|
|
10291
|
+
reverse?: boolean;
|
|
10292
|
+
metafieldIdentifiers?: Array<{
|
|
10293
|
+
namespace: string;
|
|
10294
|
+
key: string;
|
|
10295
|
+
}>;
|
|
10296
|
+
}
|
|
10297
|
+
/**
|
|
10298
|
+
* Options for getProductsByHandles API
|
|
10299
|
+
*/
|
|
10300
|
+
interface GetProductsByHandlesOptions {
|
|
10301
|
+
handles: string[];
|
|
10302
|
+
locale: string;
|
|
10303
|
+
metafieldIdentifiers?: {
|
|
10304
|
+
product: HasMetafieldsIdentifier[];
|
|
10305
|
+
variant: HasMetafieldsIdentifier[];
|
|
10306
|
+
};
|
|
10307
|
+
}
|
|
10308
|
+
/**
|
|
10309
|
+
* Response type for getAllProducts with pagination info
|
|
10310
|
+
*/
|
|
10311
|
+
interface NormalizedProductsConnection {
|
|
10312
|
+
products: NormalizedProduct[];
|
|
10313
|
+
pageInfo: {
|
|
10314
|
+
hasNextPage: boolean;
|
|
10315
|
+
hasPreviousPage: boolean;
|
|
10316
|
+
startCursor?: string;
|
|
10317
|
+
endCursor?: string;
|
|
10318
|
+
};
|
|
10319
|
+
}
|
|
10320
|
+
|
|
10321
|
+
/**
|
|
10322
|
+
* Product Normalization Functions
|
|
10323
|
+
*
|
|
10324
|
+
* Normalizes Shopify API product responses to a consistent format
|
|
10325
|
+
*/
|
|
10326
|
+
|
|
10327
|
+
/**
|
|
10328
|
+
* Normalize a Shopify Product to NormalizedProduct
|
|
10329
|
+
*/
|
|
10330
|
+
declare function normalizeProduct(product: Product): NormalizedProduct;
|
|
10331
|
+
|
|
10332
|
+
/**
|
|
10333
|
+
* Get Product API
|
|
10334
|
+
*
|
|
10335
|
+
* Fetches a single product by handle
|
|
10336
|
+
*/
|
|
10337
|
+
|
|
10338
|
+
/**
|
|
10339
|
+
* Get a single product by handle
|
|
10340
|
+
*
|
|
10341
|
+
* @param client - Shopify GraphQL client
|
|
10342
|
+
* @param options - Get product options
|
|
10343
|
+
* @returns Normalized product or undefined if not found
|
|
10344
|
+
*
|
|
10345
|
+
* @example
|
|
10346
|
+
* ```typescript
|
|
10347
|
+
* const product = await getProduct(client, {
|
|
10348
|
+
* handle: 'my-product',
|
|
10349
|
+
* locale: 'us'
|
|
10350
|
+
* })
|
|
10351
|
+
* ```
|
|
10352
|
+
*/
|
|
10353
|
+
declare function getProduct(client: ShopifyClient, options: GetProductOptions): Promise<NormalizedProduct | undefined>;
|
|
10354
|
+
|
|
10355
|
+
/**
|
|
10356
|
+
* Get All Products API
|
|
10357
|
+
*
|
|
10358
|
+
* Fetches all products with pagination support
|
|
10359
|
+
*/
|
|
10360
|
+
|
|
10361
|
+
/**
|
|
10362
|
+
* Get all products
|
|
10363
|
+
*
|
|
10364
|
+
* This function automatically handles pagination and fetches all products
|
|
10365
|
+
*
|
|
10366
|
+
* @param client - Shopify GraphQL client
|
|
10367
|
+
* @param options - Get all products options
|
|
10368
|
+
* @returns Array of normalized products
|
|
10369
|
+
*
|
|
10370
|
+
* @example
|
|
10371
|
+
* ```typescript
|
|
10372
|
+
* const products = await getAllProducts(client, {
|
|
10373
|
+
* locale: 'us',
|
|
10374
|
+
* sortKey: 'TITLE',
|
|
10375
|
+
* reverse: false
|
|
10376
|
+
* })
|
|
10377
|
+
* ```
|
|
10378
|
+
*/
|
|
10379
|
+
declare function getAllProducts(client: ShopifyClient, options: GetAllProductsOptions): Promise<NormalizedProduct[]>;
|
|
10380
|
+
/**
|
|
10381
|
+
* Get products with pagination info (for manual pagination)
|
|
10382
|
+
*
|
|
10383
|
+
* This function returns a single page of products with pagination metadata
|
|
10384
|
+
*
|
|
10385
|
+
* @param client - Shopify GraphQL client
|
|
10386
|
+
* @param options - Get all products options
|
|
10387
|
+
* @returns Products connection with pagination info
|
|
10388
|
+
*
|
|
10389
|
+
* @example
|
|
10390
|
+
* ```typescript
|
|
10391
|
+
* const result = await getProducts(client, {
|
|
10392
|
+
* locale: 'us',
|
|
10393
|
+
* first: 20
|
|
10394
|
+
* })
|
|
10395
|
+
*
|
|
10396
|
+
* console.log(result.products) // First 20 products
|
|
10397
|
+
* console.log(result.pageInfo.hasNextPage) // true if more pages exist
|
|
10398
|
+
*
|
|
10399
|
+
* // Fetch next page
|
|
10400
|
+
* const nextPage = await getProducts(client, {
|
|
10401
|
+
* locale: 'us',
|
|
10402
|
+
* first: 20,
|
|
10403
|
+
* after: result.pageInfo.endCursor
|
|
10404
|
+
* })
|
|
10405
|
+
* ```
|
|
10406
|
+
*/
|
|
10407
|
+
declare function getProducts(client: ShopifyClient, options: GetAllProductsOptions): Promise<NormalizedProductsConnection>;
|
|
10408
|
+
|
|
10409
|
+
/**
|
|
10410
|
+
* Get Products By Handles API
|
|
10411
|
+
*
|
|
10412
|
+
* Fetches multiple products by their handles
|
|
10413
|
+
*/
|
|
10414
|
+
|
|
10415
|
+
/**
|
|
10416
|
+
* Get multiple products by their handles
|
|
10417
|
+
*
|
|
10418
|
+
* @param client - Shopify GraphQL client
|
|
10419
|
+
* @param options - Get products by handles options
|
|
10420
|
+
* @returns Array of normalized products (in same order as handles)
|
|
10421
|
+
*
|
|
10422
|
+
* @example
|
|
10423
|
+
* ```typescript
|
|
10424
|
+
* const products = await getProductsByHandles(client, {
|
|
10425
|
+
* handles: ['product-1', 'product-2', 'product-3'],
|
|
10426
|
+
* locale: 'us'
|
|
10427
|
+
* })
|
|
10428
|
+
* ```
|
|
10429
|
+
*/
|
|
10430
|
+
declare function getProductsByHandles(client: ShopifyClient, options: GetProductsByHandlesOptions): Promise<NormalizedProduct[]>;
|
|
10431
|
+
|
|
10220
10432
|
interface NormalizedAttribute {
|
|
10221
10433
|
key: string;
|
|
10222
10434
|
value: string;
|
|
@@ -10227,6 +10439,7 @@ interface NormalizedLineItem {
|
|
|
10227
10439
|
quantity: number;
|
|
10228
10440
|
variantId: string;
|
|
10229
10441
|
productId: string;
|
|
10442
|
+
amountPerQuantity: number;
|
|
10230
10443
|
totalAmount: number;
|
|
10231
10444
|
subtotalAmount: number;
|
|
10232
10445
|
discountAllocations: Array<{
|
|
@@ -10238,7 +10451,7 @@ interface NormalizedLineItem {
|
|
|
10238
10451
|
variant: {
|
|
10239
10452
|
id: string;
|
|
10240
10453
|
price: number;
|
|
10241
|
-
listPrice
|
|
10454
|
+
listPrice?: number;
|
|
10242
10455
|
sku: string;
|
|
10243
10456
|
name: string;
|
|
10244
10457
|
image?: {
|
|
@@ -10252,9 +10465,8 @@ interface NormalizedLineItem {
|
|
|
10252
10465
|
weight?: number;
|
|
10253
10466
|
metafields?: any;
|
|
10254
10467
|
};
|
|
10255
|
-
product?:
|
|
10468
|
+
product?: NormalizedProduct;
|
|
10256
10469
|
path: string;
|
|
10257
|
-
discounts: any[];
|
|
10258
10470
|
options?: Array<{
|
|
10259
10471
|
name: string;
|
|
10260
10472
|
value: string;
|
|
@@ -10705,218 +10917,6 @@ interface UpdateBuyerIdentityOptions {
|
|
|
10705
10917
|
*/
|
|
10706
10918
|
declare function updateBuyerIdentity(client: ShopifyClient, options: UpdateBuyerIdentityOptions): Promise<NormalizedCart | undefined>;
|
|
10707
10919
|
|
|
10708
|
-
/**
|
|
10709
|
-
* Product API Types
|
|
10710
|
-
*
|
|
10711
|
-
* Type definitions for Product-related API operations
|
|
10712
|
-
*/
|
|
10713
|
-
|
|
10714
|
-
interface NormalizedProductVariant {
|
|
10715
|
-
id: string;
|
|
10716
|
-
title: string;
|
|
10717
|
-
sku: string;
|
|
10718
|
-
availableForSale: boolean;
|
|
10719
|
-
quantityAvailable?: number;
|
|
10720
|
-
selectedOptions: Array<{
|
|
10721
|
-
name: string;
|
|
10722
|
-
value: string;
|
|
10723
|
-
}>;
|
|
10724
|
-
price: MoneyV2;
|
|
10725
|
-
compareAtPrice?: MoneyV2;
|
|
10726
|
-
image?: Image;
|
|
10727
|
-
weight?: number;
|
|
10728
|
-
weightUnit?: string;
|
|
10729
|
-
metafields?: Record<string, any>;
|
|
10730
|
-
sellingPlanAllocations?: SellingPlanAllocation[];
|
|
10731
|
-
}
|
|
10732
|
-
type NormalizedSellingPlanGroup = Omit<SellingPlanGroup, 'sellingPlans'> & {
|
|
10733
|
-
sellingPlans: SellingPlan[];
|
|
10734
|
-
};
|
|
10735
|
-
interface NormalizedProduct {
|
|
10736
|
-
id: string;
|
|
10737
|
-
handle: string;
|
|
10738
|
-
title: string;
|
|
10739
|
-
description?: string;
|
|
10740
|
-
descriptionHtml?: string;
|
|
10741
|
-
availableForSale: boolean;
|
|
10742
|
-
tags: string[];
|
|
10743
|
-
productType?: string;
|
|
10744
|
-
vendor?: string;
|
|
10745
|
-
price: MoneyV2;
|
|
10746
|
-
compareAtPrice?: MoneyV2;
|
|
10747
|
-
images: Image[];
|
|
10748
|
-
media: Media[];
|
|
10749
|
-
featuredImage?: Image;
|
|
10750
|
-
variants: NormalizedProductVariant[];
|
|
10751
|
-
options: ProductOption[];
|
|
10752
|
-
seo?: Seo;
|
|
10753
|
-
createdAt?: string;
|
|
10754
|
-
updatedAt?: string;
|
|
10755
|
-
publishedAt?: string;
|
|
10756
|
-
metafields?: Record<string, any>;
|
|
10757
|
-
sellingPlanGroups?: NormalizedSellingPlanGroup[];
|
|
10758
|
-
}
|
|
10759
|
-
/**
|
|
10760
|
-
* Options for getProduct API
|
|
10761
|
-
*/
|
|
10762
|
-
interface GetProductOptions {
|
|
10763
|
-
handle: string;
|
|
10764
|
-
locale: string;
|
|
10765
|
-
metafieldIdentifiers?: Array<{
|
|
10766
|
-
namespace: string;
|
|
10767
|
-
key: string;
|
|
10768
|
-
}>;
|
|
10769
|
-
}
|
|
10770
|
-
/**
|
|
10771
|
-
* Options for getAllProducts API
|
|
10772
|
-
*/
|
|
10773
|
-
interface GetAllProductsOptions {
|
|
10774
|
-
locale: string;
|
|
10775
|
-
first?: number;
|
|
10776
|
-
after?: string;
|
|
10777
|
-
query?: string;
|
|
10778
|
-
sortKey?: 'TITLE' | 'PRODUCT_TYPE' | 'VENDOR' | 'UPDATED_AT' | 'CREATED_AT' | 'BEST_SELLING' | 'PRICE' | 'RELEVANCE';
|
|
10779
|
-
reverse?: boolean;
|
|
10780
|
-
metafieldIdentifiers?: Array<{
|
|
10781
|
-
namespace: string;
|
|
10782
|
-
key: string;
|
|
10783
|
-
}>;
|
|
10784
|
-
}
|
|
10785
|
-
/**
|
|
10786
|
-
* Options for getProductsByHandles API
|
|
10787
|
-
*/
|
|
10788
|
-
interface GetProductsByHandlesOptions {
|
|
10789
|
-
handles: string[];
|
|
10790
|
-
locale: string;
|
|
10791
|
-
metafieldIdentifiers?: {
|
|
10792
|
-
product: HasMetafieldsIdentifier[];
|
|
10793
|
-
variant: HasMetafieldsIdentifier[];
|
|
10794
|
-
};
|
|
10795
|
-
}
|
|
10796
|
-
/**
|
|
10797
|
-
* Response type for getAllProducts with pagination info
|
|
10798
|
-
*/
|
|
10799
|
-
interface NormalizedProductsConnection {
|
|
10800
|
-
products: NormalizedProduct[];
|
|
10801
|
-
pageInfo: {
|
|
10802
|
-
hasNextPage: boolean;
|
|
10803
|
-
hasPreviousPage: boolean;
|
|
10804
|
-
startCursor?: string;
|
|
10805
|
-
endCursor?: string;
|
|
10806
|
-
};
|
|
10807
|
-
}
|
|
10808
|
-
|
|
10809
|
-
/**
|
|
10810
|
-
* Product Normalization Functions
|
|
10811
|
-
*
|
|
10812
|
-
* Normalizes Shopify API product responses to a consistent format
|
|
10813
|
-
*/
|
|
10814
|
-
|
|
10815
|
-
/**
|
|
10816
|
-
* Normalize a Shopify Product to NormalizedProduct
|
|
10817
|
-
*/
|
|
10818
|
-
declare function normalizeProduct(product: Product): NormalizedProduct;
|
|
10819
|
-
|
|
10820
|
-
/**
|
|
10821
|
-
* Get Product API
|
|
10822
|
-
*
|
|
10823
|
-
* Fetches a single product by handle
|
|
10824
|
-
*/
|
|
10825
|
-
|
|
10826
|
-
/**
|
|
10827
|
-
* Get a single product by handle
|
|
10828
|
-
*
|
|
10829
|
-
* @param client - Shopify GraphQL client
|
|
10830
|
-
* @param options - Get product options
|
|
10831
|
-
* @returns Normalized product or undefined if not found
|
|
10832
|
-
*
|
|
10833
|
-
* @example
|
|
10834
|
-
* ```typescript
|
|
10835
|
-
* const product = await getProduct(client, {
|
|
10836
|
-
* handle: 'my-product',
|
|
10837
|
-
* locale: 'us'
|
|
10838
|
-
* })
|
|
10839
|
-
* ```
|
|
10840
|
-
*/
|
|
10841
|
-
declare function getProduct(client: ShopifyClient, options: GetProductOptions): Promise<NormalizedProduct | undefined>;
|
|
10842
|
-
|
|
10843
|
-
/**
|
|
10844
|
-
* Get All Products API
|
|
10845
|
-
*
|
|
10846
|
-
* Fetches all products with pagination support
|
|
10847
|
-
*/
|
|
10848
|
-
|
|
10849
|
-
/**
|
|
10850
|
-
* Get all products
|
|
10851
|
-
*
|
|
10852
|
-
* This function automatically handles pagination and fetches all products
|
|
10853
|
-
*
|
|
10854
|
-
* @param client - Shopify GraphQL client
|
|
10855
|
-
* @param options - Get all products options
|
|
10856
|
-
* @returns Array of normalized products
|
|
10857
|
-
*
|
|
10858
|
-
* @example
|
|
10859
|
-
* ```typescript
|
|
10860
|
-
* const products = await getAllProducts(client, {
|
|
10861
|
-
* locale: 'us',
|
|
10862
|
-
* sortKey: 'TITLE',
|
|
10863
|
-
* reverse: false
|
|
10864
|
-
* })
|
|
10865
|
-
* ```
|
|
10866
|
-
*/
|
|
10867
|
-
declare function getAllProducts(client: ShopifyClient, options: GetAllProductsOptions): Promise<NormalizedProduct[]>;
|
|
10868
|
-
/**
|
|
10869
|
-
* Get products with pagination info (for manual pagination)
|
|
10870
|
-
*
|
|
10871
|
-
* This function returns a single page of products with pagination metadata
|
|
10872
|
-
*
|
|
10873
|
-
* @param client - Shopify GraphQL client
|
|
10874
|
-
* @param options - Get all products options
|
|
10875
|
-
* @returns Products connection with pagination info
|
|
10876
|
-
*
|
|
10877
|
-
* @example
|
|
10878
|
-
* ```typescript
|
|
10879
|
-
* const result = await getProducts(client, {
|
|
10880
|
-
* locale: 'us',
|
|
10881
|
-
* first: 20
|
|
10882
|
-
* })
|
|
10883
|
-
*
|
|
10884
|
-
* console.log(result.products) // First 20 products
|
|
10885
|
-
* console.log(result.pageInfo.hasNextPage) // true if more pages exist
|
|
10886
|
-
*
|
|
10887
|
-
* // Fetch next page
|
|
10888
|
-
* const nextPage = await getProducts(client, {
|
|
10889
|
-
* locale: 'us',
|
|
10890
|
-
* first: 20,
|
|
10891
|
-
* after: result.pageInfo.endCursor
|
|
10892
|
-
* })
|
|
10893
|
-
* ```
|
|
10894
|
-
*/
|
|
10895
|
-
declare function getProducts(client: ShopifyClient, options: GetAllProductsOptions): Promise<NormalizedProductsConnection>;
|
|
10896
|
-
|
|
10897
|
-
/**
|
|
10898
|
-
* Get Products By Handles API
|
|
10899
|
-
*
|
|
10900
|
-
* Fetches multiple products by their handles
|
|
10901
|
-
*/
|
|
10902
|
-
|
|
10903
|
-
/**
|
|
10904
|
-
* Get multiple products by their handles
|
|
10905
|
-
*
|
|
10906
|
-
* @param client - Shopify GraphQL client
|
|
10907
|
-
* @param options - Get products by handles options
|
|
10908
|
-
* @returns Array of normalized products (in same order as handles)
|
|
10909
|
-
*
|
|
10910
|
-
* @example
|
|
10911
|
-
* ```typescript
|
|
10912
|
-
* const products = await getProductsByHandles(client, {
|
|
10913
|
-
* handles: ['product-1', 'product-2', 'product-3'],
|
|
10914
|
-
* locale: 'us'
|
|
10915
|
-
* })
|
|
10916
|
-
* ```
|
|
10917
|
-
*/
|
|
10918
|
-
declare function getProductsByHandles(client: ShopifyClient, options: GetProductsByHandlesOptions): Promise<NormalizedProduct[]>;
|
|
10919
|
-
|
|
10920
10920
|
/**
|
|
10921
10921
|
* Collection API Types
|
|
10922
10922
|
*/
|