commerce-kit 0.45.0 → 0.47.0
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/README.md +34 -0
- package/dist/api-types.d.ts +159 -5
- package/dist/index.d.ts +28 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -69,6 +69,7 @@ const { data, meta } = await commerce.orderBrowse({
|
|
|
69
69
|
|
|
70
70
|
// Get single order
|
|
71
71
|
const order = await commerce.orderGet({ id: 'order_789' });
|
|
72
|
+
// Orders with event-ticket lines carry a buyer access code: order.ticketCode (string | null)
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
## Events
|
|
@@ -100,6 +101,34 @@ await commerce.eventUpdate({ idOrSlug: 'summer-fest' }, { capacity: 600, status:
|
|
|
100
101
|
const { attendees, totalTickets } = await commerce.eventAttendeesBrowse({ idOrSlug: 'summer-fest' });
|
|
101
102
|
```
|
|
102
103
|
|
|
104
|
+
## Tickets
|
|
105
|
+
|
|
106
|
+
No-login access to purchased event tickets. The buyer gets a 6-character access code on the
|
|
107
|
+
order (`order.ticketCode`, also in the confirmation email) and manages all attendee details
|
|
108
|
+
with it plus the purchase email. Each seat carries its own shareable `token` — a view-only
|
|
109
|
+
link for the attendee; attendee details can only be edited by the buyer.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
// Buyer lookup: access code + purchase email.
|
|
113
|
+
// Returns null on any mismatch (the API answers a uniform 404).
|
|
114
|
+
const bundle = await commerce.ticketsGet({ code: 'K7M3PA', email: 'buyer@example.com' });
|
|
115
|
+
// bundle.lines[].event — startsAt, location, guestLabel, guest
|
|
116
|
+
// bundle.lines[].seats[] — { token, name, email } per ticket
|
|
117
|
+
|
|
118
|
+
// Buyer bulk-edit of attendee names/emails.
|
|
119
|
+
// Throws on mismatch (404) or when the order is cancelled/refunded (409).
|
|
120
|
+
const updated = await commerce.ticketsUpdate(
|
|
121
|
+
{ code: 'K7M3PA' },
|
|
122
|
+
{
|
|
123
|
+
email: 'buyer@example.com',
|
|
124
|
+
seats: [{ token: bundle.lines[0].seats[0].token, name: 'Ada Lovelace', email: null }],
|
|
125
|
+
},
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
// View-only attendee ticket by seat token (null for unknown tokens)
|
|
129
|
+
const ticket = await commerce.ticketAttendeeGet({ token: 'a1b2c3...' });
|
|
130
|
+
```
|
|
131
|
+
|
|
103
132
|
## Collections & Categories
|
|
104
133
|
|
|
105
134
|
Full CRUD for product collections, product categories, and blog categories. Mutations are
|
|
@@ -111,6 +140,11 @@ const collection = await commerce.collectionCreate({ name: 'Summer', filter: { t
|
|
|
111
140
|
await commerce.collectionUpdate({ idOrSlug: 'summer' }, { name: 'Summer 2026', active: false });
|
|
112
141
|
await commerce.collectionDelete({ idOrSlug: 'summer' }); // { ok: true, deleted: 1 }
|
|
113
142
|
|
|
143
|
+
// Group related collections under a free-form key and fetch them together
|
|
144
|
+
await commerce.collectionUpdate({ idOrSlug: 'floral' }, { group: 'fragrances' });
|
|
145
|
+
const fragrances = await commerce.collectionBrowse({ group: 'fragrances' });
|
|
146
|
+
await commerce.collectionUpdate({ idOrSlug: 'floral' }, { group: null }); // clear
|
|
147
|
+
|
|
114
148
|
// Categories — delete (create/update already supported)
|
|
115
149
|
await commerce.categoryUpdate({ idOrSlug: 'shoes' }, { name: 'Footwear' });
|
|
116
150
|
await commerce.categoryDelete({ idOrSlug: 'footwear' }); // 409 if still referenced by products
|
package/dist/api-types.d.ts
CHANGED
|
@@ -3041,6 +3041,7 @@ type APIProductGetByIdResult = ({
|
|
|
3041
3041
|
})[];
|
|
3042
3042
|
}) & {
|
|
3043
3043
|
lang?: string;
|
|
3044
|
+
omnibusPrices: Record<string, string>;
|
|
3044
3045
|
});
|
|
3045
3046
|
type APIProductGetByIdParams = {
|
|
3046
3047
|
idOrSlug: string;
|
|
@@ -3243,6 +3244,10 @@ type APICartGetResult = {
|
|
|
3243
3244
|
quantity: number;
|
|
3244
3245
|
productVariantId: string;
|
|
3245
3246
|
subscriptionPlanId: string | null;
|
|
3247
|
+
attendees: {
|
|
3248
|
+
name: string;
|
|
3249
|
+
email: string | null;
|
|
3250
|
+
}[] | null;
|
|
3246
3251
|
subscriptionPlan: {
|
|
3247
3252
|
id: string;
|
|
3248
3253
|
name: string;
|
|
@@ -3664,6 +3669,10 @@ type APICartCreateResult = {
|
|
|
3664
3669
|
quantity: number;
|
|
3665
3670
|
productVariantId: string;
|
|
3666
3671
|
subscriptionPlanId: string | null;
|
|
3672
|
+
attendees: {
|
|
3673
|
+
name: string;
|
|
3674
|
+
email: string | null;
|
|
3675
|
+
}[] | null;
|
|
3667
3676
|
subscriptionPlan: {
|
|
3668
3677
|
id: string;
|
|
3669
3678
|
name: string;
|
|
@@ -4075,6 +4084,10 @@ type APICartRemoveItemResult = {
|
|
|
4075
4084
|
quantity: number;
|
|
4076
4085
|
productVariantId: string;
|
|
4077
4086
|
subscriptionPlanId: string | null;
|
|
4087
|
+
attendees: {
|
|
4088
|
+
name: string;
|
|
4089
|
+
email: string | null;
|
|
4090
|
+
}[] | null;
|
|
4078
4091
|
subscriptionPlan: {
|
|
4079
4092
|
id: string;
|
|
4080
4093
|
name: string;
|
|
@@ -4419,6 +4432,8 @@ type APIOrdersBrowseResult = {
|
|
|
4419
4432
|
startsAt?: string | null | undefined;
|
|
4420
4433
|
location?: string | null | undefined;
|
|
4421
4434
|
capacity?: number | null | undefined;
|
|
4435
|
+
guestLabel?: string | null | undefined;
|
|
4436
|
+
guest?: string | null | undefined;
|
|
4422
4437
|
} | null | undefined;
|
|
4423
4438
|
} | null;
|
|
4424
4439
|
type: "set" | "product" | "bundle";
|
|
@@ -4557,7 +4572,7 @@ type APIOrdersBrowseResult = {
|
|
|
4557
4572
|
slotId: string | null;
|
|
4558
4573
|
attendees: {
|
|
4559
4574
|
name: string;
|
|
4560
|
-
email: string;
|
|
4575
|
+
email: string | null;
|
|
4561
4576
|
phone: string | null;
|
|
4562
4577
|
dietary: string | null;
|
|
4563
4578
|
notes: string | null;
|
|
@@ -4734,6 +4749,7 @@ type APIOrdersBrowseResult = {
|
|
|
4734
4749
|
externalShipmentId: string | null;
|
|
4735
4750
|
source: string | null;
|
|
4736
4751
|
stripeDeduplicationId: string | null;
|
|
4752
|
+
ticketCode: string | null;
|
|
4737
4753
|
activeSubscriptionId: string | null;
|
|
4738
4754
|
} & {
|
|
4739
4755
|
orderData: {
|
|
@@ -4848,6 +4864,8 @@ type APIOrdersBrowseResult = {
|
|
|
4848
4864
|
startsAt?: string | null | undefined;
|
|
4849
4865
|
location?: string | null | undefined;
|
|
4850
4866
|
capacity?: number | null | undefined;
|
|
4867
|
+
guestLabel?: string | null | undefined;
|
|
4868
|
+
guest?: string | null | undefined;
|
|
4851
4869
|
} | null | undefined;
|
|
4852
4870
|
} | null;
|
|
4853
4871
|
type: "set" | "product" | "bundle";
|
|
@@ -4986,7 +5004,7 @@ type APIOrdersBrowseResult = {
|
|
|
4986
5004
|
slotId: string | null;
|
|
4987
5005
|
attendees: {
|
|
4988
5006
|
name: string;
|
|
4989
|
-
email: string;
|
|
5007
|
+
email: string | null;
|
|
4990
5008
|
phone: string | null;
|
|
4991
5009
|
dietary: string | null;
|
|
4992
5010
|
notes: string | null;
|
|
@@ -5292,6 +5310,8 @@ type APIOrderGetByIdResult = {
|
|
|
5292
5310
|
startsAt?: string | null | undefined;
|
|
5293
5311
|
location?: string | null | undefined;
|
|
5294
5312
|
capacity?: number | null | undefined;
|
|
5313
|
+
guestLabel?: string | null | undefined;
|
|
5314
|
+
guest?: string | null | undefined;
|
|
5295
5315
|
} | null | undefined;
|
|
5296
5316
|
} | null;
|
|
5297
5317
|
type: "set" | "product" | "bundle";
|
|
@@ -5430,7 +5450,7 @@ type APIOrderGetByIdResult = {
|
|
|
5430
5450
|
slotId: string | null;
|
|
5431
5451
|
attendees: {
|
|
5432
5452
|
name: string;
|
|
5433
|
-
email: string;
|
|
5453
|
+
email: string | null;
|
|
5434
5454
|
phone: string | null;
|
|
5435
5455
|
dietary: string | null;
|
|
5436
5456
|
notes: string | null;
|
|
@@ -5607,6 +5627,7 @@ type APIOrderGetByIdResult = {
|
|
|
5607
5627
|
externalShipmentId: string | null;
|
|
5608
5628
|
source: string | null;
|
|
5609
5629
|
stripeDeduplicationId: string | null;
|
|
5630
|
+
ticketCode: string | null;
|
|
5610
5631
|
activeSubscriptionId: string | null;
|
|
5611
5632
|
activeSubscription: {
|
|
5612
5633
|
id: string;
|
|
@@ -5754,6 +5775,8 @@ type APIOrderGetByIdResult = {
|
|
|
5754
5775
|
startsAt?: string | null | undefined;
|
|
5755
5776
|
location?: string | null | undefined;
|
|
5756
5777
|
capacity?: number | null | undefined;
|
|
5778
|
+
guestLabel?: string | null | undefined;
|
|
5779
|
+
guest?: string | null | undefined;
|
|
5757
5780
|
} | null | undefined;
|
|
5758
5781
|
} | null;
|
|
5759
5782
|
type: "set" | "product" | "bundle";
|
|
@@ -5892,7 +5915,7 @@ type APIOrderGetByIdResult = {
|
|
|
5892
5915
|
slotId: string | null;
|
|
5893
5916
|
attendees: {
|
|
5894
5917
|
name: string;
|
|
5895
|
-
email: string;
|
|
5918
|
+
email: string | null;
|
|
5896
5919
|
phone: string | null;
|
|
5897
5920
|
dietary: string | null;
|
|
5898
5921
|
notes: string | null;
|
|
@@ -6364,6 +6387,7 @@ type APICollectionsBrowseResult = Omit<{
|
|
|
6364
6387
|
slug: string;
|
|
6365
6388
|
active: boolean;
|
|
6366
6389
|
description: JSONContent | null;
|
|
6390
|
+
group: string | null;
|
|
6367
6391
|
productCollections: {
|
|
6368
6392
|
productId: string;
|
|
6369
6393
|
}[];
|
|
@@ -6384,6 +6408,7 @@ type APICollectionsBrowseResult = Omit<{
|
|
|
6384
6408
|
slug: string;
|
|
6385
6409
|
active: boolean;
|
|
6386
6410
|
description: JSONContent | null;
|
|
6411
|
+
group: string | null;
|
|
6387
6412
|
productCollections: {
|
|
6388
6413
|
productId: string;
|
|
6389
6414
|
}[];
|
|
@@ -6403,6 +6428,7 @@ type APICollectionsBrowseQueryParams = {
|
|
|
6403
6428
|
limit?: number | undefined;
|
|
6404
6429
|
query?: string | undefined;
|
|
6405
6430
|
active?: boolean | undefined;
|
|
6431
|
+
group?: string | undefined;
|
|
6406
6432
|
lang?: string | undefined;
|
|
6407
6433
|
};
|
|
6408
6434
|
type APICollectionGetByIdResult = ({
|
|
@@ -6429,6 +6455,7 @@ type APICollectionGetByIdResult = ({
|
|
|
6429
6455
|
} | null;
|
|
6430
6456
|
longDescription: JSONContent | null;
|
|
6431
6457
|
kind: "product" | "event";
|
|
6458
|
+
group: string | null;
|
|
6432
6459
|
productCollections: {
|
|
6433
6460
|
position: string | null;
|
|
6434
6461
|
productId: string;
|
|
@@ -6482,6 +6509,7 @@ type APICollectionGetByIdResult = ({
|
|
|
6482
6509
|
} | null;
|
|
6483
6510
|
longDescription: JSONContent | null;
|
|
6484
6511
|
kind: "product" | "event";
|
|
6512
|
+
group: string | null;
|
|
6485
6513
|
productCollections: {
|
|
6486
6514
|
position: string | null;
|
|
6487
6515
|
productId: string;
|
|
@@ -7494,6 +7522,7 @@ type APICollectionCreateBody = {
|
|
|
7494
7522
|
slug?: string | undefined;
|
|
7495
7523
|
description?: string | undefined;
|
|
7496
7524
|
image?: string | undefined;
|
|
7525
|
+
group?: string | undefined;
|
|
7497
7526
|
};
|
|
7498
7527
|
type APICollectionCreateResult = {
|
|
7499
7528
|
data: {
|
|
@@ -7504,6 +7533,7 @@ type APICollectionCreateResult = {
|
|
|
7504
7533
|
slug: string;
|
|
7505
7534
|
active: boolean;
|
|
7506
7535
|
description: JSONContent | null;
|
|
7536
|
+
group: string | null;
|
|
7507
7537
|
productCollections: {
|
|
7508
7538
|
productId: string;
|
|
7509
7539
|
}[];
|
|
@@ -7528,6 +7558,7 @@ type APICollectionUpdateBody = {
|
|
|
7528
7558
|
max?: number | null | undefined;
|
|
7529
7559
|
} | undefined;
|
|
7530
7560
|
active?: boolean | undefined;
|
|
7561
|
+
group?: string | null | undefined;
|
|
7531
7562
|
};
|
|
7532
7563
|
type APICollectionUpdateResult = {
|
|
7533
7564
|
id: string;
|
|
@@ -7553,6 +7584,7 @@ type APICollectionUpdateResult = {
|
|
|
7553
7584
|
} | null;
|
|
7554
7585
|
longDescription: JSONContent | null;
|
|
7555
7586
|
kind: "product" | "event";
|
|
7587
|
+
group: string | null;
|
|
7556
7588
|
productCollections: {
|
|
7557
7589
|
position: string | null;
|
|
7558
7590
|
productId: string;
|
|
@@ -7672,13 +7704,21 @@ type APIEventsBrowseResult = {
|
|
|
7672
7704
|
id: string;
|
|
7673
7705
|
name: string;
|
|
7674
7706
|
slug: string;
|
|
7707
|
+
summary: string | null;
|
|
7708
|
+
status: "draft" | "published" | "hidden";
|
|
7675
7709
|
images: string[];
|
|
7676
7710
|
event: {
|
|
7677
7711
|
enabled: boolean;
|
|
7678
7712
|
startsAt?: string | null | undefined;
|
|
7679
7713
|
location?: string | null | undefined;
|
|
7680
7714
|
capacity?: number | null | undefined;
|
|
7715
|
+
guestLabel?: string | null | undefined;
|
|
7716
|
+
guest?: string | null | undefined;
|
|
7681
7717
|
};
|
|
7718
|
+
ticket: {
|
|
7719
|
+
variantId: string;
|
|
7720
|
+
price: string;
|
|
7721
|
+
} | null;
|
|
7682
7722
|
ticketsSold: number;
|
|
7683
7723
|
groups: {
|
|
7684
7724
|
id: string;
|
|
@@ -7697,6 +7737,7 @@ type APIEventGetByIdResult = {
|
|
|
7697
7737
|
name: string;
|
|
7698
7738
|
slug: string;
|
|
7699
7739
|
summary: string | null;
|
|
7740
|
+
content: JSONContent | null;
|
|
7700
7741
|
status: "draft" | "published" | "hidden";
|
|
7701
7742
|
images: string[];
|
|
7702
7743
|
event: {
|
|
@@ -7704,7 +7745,13 @@ type APIEventGetByIdResult = {
|
|
|
7704
7745
|
startsAt?: string | null | undefined;
|
|
7705
7746
|
location?: string | null | undefined;
|
|
7706
7747
|
capacity?: number | null | undefined;
|
|
7748
|
+
guestLabel?: string | null | undefined;
|
|
7749
|
+
guest?: string | null | undefined;
|
|
7707
7750
|
};
|
|
7751
|
+
ticket: {
|
|
7752
|
+
variantId: string;
|
|
7753
|
+
price: string;
|
|
7754
|
+
} | null;
|
|
7708
7755
|
groups: {
|
|
7709
7756
|
id: string;
|
|
7710
7757
|
name: string;
|
|
@@ -7721,7 +7768,10 @@ type APIEventCreateBody = {
|
|
|
7721
7768
|
startsAt?: string | null | undefined;
|
|
7722
7769
|
location?: string | null | undefined;
|
|
7723
7770
|
capacity?: number | null | undefined;
|
|
7771
|
+
guestLabel?: string | null | undefined;
|
|
7772
|
+
guest?: string | null | undefined;
|
|
7724
7773
|
description?: string | null | undefined;
|
|
7774
|
+
content?: any;
|
|
7725
7775
|
collectionIds?: string[] | undefined;
|
|
7726
7776
|
collectionNames?: string[] | undefined;
|
|
7727
7777
|
};
|
|
@@ -7744,7 +7794,10 @@ type APIEventUpdateBody = {
|
|
|
7744
7794
|
startsAt?: string | null | undefined;
|
|
7745
7795
|
location?: string | null | undefined;
|
|
7746
7796
|
capacity?: number | null | undefined;
|
|
7797
|
+
guestLabel?: string | null | undefined;
|
|
7798
|
+
guest?: string | null | undefined;
|
|
7747
7799
|
description?: string | null | undefined;
|
|
7800
|
+
content?: any;
|
|
7748
7801
|
status?: "published" | "draft" | undefined;
|
|
7749
7802
|
images?: string[] | undefined;
|
|
7750
7803
|
collectionIds?: string[] | undefined;
|
|
@@ -7761,9 +7814,110 @@ type APIEventAttendeesBrowseResult = {
|
|
|
7761
7814
|
name: string | null;
|
|
7762
7815
|
email: string | null;
|
|
7763
7816
|
quantity: number;
|
|
7817
|
+
source: "ticket" | "buyer";
|
|
7764
7818
|
}[];
|
|
7765
7819
|
totalTickets: number;
|
|
7766
7820
|
};
|
|
7821
|
+
type APITicketsGetParams = {
|
|
7822
|
+
code: string;
|
|
7823
|
+
};
|
|
7824
|
+
type APITicketsGetQueryParams = {
|
|
7825
|
+
email: string;
|
|
7826
|
+
};
|
|
7827
|
+
type APITicketsGetResult = {
|
|
7828
|
+
code: string;
|
|
7829
|
+
order: {
|
|
7830
|
+
id: string;
|
|
7831
|
+
lookup: number;
|
|
7832
|
+
createdAt: string;
|
|
7833
|
+
status: string;
|
|
7834
|
+
currency: string;
|
|
7835
|
+
totalGross: number | null;
|
|
7836
|
+
};
|
|
7837
|
+
buyerEmail: string;
|
|
7838
|
+
lines: {
|
|
7839
|
+
lineItemId: string;
|
|
7840
|
+
product: {
|
|
7841
|
+
id: string;
|
|
7842
|
+
name: string;
|
|
7843
|
+
slug: string;
|
|
7844
|
+
image: string | null;
|
|
7845
|
+
};
|
|
7846
|
+
event: {
|
|
7847
|
+
startsAt: string | null;
|
|
7848
|
+
location: string | null;
|
|
7849
|
+
guestLabel: string | null;
|
|
7850
|
+
guest: string | null;
|
|
7851
|
+
};
|
|
7852
|
+
seats: {
|
|
7853
|
+
token: string;
|
|
7854
|
+
name: string | null;
|
|
7855
|
+
email: string | null;
|
|
7856
|
+
}[];
|
|
7857
|
+
}[];
|
|
7858
|
+
};
|
|
7859
|
+
type APITicketsUpdateBody = {
|
|
7860
|
+
email: string;
|
|
7861
|
+
seats: {
|
|
7862
|
+
token: string;
|
|
7863
|
+
name: string;
|
|
7864
|
+
email: string | null;
|
|
7865
|
+
}[];
|
|
7866
|
+
};
|
|
7867
|
+
type APITicketsUpdateResult = {
|
|
7868
|
+
code: string;
|
|
7869
|
+
order: {
|
|
7870
|
+
id: string;
|
|
7871
|
+
lookup: number;
|
|
7872
|
+
createdAt: string;
|
|
7873
|
+
status: string;
|
|
7874
|
+
currency: string;
|
|
7875
|
+
totalGross: number | null;
|
|
7876
|
+
};
|
|
7877
|
+
buyerEmail: string;
|
|
7878
|
+
lines: {
|
|
7879
|
+
lineItemId: string;
|
|
7880
|
+
product: {
|
|
7881
|
+
id: string;
|
|
7882
|
+
name: string;
|
|
7883
|
+
slug: string;
|
|
7884
|
+
image: string | null;
|
|
7885
|
+
};
|
|
7886
|
+
event: {
|
|
7887
|
+
startsAt: string | null;
|
|
7888
|
+
location: string | null;
|
|
7889
|
+
guestLabel: string | null;
|
|
7890
|
+
guest: string | null;
|
|
7891
|
+
};
|
|
7892
|
+
seats: {
|
|
7893
|
+
token: string;
|
|
7894
|
+
name: string | null;
|
|
7895
|
+
email: string | null;
|
|
7896
|
+
}[];
|
|
7897
|
+
}[];
|
|
7898
|
+
};
|
|
7899
|
+
type APITicketAttendeeGetParams = {
|
|
7900
|
+
token: string;
|
|
7901
|
+
};
|
|
7902
|
+
type APITicketAttendeeGetResult = {
|
|
7903
|
+
token: string;
|
|
7904
|
+
attendee: {
|
|
7905
|
+
name: string | null;
|
|
7906
|
+
email: string | null;
|
|
7907
|
+
};
|
|
7908
|
+
product: {
|
|
7909
|
+
name: string;
|
|
7910
|
+
slug: string;
|
|
7911
|
+
image: string | null;
|
|
7912
|
+
};
|
|
7913
|
+
event: {
|
|
7914
|
+
startsAt: string | null;
|
|
7915
|
+
location: string | null;
|
|
7916
|
+
guestLabel: string | null;
|
|
7917
|
+
guest: string | null;
|
|
7918
|
+
};
|
|
7919
|
+
orderStatus: string;
|
|
7920
|
+
};
|
|
7767
7921
|
type APIBrandsBrowseResult = Omit<{
|
|
7768
7922
|
data: {
|
|
7769
7923
|
id: string;
|
|
@@ -8078,4 +8232,4 @@ type APICartDeleteResult = {
|
|
|
8078
8232
|
success: boolean;
|
|
8079
8233
|
};
|
|
8080
8234
|
|
|
8081
|
-
export type { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryDeleteResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartAddBody, APICartAddResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdQueryParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateQueryParams, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionDeleteResult, APICollectionGetByIdParams, APICollectionGetByIdQueryParams, APICollectionGetByIdResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageGetByPathResult, APILegalPagesBrowseResult, APIMeGetResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteQueryParams, APIProductDeleteResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdQueryParams, APIProductGetByIdResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateQueryParams, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdQueryParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, JSONContent };
|
|
8235
|
+
export type { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryDeleteResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartAddBody, APICartAddResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdQueryParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateQueryParams, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionDeleteResult, APICollectionGetByIdParams, APICollectionGetByIdQueryParams, APICollectionGetByIdResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageGetByPathResult, APILegalPagesBrowseResult, APIMeGetResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteQueryParams, APIProductDeleteResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdQueryParams, APIProductGetByIdResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateQueryParams, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APITicketAttendeeGetParams, APITicketAttendeeGetResult, APITicketsGetParams, APITicketsGetQueryParams, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdQueryParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, JSONContent };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { APIMeGetResult, APISocialsGetResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandDeleteResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIOrderRefundsParams, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIProductBatchBody, APIProductBatchResult, APICartDeleteResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APICartCreateBody, APICartCreateResult, APICartGetResult, APICollectionGetByIdParams, APICollectionGetByIdResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostCreateBody, APIPostCreateResult, APIPostUpdateBody, APIPostUpdateResult, APIPostDeleteResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBlogCategoryDeleteResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APIProductCreateBody, APIProductCreateResult, APIProductUpdateBody, APIProductUpdateResult, APIProductDeleteResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventCreateBody, APIEventCreateResult, APIEventUpdateBody, APIEventUpdateResult, APIEventAttendeesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryUpdateBody, APICategoryUpdateResult, APICategoryDeleteResult, APIOrderUpdateBody, APIOrderUpdateResult, APILegalPagesBrowseResult, APILegalPageGetByPathResult, APISearchQueryParams, APISearchResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult } from './api-types.js';
|
|
2
|
-
export { APICartAddBody, APICartAddResult, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoryGetByIdQueryParams, APICategoryUpdateQueryParams, APICollectionGetByIdQueryParams, APIProductDeleteQueryParams, APIProductGetByIdQueryParams, APIProductUpdateQueryParams, APIVariantGetByIdQueryParams, JSONContent } from './api-types.js';
|
|
1
|
+
import { APIMeGetResult, APISocialsGetResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandDeleteResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIOrderRefundsParams, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIProductBatchBody, APIProductBatchResult, APICartDeleteResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APICartCreateBody, APICartCreateResult, APICartGetResult, APICollectionGetByIdParams, APICollectionGetByIdResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostCreateBody, APIPostCreateResult, APIPostUpdateBody, APIPostUpdateResult, APIPostDeleteResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBlogCategoryDeleteResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APIProductCreateBody, APIProductCreateResult, APIProductUpdateBody, APIProductUpdateResult, APIProductDeleteResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventCreateBody, APIEventCreateResult, APIEventUpdateBody, APIEventUpdateResult, APIEventAttendeesBrowseResult, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APITicketAttendeeGetResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryUpdateBody, APICategoryUpdateResult, APICategoryDeleteResult, APIOrderUpdateBody, APIOrderUpdateResult, APILegalPagesBrowseResult, APILegalPageGetByPathResult, APISearchQueryParams, APISearchResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult } from './api-types.js';
|
|
2
|
+
export { APICartAddBody, APICartAddResult, APICartRemoveItemQueryParams, APICartRemoveItemResult, APICategoryGetByIdQueryParams, APICategoryUpdateQueryParams, APICollectionGetByIdQueryParams, APIProductDeleteQueryParams, APIProductGetByIdQueryParams, APIProductUpdateQueryParams, APITicketAttendeeGetParams, APITicketsGetParams, APITicketsGetQueryParams, APIVariantGetByIdQueryParams, JSONContent } from './api-types.js';
|
|
3
3
|
|
|
4
4
|
interface CommerceConfig {
|
|
5
5
|
/** API key. Defaults to process.env.YNS_API_KEY */
|
|
@@ -107,6 +107,31 @@ declare class YNSProvider {
|
|
|
107
107
|
eventCreate(body: APIEventCreateBody): Promise<APIEventCreateResult>;
|
|
108
108
|
eventUpdate(params: APIEventGetByIdParams, body: APIEventUpdateBody): Promise<APIEventUpdateResult>;
|
|
109
109
|
eventAttendeesBrowse(params: APIEventGetByIdParams): Promise<APIEventAttendeesBrowseResult>;
|
|
110
|
+
/**
|
|
111
|
+
* Buyer ticket lookup: the order's 6-character access code plus the purchase email.
|
|
112
|
+
* Resolves to `null` on mismatch — the API answers a uniform 404 for an unknown code,
|
|
113
|
+
* an email that doesn't match, or an order without tickets.
|
|
114
|
+
*/
|
|
115
|
+
ticketsGet(params: {
|
|
116
|
+
code: string;
|
|
117
|
+
email: string;
|
|
118
|
+
}): Promise<APITicketsGetResult | null>;
|
|
119
|
+
/**
|
|
120
|
+
* Buyer bulk-edit of attendee names/emails. The body carries the purchase email; seat
|
|
121
|
+
* tokens not belonging to the order are silently ignored. Throws on code/email mismatch
|
|
122
|
+
* (404) or when the order is cancelled/refunded (409).
|
|
123
|
+
*/
|
|
124
|
+
ticketsUpdate(params: {
|
|
125
|
+
code: string;
|
|
126
|
+
}, body: APITicketsUpdateBody): Promise<APITicketsUpdateResult>;
|
|
127
|
+
/**
|
|
128
|
+
* View-only attendee ticket by per-seat token (the capability embedded in the attendee
|
|
129
|
+
* link/QR). Resolves to `null` for an unknown token. Attendee details can only be edited
|
|
130
|
+
* by the buyer via {@link ticketsUpdate} — attendee links must not escalate.
|
|
131
|
+
*/
|
|
132
|
+
ticketAttendeeGet(params: {
|
|
133
|
+
token: string;
|
|
134
|
+
}): Promise<APITicketAttendeeGetResult | null>;
|
|
110
135
|
categoryCreate(body: APICategoryCreateBody): Promise<APICategoryCreateResult>;
|
|
111
136
|
categoryUpdate(params: APICategoryGetByIdParams, body: APICategoryUpdateBody): Promise<APICategoryUpdateResult>;
|
|
112
137
|
categoryDelete(params: APICategoryGetByIdParams): Promise<APICategoryDeleteResult>;
|
|
@@ -146,4 +171,4 @@ declare class YNSProvider {
|
|
|
146
171
|
|
|
147
172
|
declare function Commerce(config?: CommerceConfig): YNSProvider;
|
|
148
173
|
|
|
149
|
-
export { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryDeleteResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionDeleteResult, APICollectionGetByIdParams, APICollectionGetByIdResult, type APICollectionImportMembershipsBody, type APICollectionImportMembershipsResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageGetByPathResult, APILegalPagesBrowseResult, APIMeGetResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, Commerce, type CommerceConfig, YNSProvider };
|
|
174
|
+
export { APIBlogCategoriesBrowseQueryParams, APIBlogCategoriesBrowseResult, APIBlogCategoryCreateBody, APIBlogCategoryCreateResult, APIBlogCategoryDeleteResult, APIBlogCategoryGetByIdParams, APIBlogCategoryGetByIdResult, APIBlogCategoryUpdateBody, APIBlogCategoryUpdateResult, APIBrandAssignProductsBody, APIBrandAssignProductsResult, APIBrandCreateBody, APIBrandCreateResult, APIBrandDeleteResult, APIBrandGetByIdParams, APIBrandGetByIdResult, APIBrandUpdateBody, APIBrandUpdateResult, APIBrandsBrowseQueryParams, APIBrandsBrowseResult, APICartCreateBody, APICartCreateResult, APICartDeleteResult, APICartGetResult, APICategoriesBrowseQueryParams, APICategoriesBrowseResult, APICategoryCreateBody, APICategoryCreateResult, APICategoryDeleteResult, APICategoryGetByIdParams, APICategoryGetByIdResult, APICategoryUpdateBody, APICategoryUpdateResult, APICollectionCreateBody, APICollectionCreateResult, APICollectionDeleteResult, APICollectionGetByIdParams, APICollectionGetByIdResult, type APICollectionImportMembershipsBody, type APICollectionImportMembershipsResult, APICollectionUpdateBody, APICollectionUpdateResult, APICollectionsBrowseQueryParams, APICollectionsBrowseResult, APIContactMessageCreateBody, APIContactMessageCreateResult, APICustomerAddressCreateBody, APICustomerAddressCreateResult, APICustomerGetByIdParams, APICustomerGetByIdResult, APICustomerOrdersBrowseQueryParams, APICustomerOrdersBrowseResult, APICustomerUpdateBody, APICustomerUpdateResult, APICustomersBrowseQueryParams, APICustomersBrowseResult, APIEventAttendeesBrowseResult, APIEventCreateBody, APIEventCreateResult, APIEventGetByIdParams, APIEventGetByIdResult, APIEventUpdateBody, APIEventUpdateResult, APIEventsBrowseQueryParams, APIEventsBrowseResult, APIInstaviewImagesBrowseParams, APIInstaviewImagesBrowseQueryParams, APIInstaviewImagesBrowseResult, APIInventoryAdjustBody, APIInventoryAdjustResult, APIInventoryBrowseQueryParams, APIInventoryBrowseResult, APILegalPageGetByPathResult, APILegalPagesBrowseResult, APIMeGetResult, APIOrderGetByIdParams, APIOrderGetByIdResult, APIOrderRefundGetParams, APIOrderRefundGetResult, APIOrderRefundsBrowseQueryParams, APIOrderRefundsBrowseResult, APIOrderRefundsParams, APIOrderUpdateBody, APIOrderUpdateResult, APIOrdersBrowseQueryParams, APIOrdersBrowseResult, APIPostCommentCreateBody, APIPostCommentCreateResult, APIPostCommentsBrowseQueryParams, APIPostCommentsBrowseResult, APIPostCreateBody, APIPostCreateResult, APIPostDeleteResult, APIPostGetByIdParams, APIPostGetByIdResult, APIPostUpdateBody, APIPostUpdateResult, APIPostsBrowseQueryParams, APIPostsBrowseResult, APIProductBatchBody, APIProductBatchResult, APIProductCreateBody, APIProductCreateResult, APIProductDeleteResult, APIProductFiltersResult, APIProductGetByIdParams, APIProductGetByIdResult, APIProductReviewCreateBody, APIProductReviewCreateResult, APIProductReviewsBrowseQueryParams, APIProductReviewsBrowseResult, APIProductUpdateBody, APIProductUpdateResult, APIProductsBrowseQueryParams, APIProductsBrowseResult, APISearchQueryParams, APISearchResult, APISocialsGetResult, APISubscriberCreateBody, APISubscriberCreateResult, APISubscriberDeleteResult, APITicketAttendeeGetResult, APITicketsGetResult, APITicketsUpdateBody, APITicketsUpdateResult, APIVariantCreateBody, APIVariantCreateResult, APIVariantGetByIdParams, APIVariantGetByIdResult, APIVariantUpdateBody, APIVariantUpdateResult, Commerce, type CommerceConfig, YNSProvider };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"./chunk-PNKB6P4V.js";var B=process.env.YNS_API_KEY,y={YNS_API_KEY:B};var i={DEBUG:0,LOG:1,WARN:2,ERROR:3},R=process.env.NEXT_PUBLIC_LOG_LEVEL||"LOG",P=i[R],m="\x1B[0m",p="\x1B[34m",C="\x1B[32m",h="\x1B[33m",f="\x1B[31m",w="\u23F1\uFE0F",S="\u{1F41B}",v="\u2714\uFE0F",G="\u26A0\uFE0F",$="\u274C",g=`${w} `,E=`${p}${S}${m} `,O=`${C}${v}${m} `,b=`${h}${G}${m} `,U=`${f}${$}${m} `,A=c=>{let e=c?`[${c}] `:"";return{getLogger(t){return A([c,t].filter(Boolean).join(" > "))},time(t){P>i.DEBUG||console.time([g,e,t].filter(Boolean).join(" "))},timeEnd(t){P>i.DEBUG||console.timeEnd([g,e,t].filter(Boolean).join(" "))},debug(...t){P>i.DEBUG||console.log(...[E,e,...t].filter(Boolean))},log(...t){P>i.LOG||console.log(...[O,e,...t].filter(Boolean))},dir(t,s){P>i.LOG||console.dir(t,s)},warn(...t){P>i.WARN||console.warn(...[b,e,...t].filter(Boolean))},error(...t){P>i.ERROR||console.error(...[U,e,...t].filter(Boolean))}}},D=A();var l=class{#s;#t=A("YNSProvider");constructor(e={}){let t=e.token??y.YNS_API_KEY,s=y.YNS_API_KEY?.startsWith("sk-s-");if(!t)throw new Error("YNS API key is required. Set YNS_API_KEY environment variable or pass token in config.");let r=e.endpoint??(s?"https://yns.cx":"https://yns.store");this.#s={version:"v1",...e,token:t,endpoint:r},this.#t.debug("YNSProvider initialized",{endpoint:r,token:e.token?"from config":"from env"})}async#e(e,t="GET",s){let r=this.#t.getLogger("#restRequest"),o=`${this.#s.endpoint}/api/${this.#s.version}${e}`;r.debug(`Making ${t} request to YNS API: ${o}`);let n=await fetch(o,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#s.token}`},body:s?JSON.stringify(s):void 0});if(!n.ok){let u=n.headers.get("content-type"),a=`YNS REST request failed: ${t} ${o} ${n.status} ${n.statusText}`;if(u?.includes("application/json"))try{let d=await n.json();a=d.error||d.message||a}catch(d){r.error("Failed to parse YNS error response as JSON",d)}else{let d=await n.text();r.error(`YNS API request failed: ${n.status} ${n.statusText}`,a,d)}throw new Error(a)}let I=n.headers.get("content-type");if(!I?.includes("application/json"))throw new Error(`YNS API returned ${I} instead of JSON for ${e}`);return n.json()}async#r(e,t){let s=this.#t.getLogger("#multipartRequest"),r=`${this.#s.endpoint}/api/${this.#s.version}${e}`;s.debug(`Making multipart POST to YNS API: ${r}`);let o=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${this.#s.token}`},body:t});if(!o.ok){let I=o.headers.get("content-type"),u=`YNS REST request failed: POST ${r} ${o.status} ${o.statusText}`;if(I?.includes("application/json"))try{let a=await o.json();u=a.error||a.message||u}catch(a){s.error("Failed to parse YNS error response as JSON",a)}else{let a=await o.text();s.error(`YNS API request failed: ${o.status} ${o.statusText}`,u,a)}throw new Error(u)}let n=o.headers.get("content-type");if(!n?.includes("application/json"))throw new Error(`YNS API returned ${n} instead of JSON for ${e}`);return o.json()}async meGet(){let e=this.#t.getLogger("meGet");e.debug("Fetching my information");let s=await this.#e("/me");return e.debug("Received my information:",s),s}async socialsGet(){let e=this.#t.getLogger("socialsGet");e.debug("Fetching store social links");let s=await this.#e("/socials");return e.debug("Received store social links:",s),s}async brandBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.lang&&t.append("lang",e.lang);let r=`/brands${t.size?`?${t}`:""}`;return this.#e(r)}async brandGet(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t)}async brandCreate(e){return this.#e("/brands","POST",e)}async brandUpdate(e,t){let s=`/brands/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async brandDelete(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t,"DELETE")}async brandAssignProducts(e,t){let s=`/brands/${e.idOrSlug}/products`;return this.#e(s,"POST",t)}async orderRefundsBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString());let s=t.size?`?${t}`:"",r=`/orders/${e.id}/refunds${s}`;return this.#e(r)}async orderRefundGet(e){let t=`/orders/${e.id}/refunds/${e.refundId}`;return this.#e(t)}async productBatch(e){return this.#e("/products/batch","POST",e)}async cartDelete(e){let t=`/carts/${e.cartId}`;return this.#e(t,"DELETE")}async productBrowse(e){let t=this.#t.getLogger("productBrowse");t.debug("Browsing products with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString()),e.category&&s.append("category",e.category),e.collection&&s.append("collection",e.collection),e.brand&&s.append("brand",e.brand),e.priceMin!==void 0&&s.append("priceMin",e.priceMin.toString()),e.priceMax!==void 0&&s.append("priceMax",e.priceMax.toString()),e.vts&&s.append("vts",e.vts),e.query&&s.append("query",e.query),e.active!==void 0&&s.append("active",e.active.toString()),e.orderBy&&s.append("orderBy",e.orderBy),e.orderDirection&&s.append("orderDirection",e.orderDirection);let o=`/products${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let n=await this.#e(o);return t.debug("Received product browse result:",{meta:n.meta}),n}async productFilters(){return await this.#e("/products/filters")}async productGet(e){let t=`/products/${e.idOrSlug}`,s=await this.#e(t);return s||null}async orderBrowse(e){let t=this.#t.getLogger("orderBrowse");t.debug("Browsing orders with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString());let o=`/orders${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let n=await this.#e(o);return t.debug("Received orders browse result:",{meta:n.meta}),n}async orderGet(e){let t=`/orders/${e.id}`,s=await this.#e(t);return s||null}async cartUpsert(e){return await this.#e("/carts","POST",e)}async cartRemoveItem(e){let t=`/carts/${e.cartId}/line-items/${e.variantId}`;return this.#e(t,"DELETE")}async cartGet(e){let t=`/carts/${e.cartId}`;return await this.#e(t)}async collectionGet(e){let t=`/collections/${e.idOrSlug}`;return await this.#e(t)}async collectionBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/collections${t.size?`?${t}`:""}`;return await this.#e(r)}async collectionCreate(e){return this.#e("/collections","POST",e)}async collectionUpdate(e,t){let s=`/collections/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async collectionDelete(e){let t=`/collections/${e.idOrSlug}`;return this.#e(t,"DELETE")}async collectionImportMemberships(e){let t=new FormData;return t.append("file",e.file),this.#r("/collections/import-memberships",t)}async categoryGet(e){let t=`/categories/${e.idOrSlug}`;return await this.#e(t)}async categoriesBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/categories${t.size?`?${t}`:""}`;return await this.#e(r)}async postBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.tag&&t.append("tag",e.tag),e.categoryId&&t.append("categoryId",e.categoryId);let r=`/posts${t.size?`?${t}`:""}`;return this.#e(r)}async postGet(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t)}async postCreate(e){return this.#e("/posts","POST",e)}async postUpdate(e,t){let s=`/posts/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async postDelete(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t,"DELETE")}async postCommentsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/posts/${e.idOrSlug}/comments${r}`;return this.#e(o)}async postCommentCreate(e,t){let s=`/posts/${e.idOrSlug}/comments`;return this.#e(s,"POST",t)}async blogCategoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/blog-categories${t.size?`?${t}`:""}`;return this.#e(r)}async blogCategoryGet(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t)}async blogCategoryCreate(e){return this.#e("/blog-categories","POST",e)}async blogCategoryUpdate(e,t){let s=`/blog-categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async blogCategoryDelete(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async customerBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.search&&t.append("search",e.search);let r=`/customers${t.size?`?${t}`:""}`;return this.#e(r)}async customerGet(e){let t=`/customers/${e.id}`;return this.#e(t)}async customerUpdate(e,t){let s=`/customers/${e.id}`;return this.#e(s,"PATCH",t)}async customerAddressCreate(e,t){let s=`/customers/${e.id}/addresses`;return this.#e(s,"POST",t)}async customerAddressDelete(e){let t=`/customers/${e.customerId}/addresses/${e.addressId}`;await this.#e(t,"DELETE")}async customerOrdersBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/customers/${e.id}/orders${r}`;return this.#e(o)}async inventoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.cursor&&t.append("cursor",e.cursor),e.lowStock!==void 0&&t.append("lowStock",e.lowStock.toString());let r=`/inventory${t.size?`?${t}`:""}`;return this.#e(r)}async inventoryAdjust(e,t){let s=`/inventory/${encodeURIComponent(e)}/adjust`;return this.#e(s,"POST",t)}async variantGet(e){let t=`/variants/${e.idOrSku}`;return this.#e(t)}async variantUpdate(e,t){let s=`/variants/${e.idOrSku}`;return this.#e(s,"PATCH",t)}async variantDelete(e){let t=`/variants/${e.idOrSku}`;await this.#e(t,"DELETE")}async variantCreate(e,t){let s=`/products/${e}/variants`;return this.#e(s,"POST",t)}async subscriberCreate(e){return this.#e("/subscribers","POST",e)}async subscriberDelete(e){let t=`/subscribers?email=${encodeURIComponent(e)}`;return this.#e(t,"DELETE")}async contactMessageCreate(e){return this.#e("/contact-messages","POST",e)}async productCreate(e){return this.#e("/products","POST",e)}async productUpdate(e,t){let s=`/products/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async productDelete(e){let t=`/products/${e.idOrSlug}`;return this.#e(t,"DELETE")}async productReviewsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/products/${e.idOrSlug}/reviews${r}`;return this.#e(o)}async productReviewCreate(e,t){let s=`/products/${e.idOrSlug}/reviews`;return this.#e(s,"POST",t)}async eventBrowse(e={}){let t=this.#t.getLogger("eventBrowse"),s=new URLSearchParams;e.offset!==void 0&&s.append("offset",e.offset.toString()),e.limit!==void 0&&s.append("limit",e.limit.toString());let o=`/events${s.size?`?${s}`:""}`;return t.debug("Browsing events:",o),this.#e(o)}async eventGet(e){let t=`/events/${e.idOrSlug}`;return this.#e(t)}async eventCreate(e){return this.#e("/events","POST",e)}async eventUpdate(e,t){let s=`/events/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async eventAttendeesBrowse(e){let t=`/events/${e.idOrSlug}/attendees`;return this.#e(t)}async categoryCreate(e){return this.#e("/categories","POST",e)}async categoryUpdate(e,t){let s=`/categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async categoryDelete(e){let t=`/categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async orderUpdate(e,t){let s=`/orders/${e.id}`;return this.#e(s,"PATCH",t)}async legalPageBrowse(){return this.#e("/legal-pages")}async legalPageGet(e){let t=e.startsWith("/")?e.slice(1):e,s=`/legal-pages/${encodeURIComponent(t)}`;return this.#e(s)}async search(e){return this.request("/search",{query:e})}async instaviewImagesBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.cursor&&s.append("cursor",t.cursor);let r=s.size?`?${s}`:"",o=`/instaview/accounts/${e.handle}/images${r}`;return this.#e(o)}async request(e,t){let s=t?.query?`?${new URLSearchParams(Object.entries(t.query).map(([r,o])=>[r,String(o)]))}`:"";return this.#e(`${e}${s}`,t?.method??"GET",t?.body)}};function T(c={}){return new l(c)}export{T as Commerce,l as YNSProvider};
|
|
1
|
+
import"./chunk-PNKB6P4V.js";var g=process.env.YNS_API_KEY,m={YNS_API_KEY:g};var P={DEBUG:0,LOG:1,WARN:2,ERROR:3},B=process.env.NEXT_PUBLIC_LOG_LEVEL||"LOG",c=P[B],l="\x1B[0m",R="\x1B[34m",p="\x1B[32m",C="\x1B[33m",h="\x1B[31m",f="\u23F1\uFE0F",w="\u{1F41B}",S="\u2714\uFE0F",G="\u26A0\uFE0F",v="\u274C",y=`${f} `,$=`${R}${w}${l} `,E=`${p}${S}${l} `,O=`${C}${G}${l} `,T=`${h}${v}${l} `,I=u=>{let e=u?`[${u}] `:"";return{getLogger(t){return I([u,t].filter(Boolean).join(" > "))},time(t){c>P.DEBUG||console.time([y,e,t].filter(Boolean).join(" "))},timeEnd(t){c>P.DEBUG||console.timeEnd([y,e,t].filter(Boolean).join(" "))},debug(...t){c>P.DEBUG||console.log(...[$,e,...t].filter(Boolean))},log(...t){c>P.LOG||console.log(...[E,e,...t].filter(Boolean))},dir(t,s){c>P.LOG||console.dir(t,s)},warn(...t){c>P.WARN||console.warn(...[O,e,...t].filter(Boolean))},error(...t){c>P.ERROR||console.error(...[T,e,...t].filter(Boolean))}}},L=I();var d=class{#s;#t=I("YNSProvider");constructor(e={}){let t=e.token??m.YNS_API_KEY,s=m.YNS_API_KEY?.startsWith("sk-s-");if(!t)throw new Error("YNS API key is required. Set YNS_API_KEY environment variable or pass token in config.");let r=e.endpoint??(s?"https://yns.cx":"https://yns.store");this.#s={version:"v1",...e,token:t,endpoint:r},this.#t.debug("YNSProvider initialized",{endpoint:r,token:e.token?"from config":"from env"})}async#e(e,t="GET",s){let r=await this.#o(e,t,s);return this.#n(r,e,t)}async#r(e){let t=await this.#o(e,"GET");return t.status===404?null:this.#n(t,e,"GET")}async#o(e,t,s){let r=this.#t.getLogger("#restRequest"),o=`${this.#s.endpoint}/api/${this.#s.version}${e}`;return r.debug(`Making ${t} request to YNS API: ${o}`),fetch(o,{method:t,headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.#s.token}`},body:s?JSON.stringify(s):void 0})}async#n(e,t,s){let r=this.#t.getLogger("#restRequest"),o=`${this.#s.endpoint}/api/${this.#s.version}${t}`;if(!e.ok){let A=e.headers.get("content-type"),i=`YNS REST request failed: ${s} ${o} ${e.status} ${e.statusText}`;if(A?.includes("application/json"))try{let n=await e.json();i=n.error||n.message||i}catch(n){r.error("Failed to parse YNS error response as JSON",n)}else{let n=await e.text();r.error(`YNS API request failed: ${e.status} ${e.statusText}`,i,n)}throw new Error(i)}let a=e.headers.get("content-type");if(!a?.includes("application/json"))throw new Error(`YNS API returned ${a} instead of JSON for ${t}`);return e.json()}async#a(e,t){let s=this.#t.getLogger("#multipartRequest"),r=`${this.#s.endpoint}/api/${this.#s.version}${e}`;s.debug(`Making multipart POST to YNS API: ${r}`);let o=await fetch(r,{method:"POST",headers:{Authorization:`Bearer ${this.#s.token}`},body:t});if(!o.ok){let A=o.headers.get("content-type"),i=`YNS REST request failed: POST ${r} ${o.status} ${o.statusText}`;if(A?.includes("application/json"))try{let n=await o.json();i=n.error||n.message||i}catch(n){s.error("Failed to parse YNS error response as JSON",n)}else{let n=await o.text();s.error(`YNS API request failed: ${o.status} ${o.statusText}`,i,n)}throw new Error(i)}let a=o.headers.get("content-type");if(!a?.includes("application/json"))throw new Error(`YNS API returned ${a} instead of JSON for ${e}`);return o.json()}async meGet(){let e=this.#t.getLogger("meGet");e.debug("Fetching my information");let s=await this.#e("/me");return e.debug("Received my information:",s),s}async socialsGet(){let e=this.#t.getLogger("socialsGet");e.debug("Fetching store social links");let s=await this.#e("/socials");return e.debug("Received store social links:",s),s}async brandBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.lang&&t.append("lang",e.lang);let r=`/brands${t.size?`?${t}`:""}`;return this.#e(r)}async brandGet(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t)}async brandCreate(e){return this.#e("/brands","POST",e)}async brandUpdate(e,t){let s=`/brands/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async brandDelete(e){let t=`/brands/${e.idOrSlug}`;return this.#e(t,"DELETE")}async brandAssignProducts(e,t){let s=`/brands/${e.idOrSlug}/products`;return this.#e(s,"POST",t)}async orderRefundsBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString());let s=t.size?`?${t}`:"",r=`/orders/${e.id}/refunds${s}`;return this.#e(r)}async orderRefundGet(e){let t=`/orders/${e.id}/refunds/${e.refundId}`;return this.#e(t)}async productBatch(e){return this.#e("/products/batch","POST",e)}async cartDelete(e){let t=`/carts/${e.cartId}`;return this.#e(t,"DELETE")}async productBrowse(e){let t=this.#t.getLogger("productBrowse");t.debug("Browsing products with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString()),e.category&&s.append("category",e.category),e.collection&&s.append("collection",e.collection),e.brand&&s.append("brand",e.brand),e.priceMin!==void 0&&s.append("priceMin",e.priceMin.toString()),e.priceMax!==void 0&&s.append("priceMax",e.priceMax.toString()),e.vts&&s.append("vts",e.vts),e.query&&s.append("query",e.query),e.active!==void 0&&s.append("active",e.active.toString()),e.orderBy&&s.append("orderBy",e.orderBy),e.orderDirection&&s.append("orderDirection",e.orderDirection);let o=`/products${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let a=await this.#e(o);return t.debug("Received product browse result:",{meta:a.meta}),a}async productFilters(){return await this.#e("/products/filters")}async productGet(e){let t=`/products/${e.idOrSlug}`,s=await this.#e(t);return s||null}async orderBrowse(e){let t=this.#t.getLogger("orderBrowse");t.debug("Browsing orders with params:",e);let s=new URLSearchParams;e.limit&&s.append("limit",e.limit.toString()),e.offset&&s.append("offset",e.offset.toString());let o=`/orders${s.size?`?${s}`:""}`;t.debug("Constructed pathname:",o);let a=await this.#e(o);return t.debug("Received orders browse result:",{meta:a.meta}),a}async orderGet(e){let t=`/orders/${e.id}`,s=await this.#e(t);return s||null}async cartUpsert(e){return await this.#e("/carts","POST",e)}async cartRemoveItem(e){let t=`/carts/${e.cartId}/line-items/${e.variantId}`;return this.#e(t,"DELETE")}async cartGet(e){let t=`/carts/${e.cartId}`;return await this.#e(t)}async collectionGet(e){let t=`/collections/${e.idOrSlug}`;return await this.#e(t)}async collectionBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.group&&t.append("group",e.group);let r=`/collections${t.size?`?${t}`:""}`;return await this.#e(r)}async collectionCreate(e){return this.#e("/collections","POST",e)}async collectionUpdate(e,t){let s=`/collections/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async collectionDelete(e){let t=`/collections/${e.idOrSlug}`;return this.#e(t,"DELETE")}async collectionImportMemberships(e){let t=new FormData;return t.append("file",e.file),this.#a("/collections/import-memberships",t)}async categoryGet(e){let t=`/categories/${e.idOrSlug}`;return await this.#e(t)}async categoriesBrowse(e){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/categories${t.size?`?${t}`:""}`;return await this.#e(r)}async postBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString()),e.tag&&t.append("tag",e.tag),e.categoryId&&t.append("categoryId",e.categoryId);let r=`/posts${t.size?`?${t}`:""}`;return this.#e(r)}async postGet(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t)}async postCreate(e){return this.#e("/posts","POST",e)}async postUpdate(e,t){let s=`/posts/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async postDelete(e){let t=`/posts/${e.idOrSlug}`;return this.#e(t,"DELETE")}async postCommentsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/posts/${e.idOrSlug}/comments${r}`;return this.#e(o)}async postCommentCreate(e,t){let s=`/posts/${e.idOrSlug}/comments`;return this.#e(s,"POST",t)}async blogCategoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.query&&t.append("query",e.query),e.active!==void 0&&t.append("active",e.active.toString());let r=`/blog-categories${t.size?`?${t}`:""}`;return this.#e(r)}async blogCategoryGet(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t)}async blogCategoryCreate(e){return this.#e("/blog-categories","POST",e)}async blogCategoryUpdate(e,t){let s=`/blog-categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async blogCategoryDelete(e){let t=`/blog-categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async customerBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.offset&&t.append("offset",e.offset.toString()),e.search&&t.append("search",e.search);let r=`/customers${t.size?`?${t}`:""}`;return this.#e(r)}async customerGet(e){let t=`/customers/${e.id}`;return this.#e(t)}async customerUpdate(e,t){let s=`/customers/${e.id}`;return this.#e(s,"PATCH",t)}async customerAddressCreate(e,t){let s=`/customers/${e.id}/addresses`;return this.#e(s,"POST",t)}async customerAddressDelete(e){let t=`/customers/${e.customerId}/addresses/${e.addressId}`;await this.#e(t,"DELETE")}async customerOrdersBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/customers/${e.id}/orders${r}`;return this.#e(o)}async inventoryBrowse(e={}){let t=new URLSearchParams;e.limit&&t.append("limit",e.limit.toString()),e.cursor&&t.append("cursor",e.cursor),e.lowStock!==void 0&&t.append("lowStock",e.lowStock.toString());let r=`/inventory${t.size?`?${t}`:""}`;return this.#e(r)}async inventoryAdjust(e,t){let s=`/inventory/${encodeURIComponent(e)}/adjust`;return this.#e(s,"POST",t)}async variantGet(e){let t=`/variants/${e.idOrSku}`;return this.#e(t)}async variantUpdate(e,t){let s=`/variants/${e.idOrSku}`;return this.#e(s,"PATCH",t)}async variantDelete(e){let t=`/variants/${e.idOrSku}`;await this.#e(t,"DELETE")}async variantCreate(e,t){let s=`/products/${e}/variants`;return this.#e(s,"POST",t)}async subscriberCreate(e){return this.#e("/subscribers","POST",e)}async subscriberDelete(e){let t=`/subscribers?email=${encodeURIComponent(e)}`;return this.#e(t,"DELETE")}async contactMessageCreate(e){return this.#e("/contact-messages","POST",e)}async productCreate(e){return this.#e("/products","POST",e)}async productUpdate(e,t){let s=`/products/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async productDelete(e){let t=`/products/${e.idOrSlug}`;return this.#e(t,"DELETE")}async productReviewsBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.offset&&s.append("offset",t.offset.toString());let r=s.size?`?${s}`:"",o=`/products/${e.idOrSlug}/reviews${r}`;return this.#e(o)}async productReviewCreate(e,t){let s=`/products/${e.idOrSlug}/reviews`;return this.#e(s,"POST",t)}async eventBrowse(e={}){let t=this.#t.getLogger("eventBrowse"),s=new URLSearchParams;e.offset!==void 0&&s.append("offset",e.offset.toString()),e.limit!==void 0&&s.append("limit",e.limit.toString());let o=`/events${s.size?`?${s}`:""}`;return t.debug("Browsing events:",o),this.#e(o)}async eventGet(e){let t=`/events/${e.idOrSlug}`;return this.#e(t)}async eventCreate(e){return this.#e("/events","POST",e)}async eventUpdate(e,t){let s=`/events/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async eventAttendeesBrowse(e){let t=`/events/${e.idOrSlug}/attendees`;return this.#e(t)}async ticketsGet(e){let t=this.#t.getLogger("ticketsGet"),s=new URLSearchParams({email:e.email}),r=`/tickets/${encodeURIComponent(e.code)}?${s}`;return t.debug("Fetching ticket bundle:",r),this.#r(r)}async ticketsUpdate(e,t){let s=`/tickets/${encodeURIComponent(e.code)}`;return this.#e(s,"PATCH",t)}async ticketAttendeeGet(e){let t=`/tickets/attendee/${encodeURIComponent(e.token)}`;return this.#r(t)}async categoryCreate(e){return this.#e("/categories","POST",e)}async categoryUpdate(e,t){let s=`/categories/${e.idOrSlug}`;return this.#e(s,"PATCH",t)}async categoryDelete(e){let t=`/categories/${e.idOrSlug}`;return this.#e(t,"DELETE")}async orderUpdate(e,t){let s=`/orders/${e.id}`;return this.#e(s,"PATCH",t)}async legalPageBrowse(){return this.#e("/legal-pages")}async legalPageGet(e){let t=e.startsWith("/")?e.slice(1):e,s=`/legal-pages/${encodeURIComponent(t)}`;return this.#e(s)}async search(e){return this.request("/search",{query:e})}async instaviewImagesBrowse(e,t={}){let s=new URLSearchParams;t.limit&&s.append("limit",t.limit.toString()),t.cursor&&s.append("cursor",t.cursor);let r=s.size?`?${s}`:"",o=`/instaview/accounts/${e.handle}/images${r}`;return this.#e(o)}async request(e,t){let s=t?.query?`?${new URLSearchParams(Object.entries(t.query).map(([r,o])=>[r,String(o)]))}`:"";return this.#e(`${e}${s}`,t?.method??"GET",t?.body)}};function U(u={}){return new d(u)}export{U as Commerce,d as YNSProvider};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/env.ts","../src/logger.ts","../src/providers/yns.ts","../src/commerce.ts"],"sourcesContent":["const YNS_API_KEY = process.env.YNS_API_KEY;\n\nexport const env = {\n\tYNS_API_KEY,\n};\n","import type { InspectOptions } from \"node:util\";\n\ntype LogParms = [message: unknown, ...optionalParams: unknown[]];\n\n/**\n * Vercel only supports 3 levels of logging. We're adding additional DEBUG level.\n * https://vercel.com/docs/observability/runtime-logs#level\n *\n * ERROR - Fatal for a particular request. Should be fixed sooner than later.\n *\n * WARN - A note on something that should probably be looked at eventually.\n *\n * LOG - Detail on regular operation.\n *\n * DEBUG - Debug only info as well as time and timeEnd functions.\n */\nconst LogLevel = {\n\tDEBUG: 0,\n\tLOG: 1,\n\tWARN: 2,\n\tERROR: 3,\n} as const;\ntype LogLevel = keyof typeof LogLevel;\n\nconst strLogLevel = (process.env.NEXT_PUBLIC_LOG_LEVEL || \"LOG\") as LogLevel;\nconst valueLogLevel = LogLevel[strLogLevel];\n\nconst RESET = \"\\x1b[0m\";\nconst BLUE = \"\\x1b[34m\";\nconst GREEN = \"\\x1b[32m\";\nconst YELLOW = \"\\x1b[33m\";\nconst RED = \"\\x1b[31m\";\n\nconst TIME = `⏱️`;\nconst DEBUG = `🐛`;\nconst OK = `✔️`;\nconst WARN = `⚠️`;\nconst ERROR = `❌`;\n\nconst PREFIX_TIME = `${TIME} `;\nconst PREFIX_DEBUG = `${BLUE}${DEBUG}${RESET} `;\nconst PREFIX_OK = `${GREEN}${OK}${RESET} `;\nconst PREFIX_WARN = `${YELLOW}${WARN}${RESET} `;\nconst PREFIX_ERROR = `${RED}${ERROR}${RESET} `;\n\nexport const getLogger = (groupLabel?: string) => {\n\tconst PREFIX = groupLabel ? `[${groupLabel}] ` : \"\";\n\treturn {\n\t\tgetLogger(subGroupLabel: string) {\n\t\t\treturn getLogger([groupLabel, subGroupLabel].filter(Boolean).join(\" > \"));\n\t\t},\n\t\ttime(label: string) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.time([PREFIX_TIME, PREFIX, label].filter(Boolean).join(\" \"));\n\t\t},\n\t\ttimeEnd(label: string) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.timeEnd([PREFIX_TIME, PREFIX, label].filter(Boolean).join(\" \"));\n\t\t},\n\t\tdebug(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.log(...[PREFIX_DEBUG, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\tlog(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.LOG) return;\n\t\t\tconsole.log(...[PREFIX_OK, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\tdir(item?: unknown, options?: InspectOptions) {\n\t\t\tif (valueLogLevel > LogLevel.LOG) return;\n\t\t\tconsole.dir(item, options);\n\t\t},\n\t\twarn(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.WARN) return;\n\t\t\tconsole.warn(...[PREFIX_WARN, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\terror(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.ERROR) return;\n\t\t\tconsole.error(...[PREFIX_ERROR, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t};\n};\n\nexport const logger = getLogger();\n","import type {\n\tAPIBlogCategoriesBrowseQueryParams,\n\tAPIBlogCategoriesBrowseResult,\n\tAPIBlogCategoryCreateBody,\n\tAPIBlogCategoryCreateResult,\n\tAPIBlogCategoryDeleteResult,\n\tAPIBlogCategoryGetByIdParams,\n\tAPIBlogCategoryGetByIdResult,\n\tAPIBlogCategoryUpdateBody,\n\tAPIBlogCategoryUpdateResult,\n\tAPIBrandAssignProductsBody,\n\tAPIBrandAssignProductsResult,\n\tAPIBrandCreateBody,\n\tAPIBrandCreateResult,\n\tAPIBrandDeleteResult,\n\tAPIBrandGetByIdParams,\n\tAPIBrandGetByIdResult,\n\tAPIBrandsBrowseQueryParams,\n\tAPIBrandsBrowseResult,\n\tAPIBrandUpdateBody,\n\tAPIBrandUpdateResult,\n\tAPICartCreateBody,\n\tAPICartCreateResult,\n\tAPICartDeleteResult,\n\tAPICartGetResult,\n\tAPICategoriesBrowseQueryParams,\n\tAPICategoriesBrowseResult,\n\tAPICategoryCreateBody,\n\tAPICategoryCreateResult,\n\tAPICategoryDeleteResult,\n\tAPICategoryGetByIdParams,\n\tAPICategoryGetByIdResult,\n\tAPICategoryUpdateBody,\n\tAPICategoryUpdateResult,\n\tAPICollectionCreateBody,\n\tAPICollectionCreateResult,\n\tAPICollectionDeleteResult,\n\tAPICollectionGetByIdParams,\n\tAPICollectionGetByIdResult,\n\tAPICollectionsBrowseQueryParams,\n\tAPICollectionsBrowseResult,\n\tAPICollectionUpdateBody,\n\tAPICollectionUpdateResult,\n\tAPIContactMessageCreateBody,\n\tAPIContactMessageCreateResult,\n\tAPICustomerAddressCreateBody,\n\tAPICustomerAddressCreateResult,\n\tAPICustomerGetByIdParams,\n\tAPICustomerGetByIdResult,\n\tAPICustomerOrdersBrowseQueryParams,\n\tAPICustomerOrdersBrowseResult,\n\tAPICustomersBrowseQueryParams,\n\tAPICustomersBrowseResult,\n\tAPICustomerUpdateBody,\n\tAPICustomerUpdateResult,\n\tAPIEventAttendeesBrowseResult,\n\tAPIEventCreateBody,\n\tAPIEventCreateResult,\n\tAPIEventGetByIdParams,\n\tAPIEventGetByIdResult,\n\tAPIEventsBrowseQueryParams,\n\tAPIEventsBrowseResult,\n\tAPIEventUpdateBody,\n\tAPIEventUpdateResult,\n\tAPIInstaviewImagesBrowseParams,\n\tAPIInstaviewImagesBrowseQueryParams,\n\tAPIInstaviewImagesBrowseResult,\n\tAPIInventoryAdjustBody,\n\tAPIInventoryAdjustResult,\n\tAPIInventoryBrowseQueryParams,\n\tAPIInventoryBrowseResult,\n\tAPILegalPageGetByPathResult,\n\tAPILegalPagesBrowseResult,\n\tAPIMeGetResult,\n\tAPIOrderGetByIdParams,\n\tAPIOrderGetByIdResult,\n\tAPIOrderRefundGetParams,\n\tAPIOrderRefundGetResult,\n\tAPIOrderRefundsBrowseQueryParams,\n\tAPIOrderRefundsBrowseResult,\n\tAPIOrderRefundsParams,\n\tAPIOrdersBrowseQueryParams,\n\tAPIOrdersBrowseResult,\n\tAPIOrderUpdateBody,\n\tAPIOrderUpdateResult,\n\tAPIPostCommentCreateBody,\n\tAPIPostCommentCreateResult,\n\tAPIPostCommentsBrowseQueryParams,\n\tAPIPostCommentsBrowseResult,\n\tAPIPostCreateBody,\n\tAPIPostCreateResult,\n\tAPIPostDeleteResult,\n\tAPIPostGetByIdParams,\n\tAPIPostGetByIdResult,\n\tAPIPostsBrowseQueryParams,\n\tAPIPostsBrowseResult,\n\tAPIPostUpdateBody,\n\tAPIPostUpdateResult,\n\tAPIProductBatchBody,\n\tAPIProductBatchResult,\n\tAPIProductCreateBody,\n\tAPIProductCreateResult,\n\tAPIProductDeleteResult,\n\tAPIProductFiltersResult,\n\tAPIProductGetByIdParams,\n\tAPIProductGetByIdResult,\n\tAPIProductReviewCreateBody,\n\tAPIProductReviewCreateResult,\n\tAPIProductReviewsBrowseQueryParams,\n\tAPIProductReviewsBrowseResult,\n\tAPIProductsBrowseQueryParams,\n\tAPIProductsBrowseResult,\n\tAPIProductUpdateBody,\n\tAPIProductUpdateResult,\n\tAPISearchQueryParams,\n\tAPISearchResult,\n\tAPISocialsGetResult,\n\tAPISubscriberCreateBody,\n\tAPISubscriberCreateResult,\n\tAPISubscriberDeleteResult,\n\tAPIVariantCreateBody,\n\tAPIVariantCreateResult,\n\tAPIVariantGetByIdParams,\n\tAPIVariantGetByIdResult,\n\tAPIVariantUpdateBody,\n\tAPIVariantUpdateResult,\n} from \"../api-types\";\nimport { env } from \"../env\";\nimport { getLogger } from \"../logger\";\nimport type { CommerceConfig } from \"../types\";\n\nexport type APICollectionImportMembershipsBody = { file: File | Blob };\n\nexport type APICollectionImportMembershipsResult = {\n\tok: true;\n\tprocessed: number;\n\tinserted: number;\n\tskipped_existing: number;\n\terrors: Array<{\n\t\trow: number;\n\t\tcollection_slug?: string;\n\t\tproduct_slug?: string;\n\t\treason: string;\n\t}>;\n};\n\nexport class YNSProvider {\n\t#config: CommerceConfig;\n\t#logger = getLogger(\"YNSProvider\");\n\n\tconstructor(config: CommerceConfig = {}) {\n\t\tconst token = config.token ?? env.YNS_API_KEY;\n\t\tconst isStaging = env.YNS_API_KEY?.startsWith(\"sk-s-\");\n\n\t\tif (!token) {\n\t\t\tthrow new Error(\n\t\t\t\t\"YNS API key is required. Set YNS_API_KEY environment variable or pass token in config.\",\n\t\t\t);\n\t\t}\n\t\tconst endpoint = config.endpoint ?? (isStaging ? \"https://yns.cx\" : \"https://yns.store\");\n\n\t\tthis.#config = { version: \"v1\", ...config, token, endpoint };\n\n\t\tthis.#logger.debug(\"YNSProvider initialized\", {\n\t\t\tendpoint,\n\t\t\ttoken: config.token ? `from config` : \"from env\",\n\t\t});\n\t}\n\n\tasync #restRequest<T>(\n\t\tpathname: `/${string}`,\n\t\tmethod: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" = \"GET\",\n\t\tbody?: unknown,\n\t): Promise<T> {\n\t\tconst logger = this.#logger.getLogger(\"#restRequest\");\n\n\t\tconst endpoint = `${this.#config.endpoint}/api/${this.#config.version}${pathname}`;\n\t\tlogger.debug(`Making ${method} request to YNS API: ${endpoint}`);\n\t\tconst response = await fetch(endpoint, {\n\t\t\tmethod,\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\tAuthorization: `Bearer ${this.#config.token}`,\n\t\t\t},\n\t\t\tbody: body ? JSON.stringify(body) : undefined,\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\t// Handle different error types\n\t\t\tconst contentType = response.headers.get(\"content-type\");\n\t\t\tlet errorMessage = `YNS REST request failed: ${method} ${endpoint} ${response.status} ${response.statusText}`;\n\n\t\t\tif (contentType?.includes(\"application/json\")) {\n\t\t\t\ttry {\n\t\t\t\t\tconst errorData = await response.json();\n\t\t\t\t\terrorMessage = errorData.error || errorData.message || errorMessage;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(\"Failed to parse YNS error response as JSON\", error);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst errorText = await response.text();\n\t\t\t\tlogger.error(\n\t\t\t\t\t`YNS API request failed: ${response.status} ${response.statusText}`,\n\t\t\t\t\terrorMessage,\n\t\t\t\t\terrorText,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\n\t\t// Check if response is JSON before parsing\n\t\tconst contentType = response.headers.get(\"content-type\");\n\t\tif (!contentType?.includes(\"application/json\")) {\n\t\t\tthrow new Error(`YNS API returned ${contentType} instead of JSON for ${pathname}`);\n\t\t}\n\n\t\treturn response.json();\n\t}\n\n\tasync #multipartRequest<T>(pathname: `/${string}`, formData: FormData): Promise<T> {\n\t\tconst logger = this.#logger.getLogger(\"#multipartRequest\");\n\n\t\tconst endpoint = `${this.#config.endpoint}/api/${this.#config.version}${pathname}`;\n\t\tlogger.debug(`Making multipart POST to YNS API: ${endpoint}`);\n\t\tconst response = await fetch(endpoint, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${this.#config.token}`,\n\t\t\t},\n\t\t\tbody: formData,\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tconst contentType = response.headers.get(\"content-type\");\n\t\t\tlet errorMessage = `YNS REST request failed: POST ${endpoint} ${response.status} ${response.statusText}`;\n\n\t\t\tif (contentType?.includes(\"application/json\")) {\n\t\t\t\ttry {\n\t\t\t\t\tconst errorData = await response.json();\n\t\t\t\t\terrorMessage = errorData.error || errorData.message || errorMessage;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(\"Failed to parse YNS error response as JSON\", error);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst errorText = await response.text();\n\t\t\t\tlogger.error(\n\t\t\t\t\t`YNS API request failed: ${response.status} ${response.statusText}`,\n\t\t\t\t\terrorMessage,\n\t\t\t\t\terrorText,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\n\t\tconst contentType = response.headers.get(\"content-type\");\n\t\tif (!contentType?.includes(\"application/json\")) {\n\t\t\tthrow new Error(`YNS API returned ${contentType} instead of JSON for ${pathname}`);\n\t\t}\n\n\t\treturn response.json();\n\t}\n\n\tasync meGet(): Promise<APIMeGetResult> {\n\t\tconst logger = this.#logger.getLogger(\"meGet\");\n\t\tlogger.debug(\"Fetching my information\");\n\n\t\tconst pathname = `/me` as const;\n\t\tconst result = await this.#restRequest<APIMeGetResult>(pathname);\n\t\tlogger.debug(\"Received my information:\", result);\n\t\treturn result;\n\t}\n\n\tasync socialsGet(): Promise<APISocialsGetResult> {\n\t\tconst logger = this.#logger.getLogger(\"socialsGet\");\n\t\tlogger.debug(\"Fetching store social links\");\n\n\t\tconst pathname = `/socials` as const;\n\t\tconst result = await this.#restRequest<APISocialsGetResult>(pathname);\n\t\tlogger.debug(\"Received store social links:\", result);\n\t\treturn result;\n\t}\n\n\t// Brands ---------------------------------------------------------------\n\n\tasync brandBrowse(params: APIBrandsBrowseQueryParams = {}): Promise<APIBrandsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.lang) queryParams.append(\"lang\", params.lang);\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/brands${searchParams}` as const;\n\t\treturn this.#restRequest<APIBrandsBrowseResult>(pathname);\n\t}\n\n\tasync brandGet(params: APIBrandGetByIdParams): Promise<APIBrandGetByIdResult | null> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandGetByIdResult>(pathname);\n\t}\n\n\tasync brandCreate(body: APIBrandCreateBody): Promise<APIBrandCreateResult> {\n\t\treturn this.#restRequest<APIBrandCreateResult>(\"/brands\", \"POST\", body);\n\t}\n\n\tasync brandUpdate(params: APIBrandGetByIdParams, body: APIBrandUpdateBody): Promise<APIBrandUpdateResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync brandDelete(params: APIBrandGetByIdParams): Promise<APIBrandDeleteResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync brandAssignProducts(\n\t\tparams: APIBrandGetByIdParams,\n\t\tbody: APIBrandAssignProductsBody,\n\t): Promise<APIBrandAssignProductsResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}/products` as const;\n\t\treturn this.#restRequest<APIBrandAssignProductsResult>(pathname, \"POST\", body);\n\t}\n\n\t// Order refunds --------------------------------------------------------\n\n\tasync orderRefundsBrowse(\n\t\tparams: APIOrderRefundsParams & APIOrderRefundsBrowseQueryParams,\n\t): Promise<APIOrderRefundsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/orders/${params.id}/refunds${searchParams}` as const;\n\t\treturn this.#restRequest<APIOrderRefundsBrowseResult>(pathname);\n\t}\n\n\tasync orderRefundGet(params: APIOrderRefundGetParams): Promise<APIOrderRefundGetResult | null> {\n\t\tconst pathname = `/orders/${params.id}/refunds/${params.refundId}` as const;\n\t\treturn this.#restRequest<APIOrderRefundGetResult>(pathname);\n\t}\n\n\t// Product bulk ---------------------------------------------------------\n\n\tasync productBatch(body: APIProductBatchBody): Promise<APIProductBatchResult> {\n\t\treturn this.#restRequest<APIProductBatchResult>(\"/products/batch\", \"POST\", body);\n\t}\n\n\t// Cart -----------------------------------------------------------------\n\n\tasync cartDelete(params: { cartId: string }): Promise<APICartDeleteResult> {\n\t\tconst pathname = `/carts/${params.cartId}` as const;\n\t\treturn this.#restRequest<APICartDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync productBrowse(params: APIProductsBrowseQueryParams): Promise<APIProductsBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"productBrowse\");\n\t\tlogger.debug(\"Browsing products with params:\", params);\n\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.category) queryParams.append(\"category\", params.category);\n\t\tif (params.collection) queryParams.append(\"collection\", params.collection);\n\t\tif (params.brand) queryParams.append(\"brand\", params.brand);\n\t\tif (params.priceMin !== undefined) queryParams.append(\"priceMin\", params.priceMin.toString());\n\t\tif (params.priceMax !== undefined) queryParams.append(\"priceMax\", params.priceMax.toString());\n\t\tif (params.vts) queryParams.append(\"vts\", params.vts);\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.orderBy) queryParams.append(\"orderBy\", params.orderBy);\n\t\tif (params.orderDirection) queryParams.append(\"orderDirection\", params.orderDirection);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/products${searchParams}` as const;\n\t\tlogger.debug(\"Constructed pathname:\", pathname);\n\t\tconst result = await this.#restRequest<APIProductsBrowseResult>(pathname);\n\t\tlogger.debug(\"Received product browse result:\", { meta: result.meta });\n\t\treturn result;\n\t}\n\n\t/**\n\t * Available storefront filter facets for the store: price bounds, variant\n\t * types/values, and active categories, collections, and brands. Pair with\n\t * `productBrowse`'s `collection`, `brand`, `priceMin`/`priceMax`, and `vts`\n\t * params to build a filter UI.\n\t */\n\tasync productFilters(): Promise<APIProductFiltersResult> {\n\t\tconst result = await this.#restRequest<APIProductFiltersResult>(\"/products/filters\");\n\t\treturn result;\n\t}\n\n\tasync productGet(params: APIProductGetByIdParams): Promise<APIProductGetByIdResult | null> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APIProductGetByIdResult>(pathname);\n\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tasync orderBrowse(params: APIOrdersBrowseQueryParams): Promise<APIOrdersBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"orderBrowse\");\n\t\tlogger.debug(\"Browsing orders with params:\", params);\n\n\t\tconst queryParams = new URLSearchParams();\n\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/orders${searchParams}` as const;\n\t\tlogger.debug(\"Constructed pathname:\", pathname);\n\t\tconst result = await this.#restRequest<APIOrdersBrowseResult>(pathname);\n\t\tlogger.debug(\"Received orders browse result:\", { meta: result.meta });\n\t\treturn result;\n\t}\n\n\tasync orderGet(params: APIOrderGetByIdParams): Promise<APIOrderGetByIdResult | null> {\n\t\tconst pathname = `/orders/${params.id}` as const;\n\n\t\tconst result = await this.#restRequest<APIOrderGetByIdResult>(pathname);\n\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// @todo\n\t// async cartAdd(params: APICartAddBody): Promise<APICartAddResult> {\n\t// \tconst body = {\n\t// \t\tvariantId: params.variantId,\n\t// \t\tcartId: params.cartId,\n\t// \t\tquantity: params.quantity,\n\t// \t\tsubscriptionId: params.subscriptionId,\n\t// \t};\n\n\t// \tconst result = await this.#restRequest<APICartCreateResult>(\"/carts\", \"PATCH\", body);\n\t// \treturn result;\n\t// }\n\n\tasync cartUpsert(body: APICartCreateBody): Promise<APICartCreateResult> {\n\t\tconst result = await this.#restRequest<APICartCreateResult>(\"/carts\", \"POST\", body);\n\t\treturn result;\n\t}\n\n\tasync cartRemoveItem(params: { cartId: string; variantId: string }): Promise<APICartGetResult> {\n\t\tconst pathname = `/carts/${params.cartId}/line-items/${params.variantId}` as const;\n\t\treturn this.#restRequest<APICartGetResult>(pathname, \"DELETE\");\n\t}\n\n\tasync cartGet(params: { cartId: string }): Promise<APICartGetResult | null> {\n\t\tconst pathname = `/carts/${params.cartId}` as const;\n\t\tconst result = await this.#restRequest<APICartGetResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync collectionGet(params: APICollectionGetByIdParams): Promise<APICollectionGetByIdResult | null> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APICollectionGetByIdResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync collectionBrowse(params: APICollectionsBrowseQueryParams): Promise<APICollectionsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/collections${searchParams}` as const;\n\n\t\tconst result = await this.#restRequest<APICollectionsBrowseResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync collectionCreate(body: APICollectionCreateBody): Promise<APICollectionCreateResult> {\n\t\treturn this.#restRequest<APICollectionCreateResult>(\"/collections\", \"POST\", body);\n\t}\n\n\tasync collectionUpdate(\n\t\tparams: APICollectionGetByIdParams,\n\t\tbody: APICollectionUpdateBody,\n\t): Promise<APICollectionUpdateResult> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICollectionUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync collectionDelete(params: APICollectionGetByIdParams): Promise<APICollectionDeleteResult> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICollectionDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync collectionImportMemberships(\n\t\tbody: APICollectionImportMembershipsBody,\n\t): Promise<APICollectionImportMembershipsResult> {\n\t\tconst formData = new FormData();\n\t\tformData.append(\"file\", body.file);\n\t\treturn this.#multipartRequest<APICollectionImportMembershipsResult>(\n\t\t\t\"/collections/import-memberships\",\n\t\t\tformData,\n\t\t);\n\t}\n\n\tasync categoryGet(params: APICategoryGetByIdParams): Promise<APICategoryGetByIdResult | null> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APICategoryGetByIdResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync categoriesBrowse(params: APICategoriesBrowseQueryParams): Promise<APICategoriesBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/categories${searchParams}` as const;\n\n\t\tconst result = await this.#restRequest<APICategoriesBrowseResult>(pathname);\n\t\treturn result;\n\t}\n\n\t// ============================================\n\t// Posts\n\t// ============================================\n\n\tasync postBrowse(params: APIPostsBrowseQueryParams = {}): Promise<APIPostsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.tag) queryParams.append(\"tag\", params.tag);\n\t\tif (params.categoryId) queryParams.append(\"categoryId\", params.categoryId);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/posts${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIPostsBrowseResult>(pathname);\n\t}\n\n\tasync postGet(params: APIPostGetByIdParams): Promise<APIPostGetByIdResult | null> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostGetByIdResult>(pathname);\n\t}\n\n\tasync postCreate(body: APIPostCreateBody): Promise<APIPostCreateResult> {\n\t\treturn this.#restRequest<APIPostCreateResult>(\"/posts\", \"POST\", body);\n\t}\n\n\tasync postUpdate(params: APIPostGetByIdParams, body: APIPostUpdateBody): Promise<APIPostUpdateResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync postDelete(params: APIPostGetByIdParams): Promise<APIPostDeleteResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync postCommentsBrowse(\n\t\tparams: APIPostGetByIdParams,\n\t\tqueryParams: APIPostCommentsBrowseQueryParams = {},\n\t): Promise<APIPostCommentsBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/posts/${params.idOrSlug}/comments${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIPostCommentsBrowseResult>(pathname);\n\t}\n\n\tasync postCommentCreate(\n\t\tparams: APIPostGetByIdParams,\n\t\tbody: APIPostCommentCreateBody,\n\t): Promise<APIPostCommentCreateResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}/comments` as const;\n\t\treturn this.#restRequest<APIPostCommentCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Blog Categories\n\t// ============================================\n\n\tasync blogCategoryBrowse(\n\t\tparams: APIBlogCategoriesBrowseQueryParams = {},\n\t): Promise<APIBlogCategoriesBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/blog-categories${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIBlogCategoriesBrowseResult>(pathname);\n\t}\n\n\tasync blogCategoryGet(params: APIBlogCategoryGetByIdParams): Promise<APIBlogCategoryGetByIdResult | null> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryGetByIdResult>(pathname);\n\t}\n\n\tasync blogCategoryCreate(body: APIBlogCategoryCreateBody): Promise<APIBlogCategoryCreateResult> {\n\t\treturn this.#restRequest<APIBlogCategoryCreateResult>(\"/blog-categories\", \"POST\", body);\n\t}\n\n\tasync blogCategoryUpdate(\n\t\tparams: APIBlogCategoryGetByIdParams,\n\t\tbody: APIBlogCategoryUpdateBody,\n\t): Promise<APIBlogCategoryUpdateResult> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync blogCategoryDelete(params: APIBlogCategoryGetByIdParams): Promise<APIBlogCategoryDeleteResult> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Customers\n\t// ============================================\n\n\tasync customerBrowse(params: APICustomersBrowseQueryParams = {}): Promise<APICustomersBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.search) queryParams.append(\"search\", params.search);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/customers${searchParams}` as const;\n\n\t\treturn this.#restRequest<APICustomersBrowseResult>(pathname);\n\t}\n\n\tasync customerGet(params: APICustomerGetByIdParams): Promise<APICustomerGetByIdResult | null> {\n\t\tconst pathname = `/customers/${params.id}` as const;\n\t\treturn this.#restRequest<APICustomerGetByIdResult>(pathname);\n\t}\n\n\tasync customerUpdate(\n\t\tparams: APICustomerGetByIdParams,\n\t\tbody: APICustomerUpdateBody,\n\t): Promise<APICustomerUpdateResult> {\n\t\tconst pathname = `/customers/${params.id}` as const;\n\t\treturn this.#restRequest<APICustomerUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync customerAddressCreate(\n\t\tparams: APICustomerGetByIdParams,\n\t\tbody: APICustomerAddressCreateBody,\n\t): Promise<APICustomerAddressCreateResult> {\n\t\tconst pathname = `/customers/${params.id}/addresses` as const;\n\t\treturn this.#restRequest<APICustomerAddressCreateResult>(pathname, \"POST\", body);\n\t}\n\n\tasync customerAddressDelete(params: { customerId: string; addressId: string }): Promise<void> {\n\t\tconst pathname = `/customers/${params.customerId}/addresses/${params.addressId}` as const;\n\t\tawait this.#restRequest<unknown>(pathname, \"DELETE\");\n\t}\n\n\tasync customerOrdersBrowse(\n\t\tparams: APICustomerGetByIdParams,\n\t\tqueryParams: APICustomerOrdersBrowseQueryParams = {},\n\t): Promise<APICustomerOrdersBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/customers/${params.id}/orders${searchParams}` as const;\n\n\t\treturn this.#restRequest<APICustomerOrdersBrowseResult>(pathname);\n\t}\n\n\t// ============================================\n\t// Inventory\n\t// ============================================\n\n\tasync inventoryBrowse(params: APIInventoryBrowseQueryParams = {}): Promise<APIInventoryBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.cursor) queryParams.append(\"cursor\", params.cursor);\n\t\tif (params.lowStock !== undefined) queryParams.append(\"lowStock\", params.lowStock.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/inventory${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIInventoryBrowseResult>(pathname);\n\t}\n\n\tasync inventoryAdjust(sku: string, body: APIInventoryAdjustBody): Promise<APIInventoryAdjustResult> {\n\t\tconst pathname = `/inventory/${encodeURIComponent(sku)}/adjust` as const;\n\t\treturn this.#restRequest<APIInventoryAdjustResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Variants\n\t// ============================================\n\n\tasync variantGet(params: APIVariantGetByIdParams): Promise<APIVariantGetByIdResult | null> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\treturn this.#restRequest<APIVariantGetByIdResult>(pathname);\n\t}\n\n\tasync variantUpdate(\n\t\tparams: APIVariantGetByIdParams,\n\t\tbody: APIVariantUpdateBody,\n\t): Promise<APIVariantUpdateResult> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\treturn this.#restRequest<APIVariantUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync variantDelete(params: APIVariantGetByIdParams): Promise<void> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\tawait this.#restRequest<unknown>(pathname, \"DELETE\");\n\t}\n\n\tasync variantCreate(productId: string, body: APIVariantCreateBody): Promise<APIVariantCreateResult> {\n\t\tconst pathname = `/products/${productId}/variants` as const;\n\t\treturn this.#restRequest<APIVariantCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Subscribers\n\t// ============================================\n\n\tasync subscriberCreate(body: APISubscriberCreateBody): Promise<APISubscriberCreateResult> {\n\t\treturn this.#restRequest<APISubscriberCreateResult>(\"/subscribers\", \"POST\", body);\n\t}\n\n\tasync subscriberDelete(email: string): Promise<APISubscriberDeleteResult> {\n\t\tconst pathname = `/subscribers?email=${encodeURIComponent(email)}` as const;\n\t\treturn this.#restRequest<APISubscriberDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Contact Messages\n\t// ============================================\n\n\tasync contactMessageCreate(body: APIContactMessageCreateBody): Promise<APIContactMessageCreateResult> {\n\t\treturn this.#restRequest<APIContactMessageCreateResult>(\"/contact-messages\", \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Product mutations\n\t// ============================================\n\n\tasync productCreate(body: APIProductCreateBody): Promise<APIProductCreateResult> {\n\t\treturn this.#restRequest<APIProductCreateResult>(\"/products\", \"POST\", body);\n\t}\n\n\tasync productUpdate(\n\t\tparams: APIProductGetByIdParams,\n\t\tbody: APIProductUpdateBody,\n\t): Promise<APIProductUpdateResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIProductUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync productDelete(params: APIProductGetByIdParams): Promise<APIProductDeleteResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIProductDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Product Reviews\n\t// ============================================\n\n\tasync productReviewsBrowse(\n\t\tparams: APIProductGetByIdParams,\n\t\tqueryParams: APIProductReviewsBrowseQueryParams = {},\n\t): Promise<APIProductReviewsBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/products/${params.idOrSlug}/reviews${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIProductReviewsBrowseResult>(pathname);\n\t}\n\n\tasync productReviewCreate(\n\t\tparams: APIProductGetByIdParams,\n\t\tbody: APIProductReviewCreateBody,\n\t): Promise<APIProductReviewCreateResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}/reviews` as const;\n\t\treturn this.#restRequest<APIProductReviewCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Events (products flagged `flags.event` with a single non-shippable ticket variant)\n\t// ============================================\n\n\tasync eventBrowse(params: APIEventsBrowseQueryParams = {}): Promise<APIEventsBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"eventBrowse\");\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.offset !== undefined) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.limit !== undefined) queryParams.append(\"limit\", params.limit.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/events${searchParams}` as const;\n\t\tlogger.debug(\"Browsing events:\", pathname);\n\t\treturn this.#restRequest<APIEventsBrowseResult>(pathname);\n\t}\n\n\tasync eventGet(params: APIEventGetByIdParams): Promise<APIEventGetByIdResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIEventGetByIdResult>(pathname);\n\t}\n\n\tasync eventCreate(body: APIEventCreateBody): Promise<APIEventCreateResult> {\n\t\treturn this.#restRequest<APIEventCreateResult>(\"/events\", \"POST\", body);\n\t}\n\n\tasync eventUpdate(params: APIEventGetByIdParams, body: APIEventUpdateBody): Promise<APIEventUpdateResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIEventUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync eventAttendeesBrowse(params: APIEventGetByIdParams): Promise<APIEventAttendeesBrowseResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}/attendees` as const;\n\t\treturn this.#restRequest<APIEventAttendeesBrowseResult>(pathname);\n\t}\n\n\t// ============================================\n\t// Category mutations\n\t// ============================================\n\n\tasync categoryCreate(body: APICategoryCreateBody): Promise<APICategoryCreateResult> {\n\t\treturn this.#restRequest<APICategoryCreateResult>(\"/categories\", \"POST\", body);\n\t}\n\n\tasync categoryUpdate(\n\t\tparams: APICategoryGetByIdParams,\n\t\tbody: APICategoryUpdateBody,\n\t): Promise<APICategoryUpdateResult> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICategoryUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync categoryDelete(params: APICategoryGetByIdParams): Promise<APICategoryDeleteResult> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICategoryDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Order mutations\n\t// ============================================\n\n\tasync orderUpdate(params: APIOrderGetByIdParams, body: APIOrderUpdateBody): Promise<APIOrderUpdateResult> {\n\t\tconst pathname = `/orders/${params.id}` as const;\n\t\treturn this.#restRequest<APIOrderUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\t// ============================================\n\t// Legal Pages\n\t// ============================================\n\n\tasync legalPageBrowse(): Promise<APILegalPagesBrowseResult> {\n\t\treturn this.#restRequest<APILegalPagesBrowseResult>(\"/legal-pages\");\n\t}\n\n\tasync legalPageGet(path: string): Promise<APILegalPageGetByPathResult> {\n\t\tconst normalized = path.startsWith(\"/\") ? path.slice(1) : path;\n\t\tconst pathname = `/legal-pages/${encodeURIComponent(normalized)}` as const;\n\t\treturn this.#restRequest<APILegalPageGetByPathResult>(pathname);\n\t}\n\n\tasync search(params: APISearchQueryParams): Promise<APISearchResult> {\n\t\treturn this.request<APISearchResult>(\"/search\", {\n\t\t\tquery: params,\n\t\t});\n\t}\n\n\t// ============================================\n\t// Instaview\n\t// ============================================\n\n\tasync instaviewImagesBrowse(\n\t\tparams: APIInstaviewImagesBrowseParams,\n\t\tqueryParams: APIInstaviewImagesBrowseQueryParams = {},\n\t): Promise<APIInstaviewImagesBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.cursor) urlParams.append(\"cursor\", queryParams.cursor);\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/instaview/accounts/${params.handle}/images${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIInstaviewImagesBrowseResult>(pathname);\n\t}\n\n\t/**\n\t * Make a raw API request to any endpoint.\n\t * Use this for new API features not yet supported by typed methods.\n\t *\n\t * @example\n\t * // GET request (default method)\n\t * const webhooks = await provider.request<Webhook[]>('/webhooks');\n\t *\n\t * // POST with typed body\n\t * const webhook = await provider.request<Webhook, CreateWebhookBody>('/webhooks', {\n\t * method: 'POST',\n\t * body: { url: 'https://...' }\n\t * });\n\t *\n\t * // GET with query parameters\n\t * const products = await provider.request<Product[]>('/products', {\n\t * query: { limit: 10, category: 'shoes' }\n\t * });\n\t *\n\t * // Path parameters via template literals\n\t * const product = await provider.request<Product>(`/products/${id}`);\n\t */\n\tasync request<TResponse = unknown, TBody = unknown>(\n\t\tpathname: `/${string}`,\n\t\toptions?: {\n\t\t\tmethod?: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\";\n\t\t\tbody?: TBody;\n\t\t\tquery?: Record<string, string | number | boolean>;\n\t\t},\n\t) {\n\t\tconst queryString = options?.query\n\t\t\t? `?${new URLSearchParams(Object.entries(options.query).map(([k, v]) => [k, String(v)]))}`\n\t\t\t: \"\";\n\n\t\treturn this.#restRequest<TResponse>(`${pathname}${queryString}`, options?.method ?? \"GET\", options?.body);\n\t}\n}\n","import { YNSProvider } from \"./providers/yns\";\nimport type { CommerceConfig } from \"./types\";\n\nexport function Commerce(config: CommerceConfig = {}): YNSProvider {\n\treturn new YNSProvider(config);\n}\n"],"mappings":"4BAAA,IAAMA,EAAc,QAAQ,IAAI,YAEnBC,EAAM,CAClB,YAAAD,CACD,ECYA,IAAME,EAAW,CAChB,MAAO,EACP,IAAK,EACL,KAAM,EACN,MAAO,CACR,EAGMC,EAAe,QAAQ,IAAI,uBAAyB,MACpDC,EAAgBF,EAASC,CAAW,EAEpCE,EAAQ,UACRC,EAAO,WACPC,EAAQ,WACRC,EAAS,WACTC,EAAM,WAENC,EAAO,eACPC,EAAQ,YACRC,EAAK,eACLC,EAAO,eACPC,EAAQ,SAERC,EAAc,GAAGL,CAAI,IACrBM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C,CAAC,CAAC,CAAC,CAAC,GACtF,GAEH,OAAO,KAAK1B,GAAwB,GAAGC,CAAQ,GAAGuB,CAAW,GAAID,GAAS,QAAU,MAAOA,GAAS,IAAI,CACzG,CACD,EC96BO,SAASI,EAASC,EAAyB,CAAC,EAAgB,CAClE,OAAO,IAAIC,EAAYD,CAAM,CAC9B","names":["YNS_API_KEY","env","LogLevel","strLogLevel","valueLogLevel","RESET","BLUE","GREEN","YELLOW","RED","TIME","DEBUG","OK","WARN","ERROR","PREFIX_TIME","PREFIX_DEBUG","PREFIX_OK","PREFIX_WARN","PREFIX_ERROR","getLogger","groupLabel","PREFIX","subGroupLabel","label","args","item","options","logger","YNSProvider","#config","#logger","getLogger","config","token","env","isStaging","endpoint","#restRequest","pathname","method","body","logger","response","contentType","errorMessage","errorData","error","errorText","#multipartRequest","formData","result","params","queryParams","searchParams","urlParams","sku","productId","email","path","normalized","options","queryString","k","v","Commerce","config","YNSProvider"]}
|
|
1
|
+
{"version":3,"sources":["../src/env.ts","../src/logger.ts","../src/providers/yns.ts","../src/commerce.ts"],"sourcesContent":["const YNS_API_KEY = process.env.YNS_API_KEY;\n\nexport const env = {\n\tYNS_API_KEY,\n};\n","import type { InspectOptions } from \"node:util\";\n\ntype LogParms = [message: unknown, ...optionalParams: unknown[]];\n\n/**\n * Vercel only supports 3 levels of logging. We're adding additional DEBUG level.\n * https://vercel.com/docs/observability/runtime-logs#level\n *\n * ERROR - Fatal for a particular request. Should be fixed sooner than later.\n *\n * WARN - A note on something that should probably be looked at eventually.\n *\n * LOG - Detail on regular operation.\n *\n * DEBUG - Debug only info as well as time and timeEnd functions.\n */\nconst LogLevel = {\n\tDEBUG: 0,\n\tLOG: 1,\n\tWARN: 2,\n\tERROR: 3,\n} as const;\ntype LogLevel = keyof typeof LogLevel;\n\nconst strLogLevel = (process.env.NEXT_PUBLIC_LOG_LEVEL || \"LOG\") as LogLevel;\nconst valueLogLevel = LogLevel[strLogLevel];\n\nconst RESET = \"\\x1b[0m\";\nconst BLUE = \"\\x1b[34m\";\nconst GREEN = \"\\x1b[32m\";\nconst YELLOW = \"\\x1b[33m\";\nconst RED = \"\\x1b[31m\";\n\nconst TIME = `⏱️`;\nconst DEBUG = `🐛`;\nconst OK = `✔️`;\nconst WARN = `⚠️`;\nconst ERROR = `❌`;\n\nconst PREFIX_TIME = `${TIME} `;\nconst PREFIX_DEBUG = `${BLUE}${DEBUG}${RESET} `;\nconst PREFIX_OK = `${GREEN}${OK}${RESET} `;\nconst PREFIX_WARN = `${YELLOW}${WARN}${RESET} `;\nconst PREFIX_ERROR = `${RED}${ERROR}${RESET} `;\n\nexport const getLogger = (groupLabel?: string) => {\n\tconst PREFIX = groupLabel ? `[${groupLabel}] ` : \"\";\n\treturn {\n\t\tgetLogger(subGroupLabel: string) {\n\t\t\treturn getLogger([groupLabel, subGroupLabel].filter(Boolean).join(\" > \"));\n\t\t},\n\t\ttime(label: string) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.time([PREFIX_TIME, PREFIX, label].filter(Boolean).join(\" \"));\n\t\t},\n\t\ttimeEnd(label: string) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.timeEnd([PREFIX_TIME, PREFIX, label].filter(Boolean).join(\" \"));\n\t\t},\n\t\tdebug(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.DEBUG) return;\n\t\t\tconsole.log(...[PREFIX_DEBUG, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\tlog(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.LOG) return;\n\t\t\tconsole.log(...[PREFIX_OK, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\tdir(item?: unknown, options?: InspectOptions) {\n\t\t\tif (valueLogLevel > LogLevel.LOG) return;\n\t\t\tconsole.dir(item, options);\n\t\t},\n\t\twarn(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.WARN) return;\n\t\t\tconsole.warn(...[PREFIX_WARN, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t\terror(...args: LogParms) {\n\t\t\tif (valueLogLevel > LogLevel.ERROR) return;\n\t\t\tconsole.error(...[PREFIX_ERROR, PREFIX, ...args].filter(Boolean));\n\t\t},\n\t};\n};\n\nexport const logger = getLogger();\n","import type {\n\tAPIBlogCategoriesBrowseQueryParams,\n\tAPIBlogCategoriesBrowseResult,\n\tAPIBlogCategoryCreateBody,\n\tAPIBlogCategoryCreateResult,\n\tAPIBlogCategoryDeleteResult,\n\tAPIBlogCategoryGetByIdParams,\n\tAPIBlogCategoryGetByIdResult,\n\tAPIBlogCategoryUpdateBody,\n\tAPIBlogCategoryUpdateResult,\n\tAPIBrandAssignProductsBody,\n\tAPIBrandAssignProductsResult,\n\tAPIBrandCreateBody,\n\tAPIBrandCreateResult,\n\tAPIBrandDeleteResult,\n\tAPIBrandGetByIdParams,\n\tAPIBrandGetByIdResult,\n\tAPIBrandsBrowseQueryParams,\n\tAPIBrandsBrowseResult,\n\tAPIBrandUpdateBody,\n\tAPIBrandUpdateResult,\n\tAPICartCreateBody,\n\tAPICartCreateResult,\n\tAPICartDeleteResult,\n\tAPICartGetResult,\n\tAPICategoriesBrowseQueryParams,\n\tAPICategoriesBrowseResult,\n\tAPICategoryCreateBody,\n\tAPICategoryCreateResult,\n\tAPICategoryDeleteResult,\n\tAPICategoryGetByIdParams,\n\tAPICategoryGetByIdResult,\n\tAPICategoryUpdateBody,\n\tAPICategoryUpdateResult,\n\tAPICollectionCreateBody,\n\tAPICollectionCreateResult,\n\tAPICollectionDeleteResult,\n\tAPICollectionGetByIdParams,\n\tAPICollectionGetByIdResult,\n\tAPICollectionsBrowseQueryParams,\n\tAPICollectionsBrowseResult,\n\tAPICollectionUpdateBody,\n\tAPICollectionUpdateResult,\n\tAPIContactMessageCreateBody,\n\tAPIContactMessageCreateResult,\n\tAPICustomerAddressCreateBody,\n\tAPICustomerAddressCreateResult,\n\tAPICustomerGetByIdParams,\n\tAPICustomerGetByIdResult,\n\tAPICustomerOrdersBrowseQueryParams,\n\tAPICustomerOrdersBrowseResult,\n\tAPICustomersBrowseQueryParams,\n\tAPICustomersBrowseResult,\n\tAPICustomerUpdateBody,\n\tAPICustomerUpdateResult,\n\tAPIEventAttendeesBrowseResult,\n\tAPIEventCreateBody,\n\tAPIEventCreateResult,\n\tAPIEventGetByIdParams,\n\tAPIEventGetByIdResult,\n\tAPIEventsBrowseQueryParams,\n\tAPIEventsBrowseResult,\n\tAPIEventUpdateBody,\n\tAPIEventUpdateResult,\n\tAPIInstaviewImagesBrowseParams,\n\tAPIInstaviewImagesBrowseQueryParams,\n\tAPIInstaviewImagesBrowseResult,\n\tAPIInventoryAdjustBody,\n\tAPIInventoryAdjustResult,\n\tAPIInventoryBrowseQueryParams,\n\tAPIInventoryBrowseResult,\n\tAPILegalPageGetByPathResult,\n\tAPILegalPagesBrowseResult,\n\tAPIMeGetResult,\n\tAPIOrderGetByIdParams,\n\tAPIOrderGetByIdResult,\n\tAPIOrderRefundGetParams,\n\tAPIOrderRefundGetResult,\n\tAPIOrderRefundsBrowseQueryParams,\n\tAPIOrderRefundsBrowseResult,\n\tAPIOrderRefundsParams,\n\tAPIOrdersBrowseQueryParams,\n\tAPIOrdersBrowseResult,\n\tAPIOrderUpdateBody,\n\tAPIOrderUpdateResult,\n\tAPIPostCommentCreateBody,\n\tAPIPostCommentCreateResult,\n\tAPIPostCommentsBrowseQueryParams,\n\tAPIPostCommentsBrowseResult,\n\tAPIPostCreateBody,\n\tAPIPostCreateResult,\n\tAPIPostDeleteResult,\n\tAPIPostGetByIdParams,\n\tAPIPostGetByIdResult,\n\tAPIPostsBrowseQueryParams,\n\tAPIPostsBrowseResult,\n\tAPIPostUpdateBody,\n\tAPIPostUpdateResult,\n\tAPIProductBatchBody,\n\tAPIProductBatchResult,\n\tAPIProductCreateBody,\n\tAPIProductCreateResult,\n\tAPIProductDeleteResult,\n\tAPIProductFiltersResult,\n\tAPIProductGetByIdParams,\n\tAPIProductGetByIdResult,\n\tAPIProductReviewCreateBody,\n\tAPIProductReviewCreateResult,\n\tAPIProductReviewsBrowseQueryParams,\n\tAPIProductReviewsBrowseResult,\n\tAPIProductsBrowseQueryParams,\n\tAPIProductsBrowseResult,\n\tAPIProductUpdateBody,\n\tAPIProductUpdateResult,\n\tAPISearchQueryParams,\n\tAPISearchResult,\n\tAPISocialsGetResult,\n\tAPISubscriberCreateBody,\n\tAPISubscriberCreateResult,\n\tAPISubscriberDeleteResult,\n\tAPITicketAttendeeGetResult,\n\tAPITicketsGetResult,\n\tAPITicketsUpdateBody,\n\tAPITicketsUpdateResult,\n\tAPIVariantCreateBody,\n\tAPIVariantCreateResult,\n\tAPIVariantGetByIdParams,\n\tAPIVariantGetByIdResult,\n\tAPIVariantUpdateBody,\n\tAPIVariantUpdateResult,\n} from \"../api-types\";\nimport { env } from \"../env\";\nimport { getLogger } from \"../logger\";\nimport type { CommerceConfig } from \"../types\";\n\nexport type APICollectionImportMembershipsBody = { file: File | Blob };\n\nexport type APICollectionImportMembershipsResult = {\n\tok: true;\n\tprocessed: number;\n\tinserted: number;\n\tskipped_existing: number;\n\terrors: Array<{\n\t\trow: number;\n\t\tcollection_slug?: string;\n\t\tproduct_slug?: string;\n\t\treason: string;\n\t}>;\n};\n\nexport class YNSProvider {\n\t#config: CommerceConfig;\n\t#logger = getLogger(\"YNSProvider\");\n\n\tconstructor(config: CommerceConfig = {}) {\n\t\tconst token = config.token ?? env.YNS_API_KEY;\n\t\tconst isStaging = env.YNS_API_KEY?.startsWith(\"sk-s-\");\n\n\t\tif (!token) {\n\t\t\tthrow new Error(\n\t\t\t\t\"YNS API key is required. Set YNS_API_KEY environment variable or pass token in config.\",\n\t\t\t);\n\t\t}\n\t\tconst endpoint = config.endpoint ?? (isStaging ? \"https://yns.cx\" : \"https://yns.store\");\n\n\t\tthis.#config = { version: \"v1\", ...config, token, endpoint };\n\n\t\tthis.#logger.debug(\"YNSProvider initialized\", {\n\t\t\tendpoint,\n\t\t\ttoken: config.token ? `from config` : \"from env\",\n\t\t});\n\t}\n\n\tasync #restRequest<T>(\n\t\tpathname: `/${string}`,\n\t\tmethod: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\" = \"GET\",\n\t\tbody?: unknown,\n\t): Promise<T> {\n\t\tconst response = await this.#fetchJson(pathname, method, body);\n\t\treturn this.#parseResponse<T>(response, pathname, method);\n\t}\n\n\t/**\n\t * Like {@link #restRequest} but resolves to `null` on a 404 response. For lookups where\n\t * \"not found\" is an expected outcome (e.g. ticket access codes answered with a uniform 404).\n\t */\n\tasync #restRequestNullable<T>(pathname: `/${string}`): Promise<T | null> {\n\t\tconst response = await this.#fetchJson(pathname, \"GET\");\n\t\tif (response.status === 404) {\n\t\t\treturn null;\n\t\t}\n\t\treturn this.#parseResponse<T>(response, pathname, \"GET\");\n\t}\n\n\tasync #fetchJson(\n\t\tpathname: `/${string}`,\n\t\tmethod: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\",\n\t\tbody?: unknown,\n\t): Promise<Response> {\n\t\tconst logger = this.#logger.getLogger(\"#restRequest\");\n\n\t\tconst endpoint = `${this.#config.endpoint}/api/${this.#config.version}${pathname}`;\n\t\tlogger.debug(`Making ${method} request to YNS API: ${endpoint}`);\n\t\treturn fetch(endpoint, {\n\t\t\tmethod,\n\t\t\theaders: {\n\t\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\tAuthorization: `Bearer ${this.#config.token}`,\n\t\t\t},\n\t\t\tbody: body ? JSON.stringify(body) : undefined,\n\t\t});\n\t}\n\n\tasync #parseResponse<T>(response: Response, pathname: `/${string}`, method: string): Promise<T> {\n\t\tconst logger = this.#logger.getLogger(\"#restRequest\");\n\t\tconst endpoint = `${this.#config.endpoint}/api/${this.#config.version}${pathname}`;\n\n\t\tif (!response.ok) {\n\t\t\t// Handle different error types\n\t\t\tconst contentType = response.headers.get(\"content-type\");\n\t\t\tlet errorMessage = `YNS REST request failed: ${method} ${endpoint} ${response.status} ${response.statusText}`;\n\n\t\t\tif (contentType?.includes(\"application/json\")) {\n\t\t\t\ttry {\n\t\t\t\t\tconst errorData = await response.json();\n\t\t\t\t\terrorMessage = errorData.error || errorData.message || errorMessage;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(\"Failed to parse YNS error response as JSON\", error);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst errorText = await response.text();\n\t\t\t\tlogger.error(\n\t\t\t\t\t`YNS API request failed: ${response.status} ${response.statusText}`,\n\t\t\t\t\terrorMessage,\n\t\t\t\t\terrorText,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\n\t\t// Check if response is JSON before parsing\n\t\tconst contentType = response.headers.get(\"content-type\");\n\t\tif (!contentType?.includes(\"application/json\")) {\n\t\t\tthrow new Error(`YNS API returned ${contentType} instead of JSON for ${pathname}`);\n\t\t}\n\n\t\treturn response.json();\n\t}\n\n\tasync #multipartRequest<T>(pathname: `/${string}`, formData: FormData): Promise<T> {\n\t\tconst logger = this.#logger.getLogger(\"#multipartRequest\");\n\n\t\tconst endpoint = `${this.#config.endpoint}/api/${this.#config.version}${pathname}`;\n\t\tlogger.debug(`Making multipart POST to YNS API: ${endpoint}`);\n\t\tconst response = await fetch(endpoint, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${this.#config.token}`,\n\t\t\t},\n\t\t\tbody: formData,\n\t\t});\n\n\t\tif (!response.ok) {\n\t\t\tconst contentType = response.headers.get(\"content-type\");\n\t\t\tlet errorMessage = `YNS REST request failed: POST ${endpoint} ${response.status} ${response.statusText}`;\n\n\t\t\tif (contentType?.includes(\"application/json\")) {\n\t\t\t\ttry {\n\t\t\t\t\tconst errorData = await response.json();\n\t\t\t\t\terrorMessage = errorData.error || errorData.message || errorMessage;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlogger.error(\"Failed to parse YNS error response as JSON\", error);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst errorText = await response.text();\n\t\t\t\tlogger.error(\n\t\t\t\t\t`YNS API request failed: ${response.status} ${response.statusText}`,\n\t\t\t\t\terrorMessage,\n\t\t\t\t\terrorText,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tthrow new Error(errorMessage);\n\t\t}\n\n\t\tconst contentType = response.headers.get(\"content-type\");\n\t\tif (!contentType?.includes(\"application/json\")) {\n\t\t\tthrow new Error(`YNS API returned ${contentType} instead of JSON for ${pathname}`);\n\t\t}\n\n\t\treturn response.json();\n\t}\n\n\tasync meGet(): Promise<APIMeGetResult> {\n\t\tconst logger = this.#logger.getLogger(\"meGet\");\n\t\tlogger.debug(\"Fetching my information\");\n\n\t\tconst pathname = `/me` as const;\n\t\tconst result = await this.#restRequest<APIMeGetResult>(pathname);\n\t\tlogger.debug(\"Received my information:\", result);\n\t\treturn result;\n\t}\n\n\tasync socialsGet(): Promise<APISocialsGetResult> {\n\t\tconst logger = this.#logger.getLogger(\"socialsGet\");\n\t\tlogger.debug(\"Fetching store social links\");\n\n\t\tconst pathname = `/socials` as const;\n\t\tconst result = await this.#restRequest<APISocialsGetResult>(pathname);\n\t\tlogger.debug(\"Received store social links:\", result);\n\t\treturn result;\n\t}\n\n\t// Brands ---------------------------------------------------------------\n\n\tasync brandBrowse(params: APIBrandsBrowseQueryParams = {}): Promise<APIBrandsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.lang) queryParams.append(\"lang\", params.lang);\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/brands${searchParams}` as const;\n\t\treturn this.#restRequest<APIBrandsBrowseResult>(pathname);\n\t}\n\n\tasync brandGet(params: APIBrandGetByIdParams): Promise<APIBrandGetByIdResult | null> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandGetByIdResult>(pathname);\n\t}\n\n\tasync brandCreate(body: APIBrandCreateBody): Promise<APIBrandCreateResult> {\n\t\treturn this.#restRequest<APIBrandCreateResult>(\"/brands\", \"POST\", body);\n\t}\n\n\tasync brandUpdate(params: APIBrandGetByIdParams, body: APIBrandUpdateBody): Promise<APIBrandUpdateResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync brandDelete(params: APIBrandGetByIdParams): Promise<APIBrandDeleteResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBrandDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync brandAssignProducts(\n\t\tparams: APIBrandGetByIdParams,\n\t\tbody: APIBrandAssignProductsBody,\n\t): Promise<APIBrandAssignProductsResult> {\n\t\tconst pathname = `/brands/${params.idOrSlug}/products` as const;\n\t\treturn this.#restRequest<APIBrandAssignProductsResult>(pathname, \"POST\", body);\n\t}\n\n\t// Order refunds --------------------------------------------------------\n\n\tasync orderRefundsBrowse(\n\t\tparams: APIOrderRefundsParams & APIOrderRefundsBrowseQueryParams,\n\t): Promise<APIOrderRefundsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/orders/${params.id}/refunds${searchParams}` as const;\n\t\treturn this.#restRequest<APIOrderRefundsBrowseResult>(pathname);\n\t}\n\n\tasync orderRefundGet(params: APIOrderRefundGetParams): Promise<APIOrderRefundGetResult | null> {\n\t\tconst pathname = `/orders/${params.id}/refunds/${params.refundId}` as const;\n\t\treturn this.#restRequest<APIOrderRefundGetResult>(pathname);\n\t}\n\n\t// Product bulk ---------------------------------------------------------\n\n\tasync productBatch(body: APIProductBatchBody): Promise<APIProductBatchResult> {\n\t\treturn this.#restRequest<APIProductBatchResult>(\"/products/batch\", \"POST\", body);\n\t}\n\n\t// Cart -----------------------------------------------------------------\n\n\tasync cartDelete(params: { cartId: string }): Promise<APICartDeleteResult> {\n\t\tconst pathname = `/carts/${params.cartId}` as const;\n\t\treturn this.#restRequest<APICartDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync productBrowse(params: APIProductsBrowseQueryParams): Promise<APIProductsBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"productBrowse\");\n\t\tlogger.debug(\"Browsing products with params:\", params);\n\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.category) queryParams.append(\"category\", params.category);\n\t\tif (params.collection) queryParams.append(\"collection\", params.collection);\n\t\tif (params.brand) queryParams.append(\"brand\", params.brand);\n\t\tif (params.priceMin !== undefined) queryParams.append(\"priceMin\", params.priceMin.toString());\n\t\tif (params.priceMax !== undefined) queryParams.append(\"priceMax\", params.priceMax.toString());\n\t\tif (params.vts) queryParams.append(\"vts\", params.vts);\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.orderBy) queryParams.append(\"orderBy\", params.orderBy);\n\t\tif (params.orderDirection) queryParams.append(\"orderDirection\", params.orderDirection);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/products${searchParams}` as const;\n\t\tlogger.debug(\"Constructed pathname:\", pathname);\n\t\tconst result = await this.#restRequest<APIProductsBrowseResult>(pathname);\n\t\tlogger.debug(\"Received product browse result:\", { meta: result.meta });\n\t\treturn result;\n\t}\n\n\t/**\n\t * Available storefront filter facets for the store: price bounds, variant\n\t * types/values, and active categories, collections, and brands. Pair with\n\t * `productBrowse`'s `collection`, `brand`, `priceMin`/`priceMax`, and `vts`\n\t * params to build a filter UI.\n\t */\n\tasync productFilters(): Promise<APIProductFiltersResult> {\n\t\tconst result = await this.#restRequest<APIProductFiltersResult>(\"/products/filters\");\n\t\treturn result;\n\t}\n\n\tasync productGet(params: APIProductGetByIdParams): Promise<APIProductGetByIdResult | null> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APIProductGetByIdResult>(pathname);\n\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\tasync orderBrowse(params: APIOrdersBrowseQueryParams): Promise<APIOrdersBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"orderBrowse\");\n\t\tlogger.debug(\"Browsing orders with params:\", params);\n\n\t\tconst queryParams = new URLSearchParams();\n\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/orders${searchParams}` as const;\n\t\tlogger.debug(\"Constructed pathname:\", pathname);\n\t\tconst result = await this.#restRequest<APIOrdersBrowseResult>(pathname);\n\t\tlogger.debug(\"Received orders browse result:\", { meta: result.meta });\n\t\treturn result;\n\t}\n\n\tasync orderGet(params: APIOrderGetByIdParams): Promise<APIOrderGetByIdResult | null> {\n\t\tconst pathname = `/orders/${params.id}` as const;\n\n\t\tconst result = await this.#restRequest<APIOrderGetByIdResult>(pathname);\n\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// @todo\n\t// async cartAdd(params: APICartAddBody): Promise<APICartAddResult> {\n\t// \tconst body = {\n\t// \t\tvariantId: params.variantId,\n\t// \t\tcartId: params.cartId,\n\t// \t\tquantity: params.quantity,\n\t// \t\tsubscriptionId: params.subscriptionId,\n\t// \t};\n\n\t// \tconst result = await this.#restRequest<APICartCreateResult>(\"/carts\", \"PATCH\", body);\n\t// \treturn result;\n\t// }\n\n\tasync cartUpsert(body: APICartCreateBody): Promise<APICartCreateResult> {\n\t\tconst result = await this.#restRequest<APICartCreateResult>(\"/carts\", \"POST\", body);\n\t\treturn result;\n\t}\n\n\tasync cartRemoveItem(params: { cartId: string; variantId: string }): Promise<APICartGetResult> {\n\t\tconst pathname = `/carts/${params.cartId}/line-items/${params.variantId}` as const;\n\t\treturn this.#restRequest<APICartGetResult>(pathname, \"DELETE\");\n\t}\n\n\tasync cartGet(params: { cartId: string }): Promise<APICartGetResult | null> {\n\t\tconst pathname = `/carts/${params.cartId}` as const;\n\t\tconst result = await this.#restRequest<APICartGetResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync collectionGet(params: APICollectionGetByIdParams): Promise<APICollectionGetByIdResult | null> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APICollectionGetByIdResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync collectionBrowse(params: APICollectionsBrowseQueryParams): Promise<APICollectionsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.group) queryParams.append(\"group\", params.group);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/collections${searchParams}` as const;\n\n\t\tconst result = await this.#restRequest<APICollectionsBrowseResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync collectionCreate(body: APICollectionCreateBody): Promise<APICollectionCreateResult> {\n\t\treturn this.#restRequest<APICollectionCreateResult>(\"/collections\", \"POST\", body);\n\t}\n\n\tasync collectionUpdate(\n\t\tparams: APICollectionGetByIdParams,\n\t\tbody: APICollectionUpdateBody,\n\t): Promise<APICollectionUpdateResult> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICollectionUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync collectionDelete(params: APICollectionGetByIdParams): Promise<APICollectionDeleteResult> {\n\t\tconst pathname = `/collections/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICollectionDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync collectionImportMemberships(\n\t\tbody: APICollectionImportMembershipsBody,\n\t): Promise<APICollectionImportMembershipsResult> {\n\t\tconst formData = new FormData();\n\t\tformData.append(\"file\", body.file);\n\t\treturn this.#multipartRequest<APICollectionImportMembershipsResult>(\n\t\t\t\"/collections/import-memberships\",\n\t\t\tformData,\n\t\t);\n\t}\n\n\tasync categoryGet(params: APICategoryGetByIdParams): Promise<APICategoryGetByIdResult | null> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\n\t\tconst result = await this.#restRequest<APICategoryGetByIdResult>(pathname);\n\t\treturn result;\n\t}\n\n\tasync categoriesBrowse(params: APICategoriesBrowseQueryParams): Promise<APICategoriesBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/categories${searchParams}` as const;\n\n\t\tconst result = await this.#restRequest<APICategoriesBrowseResult>(pathname);\n\t\treturn result;\n\t}\n\n\t// ============================================\n\t// Posts\n\t// ============================================\n\n\tasync postBrowse(params: APIPostsBrowseQueryParams = {}): Promise<APIPostsBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\t\tif (params.tag) queryParams.append(\"tag\", params.tag);\n\t\tif (params.categoryId) queryParams.append(\"categoryId\", params.categoryId);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/posts${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIPostsBrowseResult>(pathname);\n\t}\n\n\tasync postGet(params: APIPostGetByIdParams): Promise<APIPostGetByIdResult | null> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostGetByIdResult>(pathname);\n\t}\n\n\tasync postCreate(body: APIPostCreateBody): Promise<APIPostCreateResult> {\n\t\treturn this.#restRequest<APIPostCreateResult>(\"/posts\", \"POST\", body);\n\t}\n\n\tasync postUpdate(params: APIPostGetByIdParams, body: APIPostUpdateBody): Promise<APIPostUpdateResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync postDelete(params: APIPostGetByIdParams): Promise<APIPostDeleteResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIPostDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\tasync postCommentsBrowse(\n\t\tparams: APIPostGetByIdParams,\n\t\tqueryParams: APIPostCommentsBrowseQueryParams = {},\n\t): Promise<APIPostCommentsBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/posts/${params.idOrSlug}/comments${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIPostCommentsBrowseResult>(pathname);\n\t}\n\n\tasync postCommentCreate(\n\t\tparams: APIPostGetByIdParams,\n\t\tbody: APIPostCommentCreateBody,\n\t): Promise<APIPostCommentCreateResult> {\n\t\tconst pathname = `/posts/${params.idOrSlug}/comments` as const;\n\t\treturn this.#restRequest<APIPostCommentCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Blog Categories\n\t// ============================================\n\n\tasync blogCategoryBrowse(\n\t\tparams: APIBlogCategoriesBrowseQueryParams = {},\n\t): Promise<APIBlogCategoriesBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.query) queryParams.append(\"query\", params.query);\n\t\tif (params.active !== undefined) queryParams.append(\"active\", params.active.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/blog-categories${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIBlogCategoriesBrowseResult>(pathname);\n\t}\n\n\tasync blogCategoryGet(params: APIBlogCategoryGetByIdParams): Promise<APIBlogCategoryGetByIdResult | null> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryGetByIdResult>(pathname);\n\t}\n\n\tasync blogCategoryCreate(body: APIBlogCategoryCreateBody): Promise<APIBlogCategoryCreateResult> {\n\t\treturn this.#restRequest<APIBlogCategoryCreateResult>(\"/blog-categories\", \"POST\", body);\n\t}\n\n\tasync blogCategoryUpdate(\n\t\tparams: APIBlogCategoryGetByIdParams,\n\t\tbody: APIBlogCategoryUpdateBody,\n\t): Promise<APIBlogCategoryUpdateResult> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync blogCategoryDelete(params: APIBlogCategoryGetByIdParams): Promise<APIBlogCategoryDeleteResult> {\n\t\tconst pathname = `/blog-categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIBlogCategoryDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Customers\n\t// ============================================\n\n\tasync customerBrowse(params: APICustomersBrowseQueryParams = {}): Promise<APICustomersBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.offset) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.search) queryParams.append(\"search\", params.search);\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/customers${searchParams}` as const;\n\n\t\treturn this.#restRequest<APICustomersBrowseResult>(pathname);\n\t}\n\n\tasync customerGet(params: APICustomerGetByIdParams): Promise<APICustomerGetByIdResult | null> {\n\t\tconst pathname = `/customers/${params.id}` as const;\n\t\treturn this.#restRequest<APICustomerGetByIdResult>(pathname);\n\t}\n\n\tasync customerUpdate(\n\t\tparams: APICustomerGetByIdParams,\n\t\tbody: APICustomerUpdateBody,\n\t): Promise<APICustomerUpdateResult> {\n\t\tconst pathname = `/customers/${params.id}` as const;\n\t\treturn this.#restRequest<APICustomerUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync customerAddressCreate(\n\t\tparams: APICustomerGetByIdParams,\n\t\tbody: APICustomerAddressCreateBody,\n\t): Promise<APICustomerAddressCreateResult> {\n\t\tconst pathname = `/customers/${params.id}/addresses` as const;\n\t\treturn this.#restRequest<APICustomerAddressCreateResult>(pathname, \"POST\", body);\n\t}\n\n\tasync customerAddressDelete(params: { customerId: string; addressId: string }): Promise<void> {\n\t\tconst pathname = `/customers/${params.customerId}/addresses/${params.addressId}` as const;\n\t\tawait this.#restRequest<unknown>(pathname, \"DELETE\");\n\t}\n\n\tasync customerOrdersBrowse(\n\t\tparams: APICustomerGetByIdParams,\n\t\tqueryParams: APICustomerOrdersBrowseQueryParams = {},\n\t): Promise<APICustomerOrdersBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/customers/${params.id}/orders${searchParams}` as const;\n\n\t\treturn this.#restRequest<APICustomerOrdersBrowseResult>(pathname);\n\t}\n\n\t// ============================================\n\t// Inventory\n\t// ============================================\n\n\tasync inventoryBrowse(params: APIInventoryBrowseQueryParams = {}): Promise<APIInventoryBrowseResult> {\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.limit) queryParams.append(\"limit\", params.limit.toString());\n\t\tif (params.cursor) queryParams.append(\"cursor\", params.cursor);\n\t\tif (params.lowStock !== undefined) queryParams.append(\"lowStock\", params.lowStock.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/inventory${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIInventoryBrowseResult>(pathname);\n\t}\n\n\tasync inventoryAdjust(sku: string, body: APIInventoryAdjustBody): Promise<APIInventoryAdjustResult> {\n\t\tconst pathname = `/inventory/${encodeURIComponent(sku)}/adjust` as const;\n\t\treturn this.#restRequest<APIInventoryAdjustResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Variants\n\t// ============================================\n\n\tasync variantGet(params: APIVariantGetByIdParams): Promise<APIVariantGetByIdResult | null> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\treturn this.#restRequest<APIVariantGetByIdResult>(pathname);\n\t}\n\n\tasync variantUpdate(\n\t\tparams: APIVariantGetByIdParams,\n\t\tbody: APIVariantUpdateBody,\n\t): Promise<APIVariantUpdateResult> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\treturn this.#restRequest<APIVariantUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync variantDelete(params: APIVariantGetByIdParams): Promise<void> {\n\t\tconst pathname = `/variants/${params.idOrSku}` as const;\n\t\tawait this.#restRequest<unknown>(pathname, \"DELETE\");\n\t}\n\n\tasync variantCreate(productId: string, body: APIVariantCreateBody): Promise<APIVariantCreateResult> {\n\t\tconst pathname = `/products/${productId}/variants` as const;\n\t\treturn this.#restRequest<APIVariantCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Subscribers\n\t// ============================================\n\n\tasync subscriberCreate(body: APISubscriberCreateBody): Promise<APISubscriberCreateResult> {\n\t\treturn this.#restRequest<APISubscriberCreateResult>(\"/subscribers\", \"POST\", body);\n\t}\n\n\tasync subscriberDelete(email: string): Promise<APISubscriberDeleteResult> {\n\t\tconst pathname = `/subscribers?email=${encodeURIComponent(email)}` as const;\n\t\treturn this.#restRequest<APISubscriberDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Contact Messages\n\t// ============================================\n\n\tasync contactMessageCreate(body: APIContactMessageCreateBody): Promise<APIContactMessageCreateResult> {\n\t\treturn this.#restRequest<APIContactMessageCreateResult>(\"/contact-messages\", \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Product mutations\n\t// ============================================\n\n\tasync productCreate(body: APIProductCreateBody): Promise<APIProductCreateResult> {\n\t\treturn this.#restRequest<APIProductCreateResult>(\"/products\", \"POST\", body);\n\t}\n\n\tasync productUpdate(\n\t\tparams: APIProductGetByIdParams,\n\t\tbody: APIProductUpdateBody,\n\t): Promise<APIProductUpdateResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIProductUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync productDelete(params: APIProductGetByIdParams): Promise<APIProductDeleteResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIProductDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Product Reviews\n\t// ============================================\n\n\tasync productReviewsBrowse(\n\t\tparams: APIProductGetByIdParams,\n\t\tqueryParams: APIProductReviewsBrowseQueryParams = {},\n\t): Promise<APIProductReviewsBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.offset) urlParams.append(\"offset\", queryParams.offset.toString());\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/products/${params.idOrSlug}/reviews${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIProductReviewsBrowseResult>(pathname);\n\t}\n\n\tasync productReviewCreate(\n\t\tparams: APIProductGetByIdParams,\n\t\tbody: APIProductReviewCreateBody,\n\t): Promise<APIProductReviewCreateResult> {\n\t\tconst pathname = `/products/${params.idOrSlug}/reviews` as const;\n\t\treturn this.#restRequest<APIProductReviewCreateResult>(pathname, \"POST\", body);\n\t}\n\n\t// ============================================\n\t// Events (products flagged `flags.event` with a single non-shippable ticket variant)\n\t// ============================================\n\n\tasync eventBrowse(params: APIEventsBrowseQueryParams = {}): Promise<APIEventsBrowseResult> {\n\t\tconst logger = this.#logger.getLogger(\"eventBrowse\");\n\t\tconst queryParams = new URLSearchParams();\n\t\tif (params.offset !== undefined) queryParams.append(\"offset\", params.offset.toString());\n\t\tif (params.limit !== undefined) queryParams.append(\"limit\", params.limit.toString());\n\n\t\tconst searchParams = queryParams.size ? `?${queryParams}` : \"\";\n\t\tconst pathname = `/events${searchParams}` as const;\n\t\tlogger.debug(\"Browsing events:\", pathname);\n\t\treturn this.#restRequest<APIEventsBrowseResult>(pathname);\n\t}\n\n\tasync eventGet(params: APIEventGetByIdParams): Promise<APIEventGetByIdResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIEventGetByIdResult>(pathname);\n\t}\n\n\tasync eventCreate(body: APIEventCreateBody): Promise<APIEventCreateResult> {\n\t\treturn this.#restRequest<APIEventCreateResult>(\"/events\", \"POST\", body);\n\t}\n\n\tasync eventUpdate(params: APIEventGetByIdParams, body: APIEventUpdateBody): Promise<APIEventUpdateResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APIEventUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync eventAttendeesBrowse(params: APIEventGetByIdParams): Promise<APIEventAttendeesBrowseResult> {\n\t\tconst pathname = `/events/${params.idOrSlug}/attendees` as const;\n\t\treturn this.#restRequest<APIEventAttendeesBrowseResult>(pathname);\n\t}\n\n\t// ============================================\n\t// Tickets (no-login buyer/attendee access to purchased event tickets)\n\t// ============================================\n\n\t/**\n\t * Buyer ticket lookup: the order's 6-character access code plus the purchase email.\n\t * Resolves to `null` on mismatch — the API answers a uniform 404 for an unknown code,\n\t * an email that doesn't match, or an order without tickets.\n\t */\n\tasync ticketsGet(params: { code: string; email: string }): Promise<APITicketsGetResult | null> {\n\t\tconst logger = this.#logger.getLogger(\"ticketsGet\");\n\t\tconst queryParams = new URLSearchParams({ email: params.email });\n\t\tconst pathname = `/tickets/${encodeURIComponent(params.code)}?${queryParams}` as const;\n\t\tlogger.debug(\"Fetching ticket bundle:\", pathname);\n\t\treturn this.#restRequestNullable<APITicketsGetResult>(pathname);\n\t}\n\n\t/**\n\t * Buyer bulk-edit of attendee names/emails. The body carries the purchase email; seat\n\t * tokens not belonging to the order are silently ignored. Throws on code/email mismatch\n\t * (404) or when the order is cancelled/refunded (409).\n\t */\n\tasync ticketsUpdate(params: { code: string }, body: APITicketsUpdateBody): Promise<APITicketsUpdateResult> {\n\t\tconst pathname = `/tickets/${encodeURIComponent(params.code)}` as const;\n\t\treturn this.#restRequest<APITicketsUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\t/**\n\t * View-only attendee ticket by per-seat token (the capability embedded in the attendee\n\t * link/QR). Resolves to `null` for an unknown token. Attendee details can only be edited\n\t * by the buyer via {@link ticketsUpdate} — attendee links must not escalate.\n\t */\n\tasync ticketAttendeeGet(params: { token: string }): Promise<APITicketAttendeeGetResult | null> {\n\t\tconst pathname = `/tickets/attendee/${encodeURIComponent(params.token)}` as const;\n\t\treturn this.#restRequestNullable<APITicketAttendeeGetResult>(pathname);\n\t}\n\n\t// ============================================\n\t// Category mutations\n\t// ============================================\n\n\tasync categoryCreate(body: APICategoryCreateBody): Promise<APICategoryCreateResult> {\n\t\treturn this.#restRequest<APICategoryCreateResult>(\"/categories\", \"POST\", body);\n\t}\n\n\tasync categoryUpdate(\n\t\tparams: APICategoryGetByIdParams,\n\t\tbody: APICategoryUpdateBody,\n\t): Promise<APICategoryUpdateResult> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICategoryUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\tasync categoryDelete(params: APICategoryGetByIdParams): Promise<APICategoryDeleteResult> {\n\t\tconst pathname = `/categories/${params.idOrSlug}` as const;\n\t\treturn this.#restRequest<APICategoryDeleteResult>(pathname, \"DELETE\");\n\t}\n\n\t// ============================================\n\t// Order mutations\n\t// ============================================\n\n\tasync orderUpdate(params: APIOrderGetByIdParams, body: APIOrderUpdateBody): Promise<APIOrderUpdateResult> {\n\t\tconst pathname = `/orders/${params.id}` as const;\n\t\treturn this.#restRequest<APIOrderUpdateResult>(pathname, \"PATCH\", body);\n\t}\n\n\t// ============================================\n\t// Legal Pages\n\t// ============================================\n\n\tasync legalPageBrowse(): Promise<APILegalPagesBrowseResult> {\n\t\treturn this.#restRequest<APILegalPagesBrowseResult>(\"/legal-pages\");\n\t}\n\n\tasync legalPageGet(path: string): Promise<APILegalPageGetByPathResult> {\n\t\tconst normalized = path.startsWith(\"/\") ? path.slice(1) : path;\n\t\tconst pathname = `/legal-pages/${encodeURIComponent(normalized)}` as const;\n\t\treturn this.#restRequest<APILegalPageGetByPathResult>(pathname);\n\t}\n\n\tasync search(params: APISearchQueryParams): Promise<APISearchResult> {\n\t\treturn this.request<APISearchResult>(\"/search\", {\n\t\t\tquery: params,\n\t\t});\n\t}\n\n\t// ============================================\n\t// Instaview\n\t// ============================================\n\n\tasync instaviewImagesBrowse(\n\t\tparams: APIInstaviewImagesBrowseParams,\n\t\tqueryParams: APIInstaviewImagesBrowseQueryParams = {},\n\t): Promise<APIInstaviewImagesBrowseResult> {\n\t\tconst urlParams = new URLSearchParams();\n\t\tif (queryParams.limit) urlParams.append(\"limit\", queryParams.limit.toString());\n\t\tif (queryParams.cursor) urlParams.append(\"cursor\", queryParams.cursor);\n\n\t\tconst searchParams = urlParams.size ? `?${urlParams}` : \"\";\n\t\tconst pathname = `/instaview/accounts/${params.handle}/images${searchParams}` as const;\n\n\t\treturn this.#restRequest<APIInstaviewImagesBrowseResult>(pathname);\n\t}\n\n\t/**\n\t * Make a raw API request to any endpoint.\n\t * Use this for new API features not yet supported by typed methods.\n\t *\n\t * @example\n\t * // GET request (default method)\n\t * const webhooks = await provider.request<Webhook[]>('/webhooks');\n\t *\n\t * // POST with typed body\n\t * const webhook = await provider.request<Webhook, CreateWebhookBody>('/webhooks', {\n\t * method: 'POST',\n\t * body: { url: 'https://...' }\n\t * });\n\t *\n\t * // GET with query parameters\n\t * const products = await provider.request<Product[]>('/products', {\n\t * query: { limit: 10, category: 'shoes' }\n\t * });\n\t *\n\t * // Path parameters via template literals\n\t * const product = await provider.request<Product>(`/products/${id}`);\n\t */\n\tasync request<TResponse = unknown, TBody = unknown>(\n\t\tpathname: `/${string}`,\n\t\toptions?: {\n\t\t\tmethod?: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\";\n\t\t\tbody?: TBody;\n\t\t\tquery?: Record<string, string | number | boolean>;\n\t\t},\n\t) {\n\t\tconst queryString = options?.query\n\t\t\t? `?${new URLSearchParams(Object.entries(options.query).map(([k, v]) => [k, String(v)]))}`\n\t\t\t: \"\";\n\n\t\treturn this.#restRequest<TResponse>(`${pathname}${queryString}`, options?.method ?? \"GET\", options?.body);\n\t}\n}\n","import { YNSProvider } from \"./providers/yns\";\nimport type { CommerceConfig } from \"./types\";\n\nexport function Commerce(config: CommerceConfig = {}): YNSProvider {\n\treturn new YNSProvider(config);\n}\n"],"mappings":"4BAAA,IAAMA,EAAc,QAAQ,IAAI,YAEnBC,EAAM,CAClB,YAAAD,CACD,ECYA,IAAME,EAAW,CAChB,MAAO,EACP,IAAK,EACL,KAAM,EACN,MAAO,CACR,EAGMC,EAAe,QAAQ,IAAI,uBAAyB,MACpDC,EAAgBF,EAASC,CAAW,EAEpCE,EAAQ,UACRC,EAAO,WACPC,EAAQ,WACRC,EAAS,WACTC,EAAM,WAENC,EAAO,eACPC,EAAQ,YACRC,EAAK,eACLC,EAAO,eACPC,EAAQ,SAERC,EAAc,GAAGL,CAAI,IACrBM,EAAe,GAAGV,CAAI,GAAGK,CAAK,GAAGN,CAAK,IACtCY,EAAY,GAAGV,CAAK,GAAGK,CAAE,GAAGP,CAAK,IACjCa,EAAc,GAAGV,CAAM,GAAGK,CAAI,GAAGR,CAAK,IACtCc,EAAe,GAAGV,CAAG,GAAGK,CAAK,GAAGT,CAAK,IAE9Be,EAAaC,GAAwB,CACjD,IAAMC,EAASD,EAAa,IAAIA,CAAU,KAAO,GACjD,MAAO,CACN,UAAUE,EAAuB,CAChC,OAAOH,EAAU,CAACC,EAAYE,CAAa,EAAE,OAAO,OAAO,EAAE,KAAK,KAAK,CAAC,CACzE,EACA,KAAKC,EAAe,CACfpB,EAAgBF,EAAS,OAC7B,QAAQ,KAAK,CAACa,EAAaO,EAAQE,CAAK,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC,CACpE,EACA,QAAQA,EAAe,CAClBpB,EAAgBF,EAAS,OAC7B,QAAQ,QAAQ,CAACa,EAAaO,EAAQE,CAAK,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,CAAC,CACvE,EACA,SAASC,EAAgB,CACpBrB,EAAgBF,EAAS,OAC7B,QAAQ,IAAI,GAAG,CAACc,EAAcM,EAAQ,GAAGG,CAAI,EAAE,OAAO,OAA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,CAAC,CACF,CAMA,MAAM,sBACLA,EACAC,EAAmD,CAAC,EACV,CAC1C,IAAME,EAAY,IAAI,gBAClBF,EAAY,OAAOE,EAAU,OAAO,QAASF,EAAY,MAAM,SAAS,CAAC,EACzEA,EAAY,QAAQE,EAAU,OAAO,SAAUF,EAAY,MAAM,EAErE,IAAMC,EAAeC,EAAU,KAAO,IAAIA,CAAS,GAAK,GAClDnB,EAAW,uBAAuBgB,EAAO,MAAM,UAAUE,CAAY,GAE3E,OAAO,KAAKnB,GAA6CC,CAAQ,CAClE,CAwBA,MAAM,QACLA,EACAyB,EAKC,CACD,IAAMC,EAAcD,GAAS,MAC1B,IAAI,IAAI,gBAAgB,OAAO,QAAQA,EAAQ,KAAK,EAAE,IAAI,CAAC,CAACE,EAAGC,CAAC,IAAM,CAACD,EAAG,OAAOC,CAAC,CAAC,CAAC,CAAC,CAAC,GACtF,GAEH,OAAO,KAAK7B,GAAwB,GAAGC,CAAQ,GAAG0B,CAAW,GAAID,GAAS,QAAU,MAAOA,GAAS,IAAI,CACzG,CACD,ECl/BO,SAASI,EAASC,EAAyB,CAAC,EAAgB,CAClE,OAAO,IAAIC,EAAYD,CAAM,CAC9B","names":["YNS_API_KEY","env","LogLevel","strLogLevel","valueLogLevel","RESET","BLUE","GREEN","YELLOW","RED","TIME","DEBUG","OK","WARN","ERROR","PREFIX_TIME","PREFIX_DEBUG","PREFIX_OK","PREFIX_WARN","PREFIX_ERROR","getLogger","groupLabel","PREFIX","subGroupLabel","label","args","item","options","logger","YNSProvider","#config","#logger","getLogger","config","token","env","isStaging","endpoint","#restRequest","pathname","method","body","response","#fetchJson","#parseResponse","#restRequestNullable","logger","contentType","errorMessage","errorData","error","errorText","#multipartRequest","formData","result","params","queryParams","searchParams","urlParams","sku","productId","email","path","normalized","options","queryString","k","v","Commerce","config","YNSProvider"]}
|