@01.software/sdk 0.27.0 → 0.29.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 +125 -1
- package/dist/analytics/react.cjs.map +1 -1
- package/dist/analytics/react.js.map +1 -1
- package/dist/analytics.cjs.map +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/{const-C0GlmeJ_.d.cts → const-DAjQYNuM.d.ts} +4 -4
- package/dist/{const-D-xucnw4.d.ts → const-Dsixdi6z.d.cts} +4 -4
- package/dist/index.cjs +626 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -8
- package/dist/index.d.ts +19 -8
- package/dist/index.js +626 -13
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-BPvUmPAq.d.cts → payload-types-Ci-ZA7aM.d.cts} +153 -73
- package/dist/{payload-types-BPvUmPAq.d.ts → payload-types-Ci-ZA7aM.d.ts} +153 -73
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/realtime.js.map +1 -1
- package/dist/{server-n3xK4Nks.d.cts → server-C0C8dtms.d.cts} +331 -12
- package/dist/{server-_zvihptw.d.ts → server-Cv0Q4dPQ.d.ts} +331 -12
- package/dist/server.cjs +68 -4
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +68 -4
- package/dist/server.js.map +1 -1
- package/dist/{types-BLdthWiW.d.ts → types-BWq_WlbB.d.ts} +1 -1
- package/dist/{types-DzWNu9pw.d.cts → types-zKjATmDK.d.cts} +1 -1
- package/dist/ui/canvas/server.cjs.map +1 -1
- package/dist/ui/canvas/server.js.map +1 -1
- package/dist/ui/canvas.cjs.map +1 -1
- package/dist/ui/canvas.js.map +1 -1
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +1 -1
|
@@ -47,11 +47,13 @@ interface Config {
|
|
|
47
47
|
'order-items': OrderItem;
|
|
48
48
|
transactions: Transaction;
|
|
49
49
|
'order-status-logs': OrderStatusLog;
|
|
50
|
+
'inventory-reservations': InventoryReservation;
|
|
50
51
|
fulfillments: Fulfillment;
|
|
51
52
|
'fulfillment-items': FulfillmentItem;
|
|
52
53
|
returns: Return;
|
|
53
54
|
'return-items': ReturnItem;
|
|
54
55
|
'shipping-policies': ShippingPolicy;
|
|
56
|
+
'shipping-zones': ShippingZone;
|
|
55
57
|
customers: Customer;
|
|
56
58
|
'customer-profiles': CustomerProfile;
|
|
57
59
|
'customer-profile-lists': CustomerProfileList;
|
|
@@ -60,7 +62,6 @@ interface Config {
|
|
|
60
62
|
carts: Cart;
|
|
61
63
|
'cart-items': CartItem;
|
|
62
64
|
discounts: Discount;
|
|
63
|
-
promotions: Promotion;
|
|
64
65
|
articles: Article;
|
|
65
66
|
'article-authors': ArticleAuthor;
|
|
66
67
|
'article-categories': ArticleCategory;
|
|
@@ -209,11 +210,13 @@ interface Config {
|
|
|
209
210
|
'order-items': OrderItemsSelect<false> | OrderItemsSelect<true>;
|
|
210
211
|
transactions: TransactionsSelect<false> | TransactionsSelect<true>;
|
|
211
212
|
'order-status-logs': OrderStatusLogsSelect<false> | OrderStatusLogsSelect<true>;
|
|
213
|
+
'inventory-reservations': InventoryReservationsSelect<false> | InventoryReservationsSelect<true>;
|
|
212
214
|
fulfillments: FulfillmentsSelect<false> | FulfillmentsSelect<true>;
|
|
213
215
|
'fulfillment-items': FulfillmentItemsSelect<false> | FulfillmentItemsSelect<true>;
|
|
214
216
|
returns: ReturnsSelect<false> | ReturnsSelect<true>;
|
|
215
217
|
'return-items': ReturnItemsSelect<false> | ReturnItemsSelect<true>;
|
|
216
218
|
'shipping-policies': ShippingPoliciesSelect<false> | ShippingPoliciesSelect<true>;
|
|
219
|
+
'shipping-zones': ShippingZonesSelect<false> | ShippingZonesSelect<true>;
|
|
217
220
|
customers: CustomersSelect<false> | CustomersSelect<true>;
|
|
218
221
|
'customer-profiles': CustomerProfilesSelect<false> | CustomerProfilesSelect<true>;
|
|
219
222
|
'customer-profile-lists': CustomerProfileListsSelect<false> | CustomerProfileListsSelect<true>;
|
|
@@ -222,7 +225,6 @@ interface Config {
|
|
|
222
225
|
carts: CartsSelect<false> | CartsSelect<true>;
|
|
223
226
|
'cart-items': CartItemsSelect<false> | CartItemsSelect<true>;
|
|
224
227
|
discounts: DiscountsSelect<false> | DiscountsSelect<true>;
|
|
225
|
-
promotions: PromotionsSelect<false> | PromotionsSelect<true>;
|
|
226
228
|
articles: ArticlesSelect<false> | ArticlesSelect<true>;
|
|
227
229
|
'article-authors': ArticleAuthorsSelect<false> | ArticleAuthorsSelect<true>;
|
|
228
230
|
'article-categories': ArticleCategoriesSelect<false> | ArticleCategoriesSelect<true>;
|
|
@@ -968,7 +970,7 @@ interface Webhook {
|
|
|
968
970
|
/**
|
|
969
971
|
* Receives create/update events for this collection.
|
|
970
972
|
*/
|
|
971
|
-
collection: 'tenant-metadata' | 'tenant-logos' | 'images' | 'products' | 'product-variants' | 'product-options' | 'product-option-values' | 'product-categories' | 'product-tags' | 'product-collections' | 'brands' | 'brand-logos' | 'orders' | 'order-items' | 'transactions' | 'fulfillments' | 'fulfillment-items' | 'returns' | 'return-items' | 'carts' | 'cart-items' | 'discounts' | '
|
|
973
|
+
collection: 'tenant-metadata' | 'tenant-logos' | 'images' | 'products' | 'product-variants' | 'product-options' | 'product-option-values' | 'product-categories' | 'product-tags' | 'product-collections' | 'brands' | 'brand-logos' | 'orders' | 'order-items' | 'transactions' | 'fulfillments' | 'fulfillment-items' | 'returns' | 'return-items' | 'carts' | 'cart-items' | 'discounts' | 'shipping-policies' | 'shipping-zones' | 'customers' | 'customer-profiles' | 'customer-addresses' | 'playlists' | 'playlist-categories' | 'playlist-tags' | 'tracks' | 'track-categories' | 'track-tags' | 'galleries' | 'gallery-items' | 'gallery-categories' | 'gallery-tags' | 'links' | 'link-categories' | 'link-tags' | 'forms' | 'form-submissions' | 'articles' | 'article-authors' | 'article-categories' | 'article-tags' | 'documents' | 'document-categories' | 'document-types' | 'canvases' | 'canvas-node-types' | 'canvas-edge-types' | 'canvas-categories' | 'canvas-tags' | 'canvas-nodes' | 'canvas-edges' | 'videos' | 'video-categories' | 'video-tags' | 'live-streams' | 'posts' | 'comments' | 'reactions' | 'reaction-types' | 'bookmarks' | 'post-categories' | 'customer-profile-lists' | 'event-calendars' | 'events' | 'event-categories' | 'event-occurrences' | 'event-tags';
|
|
972
974
|
id?: string | null;
|
|
973
975
|
}[] | null;
|
|
974
976
|
isActive?: boolean | null;
|
|
@@ -2155,7 +2157,7 @@ interface ProductOptionValue {
|
|
|
2155
2157
|
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
|
2156
2158
|
*/
|
|
2157
2159
|
generateSlug?: boolean | null;
|
|
2158
|
-
slug
|
|
2160
|
+
slug: string;
|
|
2159
2161
|
thumbnail?: (string | null) | Image;
|
|
2160
2162
|
images?: (string | Image)[] | null;
|
|
2161
2163
|
metadata?: {
|
|
@@ -2182,6 +2184,11 @@ interface ProductOption {
|
|
|
2182
2184
|
* Option name (e.g. Color, Size)
|
|
2183
2185
|
*/
|
|
2184
2186
|
title: string;
|
|
2187
|
+
/**
|
|
2188
|
+
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
|
2189
|
+
*/
|
|
2190
|
+
generateSlug?: boolean | null;
|
|
2191
|
+
slug: string;
|
|
2185
2192
|
values?: {
|
|
2186
2193
|
docs?: (string | ProductOptionValue)[];
|
|
2187
2194
|
hasNextPage?: boolean;
|
|
@@ -2975,6 +2982,12 @@ interface OrderItem {
|
|
|
2975
2982
|
*/
|
|
2976
2983
|
totalPrice: number;
|
|
2977
2984
|
productTitle?: string | null;
|
|
2985
|
+
/**
|
|
2986
|
+
* Option combination snapshot at order time. Later variant/option changes do not rewrite it.
|
|
2987
|
+
*/
|
|
2988
|
+
optionSelection?: {
|
|
2989
|
+
[k: string]: unknown;
|
|
2990
|
+
} | unknown[] | string | number | boolean | null;
|
|
2978
2991
|
/**
|
|
2979
2992
|
* Tax rate at time of order (%)
|
|
2980
2993
|
*/
|
|
@@ -2983,6 +2996,18 @@ interface OrderItem {
|
|
|
2983
2996
|
* Currency at time of order (ISO-4217)
|
|
2984
2997
|
*/
|
|
2985
2998
|
currency?: string | null;
|
|
2999
|
+
/**
|
|
3000
|
+
* Snapshot of the discount amount allocated to this line at order time (minor units).
|
|
3001
|
+
*/
|
|
3002
|
+
discountAllocation?: number | null;
|
|
3003
|
+
/**
|
|
3004
|
+
* Per-unit price snapshot after discount allocation. round(discountedTotalPrice / quantity).
|
|
3005
|
+
*/
|
|
3006
|
+
discountedUnitPrice?: number | null;
|
|
3007
|
+
/**
|
|
3008
|
+
* Line total snapshot after discount allocation at order time (totalPrice - discountAllocation).
|
|
3009
|
+
*/
|
|
3010
|
+
discountedTotalPrice?: number | null;
|
|
2986
3011
|
updatedAt: string;
|
|
2987
3012
|
createdAt: string;
|
|
2988
3013
|
deletedAt?: string | null;
|
|
@@ -3144,6 +3169,14 @@ interface Return {
|
|
|
3144
3169
|
*/
|
|
3145
3170
|
refundReceiptUrl?: string | null;
|
|
3146
3171
|
refundAmount: number;
|
|
3172
|
+
/**
|
|
3173
|
+
* Return shipping fee deducted from refundAmount
|
|
3174
|
+
*/
|
|
3175
|
+
returnShippingFee?: number | null;
|
|
3176
|
+
/**
|
|
3177
|
+
* Exchange balance (positive: extra charge, negative: extra refund)
|
|
3178
|
+
*/
|
|
3179
|
+
exchangeDifference?: number | null;
|
|
3147
3180
|
metadata?: {
|
|
3148
3181
|
[k: string]: unknown;
|
|
3149
3182
|
} | unknown[] | string | number | boolean | null;
|
|
@@ -3166,6 +3199,10 @@ interface ReturnItem {
|
|
|
3166
3199
|
variant?: (string | null) | ProductVariant;
|
|
3167
3200
|
quantity: number;
|
|
3168
3201
|
restockAction: 'return_to_stock' | 'discard';
|
|
3202
|
+
/**
|
|
3203
|
+
* Restocking fee for this line (deducted from line refund)
|
|
3204
|
+
*/
|
|
3205
|
+
restockingFee?: number | null;
|
|
3169
3206
|
productTitle?: string | null;
|
|
3170
3207
|
updatedAt: string;
|
|
3171
3208
|
createdAt: string;
|
|
@@ -3192,6 +3229,58 @@ interface OrderStatusLog {
|
|
|
3192
3229
|
updatedAt: string;
|
|
3193
3230
|
createdAt: string;
|
|
3194
3231
|
}
|
|
3232
|
+
/**
|
|
3233
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
3234
|
+
* via the `definition` "inventory-reservations".
|
|
3235
|
+
*/
|
|
3236
|
+
interface InventoryReservation {
|
|
3237
|
+
id: string;
|
|
3238
|
+
tenant?: (string | null) | Tenant;
|
|
3239
|
+
order: string | Order;
|
|
3240
|
+
orderItem: string | OrderItem;
|
|
3241
|
+
variant: string | ProductVariant;
|
|
3242
|
+
quantity: number;
|
|
3243
|
+
status: 'held' | 'released' | 'consumed';
|
|
3244
|
+
statusChangedAt?: string | null;
|
|
3245
|
+
updatedAt: string;
|
|
3246
|
+
createdAt: string;
|
|
3247
|
+
deletedAt?: string | null;
|
|
3248
|
+
}
|
|
3249
|
+
/**
|
|
3250
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
3251
|
+
* via the `definition` "shipping-zones".
|
|
3252
|
+
*/
|
|
3253
|
+
interface ShippingZone {
|
|
3254
|
+
id: string;
|
|
3255
|
+
_order?: string | null;
|
|
3256
|
+
tenant?: (string | null) | Tenant;
|
|
3257
|
+
/**
|
|
3258
|
+
* Display name (e.g. Jeju, Remote Islands) for operator reference
|
|
3259
|
+
*/
|
|
3260
|
+
title?: string | null;
|
|
3261
|
+
/**
|
|
3262
|
+
* kind=jeju|remote-islands routes surcharge through shipping-policies fields; kind=custom uses this zone's extraAmount.
|
|
3263
|
+
*/
|
|
3264
|
+
kind: 'jeju' | 'remote-islands' | 'custom';
|
|
3265
|
+
postalCodePatterns: {
|
|
3266
|
+
/**
|
|
3267
|
+
* Postal code prefix (e.g. 230, 525) or numeric range (e.g. 63000-63644)
|
|
3268
|
+
*/
|
|
3269
|
+
pattern: string;
|
|
3270
|
+
id?: string | null;
|
|
3271
|
+
}[];
|
|
3272
|
+
/**
|
|
3273
|
+
* Surcharge applied when kind=custom. Ignored for jeju and remote-islands (those route through shipping-policies).
|
|
3274
|
+
*/
|
|
3275
|
+
extraAmount?: number | null;
|
|
3276
|
+
isActive?: boolean | null;
|
|
3277
|
+
metadata?: {
|
|
3278
|
+
[k: string]: unknown;
|
|
3279
|
+
} | unknown[] | string | number | boolean | null;
|
|
3280
|
+
updatedAt: string;
|
|
3281
|
+
createdAt: string;
|
|
3282
|
+
deletedAt?: string | null;
|
|
3283
|
+
}
|
|
3195
3284
|
/**
|
|
3196
3285
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
3197
3286
|
* via the `definition` "customer-profile-lists".
|
|
@@ -3303,6 +3392,18 @@ interface CartItem {
|
|
|
3303
3392
|
* Price at the time of adding to cart
|
|
3304
3393
|
*/
|
|
3305
3394
|
unitPrice: number;
|
|
3395
|
+
/**
|
|
3396
|
+
* Minor-unit discount allocated to this line from the header discount. Populated by recalculateCartTotals.
|
|
3397
|
+
*/
|
|
3398
|
+
discountAllocation?: number | null;
|
|
3399
|
+
/**
|
|
3400
|
+
* Per-unit price after discount allocation (display). round(discountedTotalPrice / quantity).
|
|
3401
|
+
*/
|
|
3402
|
+
discountedUnitPrice?: number | null;
|
|
3403
|
+
/**
|
|
3404
|
+
* Line total after discount allocation (totalPrice - discountAllocation). Populated by recalculateCartTotals.
|
|
3405
|
+
*/
|
|
3406
|
+
discountedTotalPrice?: number | null;
|
|
3306
3407
|
metadata?: {
|
|
3307
3408
|
[k: string]: unknown;
|
|
3308
3409
|
} | unknown[] | string | number | boolean | null;
|
|
@@ -3403,29 +3504,6 @@ interface Discount {
|
|
|
3403
3504
|
createdAt: string;
|
|
3404
3505
|
deletedAt?: string | null;
|
|
3405
3506
|
}
|
|
3406
|
-
/**
|
|
3407
|
-
* This interface was referenced by `Config`'s JSON-Schema
|
|
3408
|
-
* via the `definition` "promotions".
|
|
3409
|
-
*/
|
|
3410
|
-
interface Promotion {
|
|
3411
|
-
id: string;
|
|
3412
|
-
tenant?: (string | null) | Tenant;
|
|
3413
|
-
/**
|
|
3414
|
-
* Promotion code
|
|
3415
|
-
*/
|
|
3416
|
-
code: string;
|
|
3417
|
-
discountType: 'percent' | 'fixed' | 'free-shipping';
|
|
3418
|
-
/**
|
|
3419
|
-
* Discount value (percent: 0-100, fixed: minor unit)
|
|
3420
|
-
*/
|
|
3421
|
-
discountValue?: number | null;
|
|
3422
|
-
validFrom?: string | null;
|
|
3423
|
-
validUntil?: string | null;
|
|
3424
|
-
status: 'draft' | 'active' | 'paused' | 'expired';
|
|
3425
|
-
updatedAt: string;
|
|
3426
|
-
createdAt: string;
|
|
3427
|
-
deletedAt?: string | null;
|
|
3428
|
-
}
|
|
3429
3507
|
/**
|
|
3430
3508
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
3431
3509
|
* via the `definition` "articles".
|
|
@@ -3516,7 +3594,6 @@ interface Article {
|
|
|
3516
3594
|
* Canonical URL for search engines. Leave empty to use this article URL.
|
|
3517
3595
|
*/
|
|
3518
3596
|
canonicalUrl?: string | null;
|
|
3519
|
-
visibility?: ('public' | 'members' | 'paid') | null;
|
|
3520
3597
|
/**
|
|
3521
3598
|
* Scheduled publish metadata. No automatic publishing job runs from this field.
|
|
3522
3599
|
*/
|
|
@@ -3805,7 +3882,6 @@ interface Playlist {
|
|
|
3805
3882
|
* Short summary for listing/cards
|
|
3806
3883
|
*/
|
|
3807
3884
|
description?: string | null;
|
|
3808
|
-
videos?: (string | Video)[] | null;
|
|
3809
3885
|
categories?: (string | PlaylistCategory)[] | null;
|
|
3810
3886
|
tags?: (string | PlaylistTag)[] | null;
|
|
3811
3887
|
/**
|
|
@@ -3845,8 +3921,6 @@ interface Playlist {
|
|
|
3845
3921
|
};
|
|
3846
3922
|
};
|
|
3847
3923
|
thumbnail?: (string | null) | Image;
|
|
3848
|
-
coverArt?: (string | null) | Image;
|
|
3849
|
-
isCollaborative?: boolean | null;
|
|
3850
3924
|
/**
|
|
3851
3925
|
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
|
3852
3926
|
*/
|
|
@@ -3925,21 +3999,6 @@ interface Track {
|
|
|
3925
3999
|
* Short summary for listing/cards
|
|
3926
4000
|
*/
|
|
3927
4001
|
description?: string | null;
|
|
3928
|
-
content?: {
|
|
3929
|
-
root: {
|
|
3930
|
-
type: string;
|
|
3931
|
-
children: {
|
|
3932
|
-
type: any;
|
|
3933
|
-
version: number;
|
|
3934
|
-
[k: string]: unknown;
|
|
3935
|
-
}[];
|
|
3936
|
-
direction: ('ltr' | 'rtl') | null;
|
|
3937
|
-
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
|
3938
|
-
indent: number;
|
|
3939
|
-
version: number;
|
|
3940
|
-
};
|
|
3941
|
-
[k: string]: unknown;
|
|
3942
|
-
} | null;
|
|
3943
4002
|
artist?: string | null;
|
|
3944
4003
|
album?: string | null;
|
|
3945
4004
|
releaseDate?: string | null;
|
|
@@ -3953,13 +4012,10 @@ interface Track {
|
|
|
3953
4012
|
slug?: string | null;
|
|
3954
4013
|
thumbnail?: (string | null) | Image;
|
|
3955
4014
|
status?: ('draft' | 'published' | 'archived') | null;
|
|
3956
|
-
isFeatured?: boolean | null;
|
|
3957
|
-
publishedAt?: string | null;
|
|
3958
4015
|
/**
|
|
3959
4016
|
* Duration in seconds
|
|
3960
4017
|
*/
|
|
3961
4018
|
durationSeconds?: number | null;
|
|
3962
|
-
isEmbeddable?: boolean | null;
|
|
3963
4019
|
metadata?: {
|
|
3964
4020
|
[k: string]: unknown;
|
|
3965
4021
|
} | unknown[] | string | number | boolean | null;
|
|
@@ -6519,6 +6575,8 @@ interface ProductOptionsSelect<T extends boolean = true> {
|
|
|
6519
6575
|
tenant?: T;
|
|
6520
6576
|
product?: T;
|
|
6521
6577
|
title?: T;
|
|
6578
|
+
generateSlug?: T;
|
|
6579
|
+
slug?: T;
|
|
6522
6580
|
values?: T;
|
|
6523
6581
|
updatedAt?: T;
|
|
6524
6582
|
createdAt?: T;
|
|
@@ -6813,8 +6871,12 @@ interface OrderItemsSelect<T extends boolean = true> {
|
|
|
6813
6871
|
requiresShipping?: T;
|
|
6814
6872
|
totalPrice?: T;
|
|
6815
6873
|
productTitle?: T;
|
|
6874
|
+
optionSelection?: T;
|
|
6816
6875
|
taxRate?: T;
|
|
6817
6876
|
currency?: T;
|
|
6877
|
+
discountAllocation?: T;
|
|
6878
|
+
discountedUnitPrice?: T;
|
|
6879
|
+
discountedTotalPrice?: T;
|
|
6818
6880
|
updatedAt?: T;
|
|
6819
6881
|
createdAt?: T;
|
|
6820
6882
|
deletedAt?: T;
|
|
@@ -6881,6 +6943,22 @@ interface OrderStatusLogsSelect<T extends boolean = true> {
|
|
|
6881
6943
|
updatedAt?: T;
|
|
6882
6944
|
createdAt?: T;
|
|
6883
6945
|
}
|
|
6946
|
+
/**
|
|
6947
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
6948
|
+
* via the `definition` "inventory-reservations_select".
|
|
6949
|
+
*/
|
|
6950
|
+
interface InventoryReservationsSelect<T extends boolean = true> {
|
|
6951
|
+
tenant?: T;
|
|
6952
|
+
order?: T;
|
|
6953
|
+
orderItem?: T;
|
|
6954
|
+
variant?: T;
|
|
6955
|
+
quantity?: T;
|
|
6956
|
+
status?: T;
|
|
6957
|
+
statusChangedAt?: T;
|
|
6958
|
+
updatedAt?: T;
|
|
6959
|
+
createdAt?: T;
|
|
6960
|
+
deletedAt?: T;
|
|
6961
|
+
}
|
|
6884
6962
|
/**
|
|
6885
6963
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
6886
6964
|
* via the `definition` "fulfillments_select".
|
|
@@ -6933,6 +7011,8 @@ interface ReturnsSelect<T extends boolean = true> {
|
|
|
6933
7011
|
completedAt?: T;
|
|
6934
7012
|
refundReceiptUrl?: T;
|
|
6935
7013
|
refundAmount?: T;
|
|
7014
|
+
returnShippingFee?: T;
|
|
7015
|
+
exchangeDifference?: T;
|
|
6936
7016
|
metadata?: T;
|
|
6937
7017
|
updatedAt?: T;
|
|
6938
7018
|
createdAt?: T;
|
|
@@ -6952,6 +7032,7 @@ interface ReturnItemsSelect<T extends boolean = true> {
|
|
|
6952
7032
|
variant?: T;
|
|
6953
7033
|
quantity?: T;
|
|
6954
7034
|
restockAction?: T;
|
|
7035
|
+
restockingFee?: T;
|
|
6955
7036
|
productTitle?: T;
|
|
6956
7037
|
updatedAt?: T;
|
|
6957
7038
|
createdAt?: T;
|
|
@@ -6980,6 +7061,26 @@ interface ShippingPoliciesSelect<T extends boolean = true> {
|
|
|
6980
7061
|
createdAt?: T;
|
|
6981
7062
|
deletedAt?: T;
|
|
6982
7063
|
}
|
|
7064
|
+
/**
|
|
7065
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
7066
|
+
* via the `definition` "shipping-zones_select".
|
|
7067
|
+
*/
|
|
7068
|
+
interface ShippingZonesSelect<T extends boolean = true> {
|
|
7069
|
+
_order?: T;
|
|
7070
|
+
tenant?: T;
|
|
7071
|
+
title?: T;
|
|
7072
|
+
kind?: T;
|
|
7073
|
+
postalCodePatterns?: T | {
|
|
7074
|
+
pattern?: T;
|
|
7075
|
+
id?: T;
|
|
7076
|
+
};
|
|
7077
|
+
extraAmount?: T;
|
|
7078
|
+
isActive?: T;
|
|
7079
|
+
metadata?: T;
|
|
7080
|
+
updatedAt?: T;
|
|
7081
|
+
createdAt?: T;
|
|
7082
|
+
deletedAt?: T;
|
|
7083
|
+
}
|
|
6983
7084
|
/**
|
|
6984
7085
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
6985
7086
|
* via the `definition` "customers_select".
|
|
@@ -7205,6 +7306,9 @@ interface CartItemsSelect<T extends boolean = true> {
|
|
|
7205
7306
|
variant?: T;
|
|
7206
7307
|
quantity?: T;
|
|
7207
7308
|
unitPrice?: T;
|
|
7309
|
+
discountAllocation?: T;
|
|
7310
|
+
discountedUnitPrice?: T;
|
|
7311
|
+
discountedTotalPrice?: T;
|
|
7208
7312
|
metadata?: T;
|
|
7209
7313
|
updatedAt?: T;
|
|
7210
7314
|
createdAt?: T;
|
|
@@ -7255,22 +7359,6 @@ interface DiscountsSelect<T extends boolean = true> {
|
|
|
7255
7359
|
createdAt?: T;
|
|
7256
7360
|
deletedAt?: T;
|
|
7257
7361
|
}
|
|
7258
|
-
/**
|
|
7259
|
-
* This interface was referenced by `Config`'s JSON-Schema
|
|
7260
|
-
* via the `definition` "promotions_select".
|
|
7261
|
-
*/
|
|
7262
|
-
interface PromotionsSelect<T extends boolean = true> {
|
|
7263
|
-
tenant?: T;
|
|
7264
|
-
code?: T;
|
|
7265
|
-
discountType?: T;
|
|
7266
|
-
discountValue?: T;
|
|
7267
|
-
validFrom?: T;
|
|
7268
|
-
validUntil?: T;
|
|
7269
|
-
status?: T;
|
|
7270
|
-
updatedAt?: T;
|
|
7271
|
-
createdAt?: T;
|
|
7272
|
-
deletedAt?: T;
|
|
7273
|
-
}
|
|
7274
7362
|
/**
|
|
7275
7363
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
7276
7364
|
* via the `definition` "articles_select".
|
|
@@ -7307,7 +7395,6 @@ interface ArticlesSelect<T extends boolean = true> {
|
|
|
7307
7395
|
readingMinutes?: T;
|
|
7308
7396
|
excerpt?: T;
|
|
7309
7397
|
canonicalUrl?: T;
|
|
7310
|
-
visibility?: T;
|
|
7311
7398
|
scheduledAt?: T;
|
|
7312
7399
|
featuredUntil?: T;
|
|
7313
7400
|
relatedArticles?: T;
|
|
@@ -7466,7 +7553,6 @@ interface PlaylistsSelect<T extends boolean = true> {
|
|
|
7466
7553
|
title?: T;
|
|
7467
7554
|
subtitle?: T;
|
|
7468
7555
|
description?: T;
|
|
7469
|
-
videos?: T;
|
|
7470
7556
|
categories?: T;
|
|
7471
7557
|
tags?: T;
|
|
7472
7558
|
tracks?: T;
|
|
@@ -7482,8 +7568,6 @@ interface PlaylistsSelect<T extends boolean = true> {
|
|
|
7482
7568
|
};
|
|
7483
7569
|
};
|
|
7484
7570
|
thumbnail?: T;
|
|
7485
|
-
coverArt?: T;
|
|
7486
|
-
isCollaborative?: T;
|
|
7487
7571
|
generateSlug?: T;
|
|
7488
7572
|
slug?: T;
|
|
7489
7573
|
status?: T;
|
|
@@ -7539,7 +7623,6 @@ interface TracksSelect<T extends boolean = true> {
|
|
|
7539
7623
|
tenant?: T;
|
|
7540
7624
|
title?: T;
|
|
7541
7625
|
description?: T;
|
|
7542
|
-
content?: T;
|
|
7543
7626
|
artist?: T;
|
|
7544
7627
|
album?: T;
|
|
7545
7628
|
releaseDate?: T;
|
|
@@ -7550,10 +7633,7 @@ interface TracksSelect<T extends boolean = true> {
|
|
|
7550
7633
|
slug?: T;
|
|
7551
7634
|
thumbnail?: T;
|
|
7552
7635
|
status?: T;
|
|
7553
|
-
isFeatured?: T;
|
|
7554
|
-
publishedAt?: T;
|
|
7555
7636
|
durationSeconds?: T;
|
|
7556
|
-
isEmbeddable?: T;
|
|
7557
7637
|
metadata?: T;
|
|
7558
7638
|
sourceUrl?: T;
|
|
7559
7639
|
sourceProvider?: T;
|
package/dist/realtime.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/realtime.ts","../src/core/query/realtime-hooks.ts","../src/core/query/realtime.ts","../src/core/client/types.ts","../src/core/query/query-keys.ts"],"sourcesContent":["export { useRealtimeQuery } from './core/query/realtime-hooks'\nexport type {\n UseRealtimeQueryOptions,\n UseRealtimeQueryResult,\n RealtimeEvent,\n} from './core/query/realtime-hooks'\nexport { RealtimeConnection, type RealtimeListener } from './core/query/realtime'\n","import { useEffect, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { RealtimeConnection, type RealtimeEvent } from './realtime'\nimport { resolveApiUrl, type PublicCollection } from '../client/types'\nimport { collectionKeys } from './query-keys'\n\nexport type { RealtimeEvent }\n\nexport interface UseRealtimeQueryOptions {\n /** Filter events to specific collections. Empty/undefined = all collections. */\n collections?: PublicCollection[]\n /** Enable/disable the SSE connection. Default: true. */\n enabled?: boolean\n}\n\nexport interface UseRealtimeQueryResult {\n /** Whether the SSE connection is currently active. */\n connected: boolean\n /** The last received event, or null. */\n lastEvent: RealtimeEvent | null\n}\n\n/**\n * React hook that subscribes to real-time collection change events via SSE.\n * Automatically invalidates React Query cache when changes are detected.\n *\n * @example\n * ```tsx\n * const { connected } = useRealtimeQuery({\n * publishableKey: 'your-key',\n * getToken: () => client.customer.getToken(),\n * collections: ['products', 'orders'],\n * })\n * ```\n */\nexport function useRealtimeQuery(options: {\n publishableKey: string\n getToken: () => string | null\n collections?: PublicCollection[]\n enabled?: boolean\n}): UseRealtimeQueryResult {\n const { getToken, collections, enabled = true } = options\n const publishableKey = options.publishableKey\n const queryClient = useQueryClient()\n const [connected, setConnected] = useState(false)\n const [lastEvent, setLastEvent] = useState<RealtimeEvent | null>(null)\n const connectionRef = useRef<RealtimeConnection | null>(null)\n\n useEffect(() => {\n if (!enabled || !publishableKey) return\n\n const baseUrl = resolveApiUrl()\n const conn = new RealtimeConnection(\n baseUrl,\n publishableKey,\n getToken,\n collections,\n )\n connectionRef.current = conn\n\n // Listen for events and invalidate queries\n const removeListener = conn.addListener((event) => {\n setLastEvent(event)\n\n // Invalidate all queries for the changed collection\n const keys = collectionKeys(event.collection as PublicCollection)\n queryClient.invalidateQueries({ queryKey: keys.all })\n })\n\n // Track connection state\n const pollInterval = setInterval(() => {\n setConnected(conn.connected)\n }, 1000)\n\n conn.connect()\n\n return () => {\n conn.disconnect()\n removeListener()\n clearInterval(pollInterval)\n connectionRef.current = null\n setConnected(false)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [publishableKey, enabled, collections?.join(',')])\n\n return { connected, lastEvent }\n}\n","/**\n * Fetch-based SSE connection manager for real-time collection change events.\n * Uses fetch + ReadableStream to support custom auth headers (unlike native EventSource).\n */\n\nexport interface RealtimeEvent {\n collection: string\n operation: string\n id: string | null\n timestamp: string\n}\n\nexport type RealtimeListener = (event: RealtimeEvent) => void\n\nconst INITIAL_RECONNECT_DELAY = 1_000\nconst MAX_RECONNECT_DELAY = 30_000\nconst RECONNECT_BACKOFF_FACTOR = 2\nconst MAX_NO_TOKEN_RETRIES = 5\n\nexport class RealtimeConnection {\n private abortController: AbortController | null = null\n private reconnectAttempt = 0\n private noTokenAttempts = 0\n private reconnectTimer: ReturnType<typeof setTimeout> | null = null\n private listeners = new Set<RealtimeListener>()\n private _connected = false\n\n constructor(\n private baseUrl: string,\n private publishableKey: string,\n private getToken: () => string | null,\n private collections?: string[],\n ) {}\n\n get connected(): boolean {\n return this._connected\n }\n\n addListener(fn: RealtimeListener): () => void {\n this.listeners.add(fn)\n return () => this.listeners.delete(fn)\n }\n\n connect(): void {\n if (this.abortController) return // Already connecting/connected\n\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }\n\n disconnect(): void {\n this._connected = false\n if (this.reconnectTimer) {\n clearTimeout(this.reconnectTimer)\n this.reconnectTimer = null\n }\n if (this.abortController) {\n this.abortController.abort()\n this.abortController = null\n }\n this.reconnectAttempt = 0\n this.noTokenAttempts = 0\n }\n\n private async startStream(signal: AbortSignal): Promise<void> {\n const token = this.getToken()\n if (!token) {\n this.noTokenAttempts++\n if (this.noTokenAttempts >= MAX_NO_TOKEN_RETRIES) {\n // Stop reconnecting — no token available after multiple attempts\n this._connected = false\n this.abortController = null\n return\n }\n this.scheduleReconnect()\n return\n }\n this.noTokenAttempts = 0\n\n const params = this.collections?.length\n ? `?collections=${this.collections.join(',')}`\n : ''\n const url = `${this.baseUrl}/api/events/stream${params}`\n\n try {\n const response = await fetch(url, {\n headers: {\n 'X-Publishable-Key': this.publishableKey,\n Authorization: `Bearer ${token}`,\n },\n signal,\n })\n\n if (!response.ok) {\n if (response.status === 401) {\n // Token expired — try reconnecting (will get fresh token)\n this.scheduleReconnect()\n return\n }\n throw new Error(`SSE connection failed: ${response.status}`)\n }\n\n if (!response.body) {\n throw new Error('SSE response has no body')\n }\n\n this._connected = true\n this.reconnectAttempt = 0\n\n await this.readStream(response.body, signal)\n } catch {\n if (signal.aborted) return // Intentional disconnect\n this._connected = false\n this.scheduleReconnect()\n }\n }\n\n private async readStream(\n body: ReadableStream<Uint8Array>,\n signal: AbortSignal,\n ): Promise<void> {\n const reader = body.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n let currentEvent = ''\n let currentData = ''\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done || signal.aborted) break\n\n buffer += decoder.decode(value, { stream: true })\n const lines = buffer.split('\\n')\n buffer = lines.pop() ?? '' // Keep incomplete last line in buffer\n\n for (const line of lines) {\n if (line.startsWith('event: ')) {\n currentEvent = line.slice(7)\n } else if (line.startsWith('data: ')) {\n currentData += (currentData ? '\\n' : '') + line.slice(6)\n } else if (line === '') {\n // Empty line = end of event\n if (currentEvent === 'collection:change' && currentData) {\n try {\n const event: RealtimeEvent = JSON.parse(currentData)\n for (const listener of this.listeners) {\n try {\n listener(event)\n } catch {\n // Listener error — ignore\n }\n }\n } catch {\n // Malformed JSON — ignore\n }\n }\n currentEvent = ''\n currentData = ''\n }\n // Ignore comment lines (: heartbeat)\n }\n }\n } catch {\n // Stream read error\n } finally {\n reader.releaseLock()\n this._connected = false\n if (!signal.aborted) {\n this.scheduleReconnect()\n }\n }\n }\n\n private scheduleReconnect(): void {\n if (this.reconnectTimer) return\n\n const delay = Math.min(\n INITIAL_RECONNECT_DELAY *\n Math.pow(RECONNECT_BACKOFF_FACTOR, this.reconnectAttempt),\n MAX_RECONNECT_DELAY,\n )\n this.reconnectAttempt++\n\n this.reconnectTimer = setTimeout(() => {\n this.reconnectTimer = null\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }, delay)\n }\n}\n","import type { Sort, Where } from 'payload'\n\nimport type {\n Collection,\n PublicCollection,\n ServerCollection,\n ServerOnlyCollection,\n} from '../collection/const'\n\nexport type {\n Collection,\n PublicCollection,\n ServerCollection,\n ServerOnlyCollection,\n}\n\n// ============================================================================\n// API URL Configuration\n// ============================================================================\n\ndeclare const __DEFAULT_API_URL__: string\n\nexport function resolveApiUrl(): string {\n if (typeof process !== 'undefined' && process.env) {\n const envUrl =\n process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL\n if (envUrl) {\n return envUrl.replace(/\\/$/, '')\n }\n }\n return __DEFAULT_API_URL__\n}\n\n// ============================================================================\n// Client Configuration\n// ============================================================================\n\nexport interface ClientConfig {\n publishableKey: string\n /**\n * Customer authentication options.\n * Used to initialize CustomerAuth on Client.\n */\n customer?: {\n /**\n * Persist token in localStorage. Defaults to `true`.\n * - `true` (default): uses key `'customer-token'`\n * - `string`: uses the given string as localStorage key\n * - `false`: disables persistence (token/onTokenChange used instead)\n *\n * Handles SSR safely (no-op on server).\n * When enabled, `token` and `onTokenChange` are ignored.\n */\n persist?: boolean | string\n /** Initial token (e.g. from SSR cookie) */\n token?: string\n /** Called when token changes (login/logout) — use to persist in localStorage/cookie */\n onTokenChange?: (token: string | null) => void\n }\n}\n\n// Server client: requires both publishableKey (for CDN routing + rate limit +\n// monthly quota enforcement via the edge proxy) and secretKey (sk01_ opaque\n// bearer token, the authentication credential).\n// The proxy keys its tenant lookup off `X-Publishable-Key`, so omitting\n// publishableKey would silently bypass rate limiting and plan-based quota\n// enforcement.\nexport interface ClientServerConfig extends ClientConfig {\n secretKey: string\n}\n\nexport interface ClientMetadata {\n userAgent?: string\n timestamp: number\n}\n\nexport interface ClientState {\n metadata: ClientMetadata\n}\n\nexport interface PaginationMeta {\n page: number\n limit: number\n totalDocs: number\n totalPages: number\n hasNextPage: boolean\n hasPrevPage: boolean\n pagingCounter: number\n prevPage: number | null\n nextPage: number | null\n}\n\n// ============================================================================\n// Payload CMS Native Response Types\n// ============================================================================\n\n/**\n * Payload CMS Find (List) Response\n * GET /api/{collection}\n */\nexport interface PayloadFindResponse<T = unknown> {\n docs: T[]\n totalDocs: number\n limit: number\n totalPages: number\n page: number\n pagingCounter: number\n hasPrevPage: boolean\n hasNextPage: boolean\n prevPage: number | null\n nextPage: number | null\n}\n\n/**\n * Payload CMS Create/Update Response\n * POST /api/{collection}\n * PATCH /api/{collection}/{id}\n */\nexport interface PayloadMutationResponse<T = unknown> {\n message: string\n doc: T\n errors?: unknown[]\n}\n\n// ============================================================================\n// Query Options\n// ============================================================================\n\n/**\n * Do NOT replace with `Pick<FindOptions>` from `payload`. Payload's generic\n * types (`JoinQuery<TSlug>`, `PopulateType`) depend on `PayloadTypes` module\n * augmentation; external SDK consumers who skip that get degenerate types\n * (`never` / `{}`). Only non-generic `Sort`/`Where` are safe to import.\n * Excluded vs native: Local-API-only fields, `locale`/`fallbackLocale`.\n */\nexport interface ApiQueryOptions {\n page?: number\n limit?: number\n sort?: Sort\n where?: Where\n depth?: number\n select?: Record<string, boolean>\n /** Per-collection field selection for populated relationships (keyed by collection slug) */\n populate?: Record<string, boolean | Record<string, boolean>>\n /** Join field control: pagination/filter per join, or false to disable */\n joins?:\n | Record<\n string,\n | {\n limit?: number\n page?: number\n sort?: string\n where?: Where\n count?: boolean\n }\n | false\n >\n | false\n /** Set to `false` to skip the count query — returns docs without totalDocs/totalPages */\n pagination?: boolean\n /** Include draft versions (access control still applies on the server) */\n draft?: boolean\n /** Include soft-deleted documents (requires `trash` enabled on the collection) */\n trash?: boolean\n}\n\n// ============================================================================\n// Debug & Retry Configuration\n// ============================================================================\n\nexport interface DebugConfig {\n logRequests?: boolean\n logResponses?: boolean\n logErrors?: boolean\n}\n\nexport interface RetryConfig {\n maxRetries?: number\n retryableStatuses?: number[]\n retryDelay?: (attempt: number) => number\n}\n\n// ============================================================================\n// Type Utilities\n// ============================================================================\n\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]\n}\n\nexport type ExtractArrayType<T> = T extends (infer U)[] ? U : never\n","import type { PublicCollection, ApiQueryOptions } from '../client/types'\nimport type { ProductListingGroupsQueryOptions } from './query-hooks'\n\nexport function collectionKeys<T extends PublicCollection>(collection: T) {\n return {\n all: [collection] as const,\n lists: () => [collection, 'list'] as const,\n list: (options?: ApiQueryOptions) => [collection, 'list', options] as const,\n details: () => [collection, 'detail'] as const,\n detail: (id: string, options?: ApiQueryOptions) =>\n [collection, 'detail', id, options] as const,\n infinites: () => [collection, 'infinite'] as const,\n infinite: (options?: Omit<ApiQueryOptions, 'page'>) =>\n [collection, 'infinite', options] as const,\n }\n}\n\nexport const customerKeys = {\n all: ['customer'] as const,\n me: () => ['customer', 'me'] as const,\n}\n\nexport const productKeys = {\n listingGroups: (options?: ProductListingGroupsQueryOptions) =>\n ['products', 'listing-groups', 'list', options] as const,\n listingGroupsInfinite: (\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>,\n ) =>\n ['products', 'listing-groups', 'infinite', options] as const,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA4C;AAC5C,yBAA+B;;;ACa/B,IAAM,0BAA0B;AAChC,IAAM,sBAAsB;AAC5B,IAAM,2BAA2B;AACjC,IAAM,uBAAuB;AAEtB,IAAM,qBAAN,MAAyB;AAAA,EAQ9B,YACU,SACA,gBACA,UACA,aACR;AAJQ;AACA;AACA;AACA;AAXV,SAAQ,kBAA0C;AAClD,SAAQ,mBAAmB;AAC3B,SAAQ,kBAAkB;AAC1B,SAAQ,iBAAuD;AAC/D,SAAQ,YAAY,oBAAI,IAAsB;AAC9C,SAAQ,aAAa;AAAA,EAOlB;AAAA,EAEH,IAAI,YAAqB;AACvB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAY,IAAkC;AAC5C,SAAK,UAAU,IAAI,EAAE;AACrB,WAAO,MAAM,KAAK,U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eAAgB;AAEjC,UAAM,UAAU,cAAc;AAC9B,UAAM,OAAO,IAAI;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,kBAAc,UAAU;AAGxB,UAAM,iBAAiB,KAAK,YAAY,CAAC,UAAU;AACjD,mBAAa,KAAK;AAGlB,YAAM,OAAO,eAAe,MAAM,UAA8B;AAChE,kBAAY,kBAAkB,EAAE,UAAU,KAAK,IAAI,CAAC;AAAA,IACtD,CAAC;AAGD,UAAM,eAAe,YAAY,MAAM;AACrC,mBAAa,KAAK,SAAS;AAAA,IAC7B,GAAG,GAAI;AAEP,SAAK,QAAQ;AAEb,WAAO,MAAM;AACX,WAAK,WAAW;AAChB,qBAAe;AACf,oBAAc,YAAY;AAC1B,oBAAc,UAAU;AACxB,mBAAa,KAAK;AAAA,IACpB;AAAA,EAEF,GAAG,CAAC,gBAAgB,SAAS,aAAa,KAAK,GAAG,CAAC,CAAC;AAEpD,SAAO,EAAE,WAAW,UAAU;AAChC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/realtime.ts","../src/core/query/realtime-hooks.ts","../src/core/query/realtime.ts","../src/core/client/types.ts","../src/core/query/query-keys.ts"],"sourcesContent":["export { useRealtimeQuery } from './core/query/realtime-hooks'\nexport type {\n UseRealtimeQueryOptions,\n UseRealtimeQueryResult,\n RealtimeEvent,\n} from './core/query/realtime-hooks'\nexport { RealtimeConnection, type RealtimeListener } from './core/query/realtime'\n","import { useEffect, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { RealtimeConnection, type RealtimeEvent } from './realtime'\nimport { resolveApiUrl, type PublicCollection } from '../client/types'\nimport { collectionKeys } from './query-keys'\n\nexport type { RealtimeEvent }\n\nexport interface UseRealtimeQueryOptions {\n /** Filter events to specific collections. Empty/undefined = all collections. */\n collections?: PublicCollection[]\n /** Enable/disable the SSE connection. Default: true. */\n enabled?: boolean\n}\n\nexport interface UseRealtimeQueryResult {\n /** Whether the SSE connection is currently active. */\n connected: boolean\n /** The last received event, or null. */\n lastEvent: RealtimeEvent | null\n}\n\n/**\n * React hook that subscribes to real-time collection change events via SSE.\n * Automatically invalidates React Query cache when changes are detected.\n *\n * @example\n * ```tsx\n * const { connected } = useRealtimeQuery({\n * publishableKey: 'your-key',\n * getToken: () => client.customer.getToken(),\n * collections: ['products', 'orders'],\n * })\n * ```\n */\nexport function useRealtimeQuery(options: {\n publishableKey: string\n getToken: () => string | null\n collections?: PublicCollection[]\n enabled?: boolean\n}): UseRealtimeQueryResult {\n const { getToken, collections, enabled = true } = options\n const publishableKey = options.publishableKey\n const queryClient = useQueryClient()\n const [connected, setConnected] = useState(false)\n const [lastEvent, setLastEvent] = useState<RealtimeEvent | null>(null)\n const connectionRef = useRef<RealtimeConnection | null>(null)\n\n useEffect(() => {\n if (!enabled || !publishableKey) return\n\n const baseUrl = resolveApiUrl()\n const conn = new RealtimeConnection(\n baseUrl,\n publishableKey,\n getToken,\n collections,\n )\n connectionRef.current = conn\n\n // Listen for events and invalidate queries\n const removeListener = conn.addListener((event) => {\n setLastEvent(event)\n\n // Invalidate all queries for the changed collection\n const keys = collectionKeys(event.collection as PublicCollection)\n queryClient.invalidateQueries({ queryKey: keys.all })\n })\n\n // Track connection state\n const pollInterval = setInterval(() => {\n setConnected(conn.connected)\n }, 1000)\n\n conn.connect()\n\n return () => {\n conn.disconnect()\n removeListener()\n clearInterval(pollInterval)\n connectionRef.current = null\n setConnected(false)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [publishableKey, enabled, collections?.join(',')])\n\n return { connected, lastEvent }\n}\n","/**\n * Fetch-based SSE connection manager for real-time collection change events.\n * Uses fetch + ReadableStream to support custom auth headers (unlike native EventSource).\n */\n\nexport interface RealtimeEvent {\n collection: string\n operation: string\n id: string | null\n timestamp: string\n}\n\nexport type RealtimeListener = (event: RealtimeEvent) => void\n\nconst INITIAL_RECONNECT_DELAY = 1_000\nconst MAX_RECONNECT_DELAY = 30_000\nconst RECONNECT_BACKOFF_FACTOR = 2\nconst MAX_NO_TOKEN_RETRIES = 5\n\nexport class RealtimeConnection {\n private abortController: AbortController | null = null\n private reconnectAttempt = 0\n private noTokenAttempts = 0\n private reconnectTimer: ReturnType<typeof setTimeout> | null = null\n private listeners = new Set<RealtimeListener>()\n private _connected = false\n\n constructor(\n private baseUrl: string,\n private publishableKey: string,\n private getToken: () => string | null,\n private collections?: string[],\n ) {}\n\n get connected(): boolean {\n return this._connected\n }\n\n addListener(fn: RealtimeListener): () => void {\n this.listeners.add(fn)\n return () => this.listeners.delete(fn)\n }\n\n connect(): void {\n if (this.abortController) return // Already connecting/connected\n\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }\n\n disconnect(): void {\n this._connected = false\n if (this.reconnectTimer) {\n clearTimeout(this.reconnectTimer)\n this.reconnectTimer = null\n }\n if (this.abortController) {\n this.abortController.abort()\n this.abortController = null\n }\n this.reconnectAttempt = 0\n this.noTokenAttempts = 0\n }\n\n private async startStream(signal: AbortSignal): Promise<void> {\n const token = this.getToken()\n if (!token) {\n this.noTokenAttempts++\n if (this.noTokenAttempts >= MAX_NO_TOKEN_RETRIES) {\n // Stop reconnecting — no token available after multiple attempts\n this._connected = false\n this.abortController = null\n return\n }\n this.scheduleReconnect()\n return\n }\n this.noTokenAttempts = 0\n\n const params = this.collections?.length\n ? `?collections=${this.collections.join(',')}`\n : ''\n const url = `${this.baseUrl}/api/events/stream${params}`\n\n try {\n const response = await fetch(url, {\n headers: {\n 'X-Publishable-Key': this.publishableKey,\n Authorization: `Bearer ${token}`,\n },\n signal,\n })\n\n if (!response.ok) {\n if (response.status === 401) {\n // Token expired — try reconnecting (will get fresh token)\n this.scheduleReconnect()\n return\n }\n throw new Error(`SSE connection failed: ${response.status}`)\n }\n\n if (!response.body) {\n throw new Error('SSE response has no body')\n }\n\n this._connected = true\n this.reconnectAttempt = 0\n\n await this.readStream(response.body, signal)\n } catch {\n if (signal.aborted) return // Intentional disconnect\n this._connected = false\n this.scheduleReconnect()\n }\n }\n\n private async readStream(\n body: ReadableStream<Uint8Array>,\n signal: AbortSignal,\n ): Promise<void> {\n const reader = body.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n let currentEvent = ''\n let currentData = ''\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done || signal.aborted) break\n\n buffer += decoder.decode(value, { stream: true })\n const lines = buffer.split('\\n')\n buffer = lines.pop() ?? '' // Keep incomplete last line in buffer\n\n for (const line of lines) {\n if (line.startsWith('event: ')) {\n currentEvent = line.slice(7)\n } else if (line.startsWith('data: ')) {\n currentData += (currentData ? '\\n' : '') + line.slice(6)\n } else if (line === '') {\n // Empty line = end of event\n if (currentEvent === 'collection:change' && currentData) {\n try {\n const event: RealtimeEvent = JSON.parse(currentData)\n for (const listener of this.listeners) {\n try {\n listener(event)\n } catch {\n // Listener error — ignore\n }\n }\n } catch {\n // Malformed JSON — ignore\n }\n }\n currentEvent = ''\n currentData = ''\n }\n // Ignore comment lines (: heartbeat)\n }\n }\n } catch {\n // Stream read error\n } finally {\n reader.releaseLock()\n this._connected = false\n if (!signal.aborted) {\n this.scheduleReconnect()\n }\n }\n }\n\n private scheduleReconnect(): void {\n if (this.reconnectTimer) return\n\n const delay = Math.min(\n INITIAL_RECONNECT_DELAY *\n Math.pow(RECONNECT_BACKOFF_FACTOR, this.reconnectAttempt),\n MAX_RECONNECT_DELAY,\n )\n this.reconnectAttempt++\n\n this.reconnectTimer = setTimeout(() => {\n this.reconnectTimer = null\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }, delay)\n }\n}\n","import type { Sort, Where } from 'payload'\n\nimport type {\n Collection,\n PublicCollection,\n ServerCollection,\n ServerOnlyCollection,\n} from '../collection/const'\n\nexport type {\n Collection,\n PublicCollection,\n ServerCollection,\n ServerOnlyCollection,\n}\n\n// ============================================================================\n// API URL Configuration\n// ============================================================================\n\ndeclare const __DEFAULT_API_URL__: string\n\nexport function resolveApiUrl(): string {\n if (typeof process !== 'undefined' && process.env) {\n const envUrl =\n process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL\n if (envUrl) {\n return envUrl.replace(/\\/$/, '')\n }\n }\n return __DEFAULT_API_URL__\n}\n\n// ============================================================================\n// Client Configuration\n// ============================================================================\n\nexport interface ClientConfig {\n publishableKey: string\n /**\n * Customer authentication options.\n * Used to initialize CustomerAuth on Client.\n */\n customer?: {\n /**\n * Persist token in localStorage. Defaults to `true`.\n * - `true` (default): uses key `'customer-token'`\n * - `string`: uses the given string as localStorage key\n * - `false`: disables persistence (token/onTokenChange used instead)\n *\n * Handles SSR safely (no-op on server).\n * When enabled, `token` and `onTokenChange` are ignored.\n */\n persist?: boolean | string\n /** Initial token (e.g. from SSR cookie) */\n token?: string\n /** Called when token changes (login/logout) — use to persist in localStorage/cookie */\n onTokenChange?: (token: string | null) => void\n }\n}\n\n// Server client: requires both publishableKey (for CDN routing + rate limit +\n// monthly quota enforcement via the edge proxy) and secretKey (sk01_ opaque\n// bearer token, the authentication credential).\n// The proxy keys its tenant lookup off `X-Publishable-Key`, so omitting\n// publishableKey would silently bypass rate limiting and plan-based quota\n// enforcement.\nexport interface ClientServerConfig extends ClientConfig {\n secretKey: string\n}\n\nexport interface ClientMetadata {\n userAgent?: string\n timestamp: number\n}\n\nexport interface ClientState {\n metadata: ClientMetadata\n}\n\nexport interface PaginationMeta {\n page: number\n limit: number\n totalDocs: number\n totalPages: number\n hasNextPage: boolean\n hasPrevPage: boolean\n pagingCounter: number\n prevPage: number | null\n nextPage: number | null\n}\n\n// ============================================================================\n// Payload CMS Native Response Types\n// ============================================================================\n\n/**\n * Payload CMS Find (List) Response\n * GET /api/{collection}\n */\nexport interface PayloadFindResponse<T = unknown> {\n docs: T[]\n totalDocs: number\n limit: number\n totalPages: number\n page: number\n pagingCounter: number\n hasPrevPage: boolean\n hasNextPage: boolean\n prevPage: number | null\n nextPage: number | null\n}\n\n/**\n * Payload CMS Create/Update Response\n * POST /api/{collection}\n * PATCH /api/{collection}/{id}\n */\nexport interface PayloadMutationResponse<T = unknown> {\n message: string\n doc: T\n errors?: unknown[]\n}\n\n// ============================================================================\n// Query Options\n// ============================================================================\n\n/**\n * Do NOT replace with `Pick<FindOptions>` from `payload`. Payload's generic\n * types (`JoinQuery<TSlug>`, `PopulateType`) depend on `PayloadTypes` module\n * augmentation; external SDK consumers who skip that get degenerate types\n * (`never` / `{}`). Only non-generic `Sort`/`Where` are safe to import.\n * Excluded vs native: Local-API-only fields, `locale`/`fallbackLocale`.\n */\nexport interface ApiQueryOptions {\n page?: number\n limit?: number\n sort?: Sort\n /**\n * Filter documents. Id-based relation filters (`where: { product: { equals: id } }`) are the\n * most reliable pattern. Dotted-path relation filters (`where: { 'product.slug': { equals } }`)\n * are Payload-native but may silently return empty when access control restricts the related\n * document or when the relation is polymorphic. String shorthand (`where: { slug: 'x' }`)\n * silently matches nothing — always use `{ slug: { equals: 'x' } }`.\n */\n where?: Where\n /**\n * Controls how deeply relationship fields are populated. This is the primary control for\n * populating relationships like `category`, `images`, `brand`. The configured Payload default\n * applies when unset.\n */\n depth?: number\n select?: Record<string, boolean>\n /**\n * Controls which fields are returned for already-populated relationships, keyed by collection\n * slug. Does NOT control which relationships to populate — that is `depth`.\n *\n * @example\n * // depth: 2 populates category; populate trims which fields come back\n * populate: { categories: { title: true, slug: true } }\n */\n populate?: Record<string, boolean | Record<string, boolean>>\n /**\n * Controls Payload `type: 'join'` virtual reverse-relation fields only (pagination, sort,\n * filter, count per join field, or `false` to disable all join-field population).\n *\n * Does NOT populate normal relationship fields like `category`, `images`, or `brand`.\n * For normal relationship population use `depth` (and optionally `populate` for field\n * selection).\n *\n * Pass `joins: false` to disable all join-field population — useful for lightweight list\n * queries where join fields are not needed.\n *\n * @example\n * // `article-authors` has a `type: 'join'` field `articles` (reverse-relation)\n * joins: { articles: { limit: 10, sort: '-publishedAt' } }\n *\n * // depth: 2 populates product.category — joins has no effect on this\n * depth: 2\n *\n * // Disable all join-field population\n * joins: false\n */\n joins?:\n | Record<\n string,\n | {\n limit?: number\n page?: number\n sort?: string\n where?: Where\n count?: boolean\n }\n | false\n >\n | false\n /** Set to `false` to skip the count query — returns docs without totalDocs/totalPages */\n pagination?: boolean\n /** Include draft versions (access control still applies on the server) */\n draft?: boolean\n /** Include soft-deleted documents (requires `trash` enabled on the collection) */\n trash?: boolean\n}\n\n// ============================================================================\n// Debug & Retry Configuration\n// ============================================================================\n\nexport interface DebugConfig {\n logRequests?: boolean\n logResponses?: boolean\n logErrors?: boolean\n}\n\nexport interface RetryConfig {\n maxRetries?: number\n retryableStatuses?: number[]\n retryDelay?: (attempt: number) => number\n}\n\n// ============================================================================\n// Type Utilities\n// ============================================================================\n\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]\n}\n\nexport type ExtractArrayType<T> = T extends (infer U)[] ? U : never\n","import type { PublicCollection, ApiQueryOptions } from '../client/types'\nimport type { ProductListingGroupsQueryOptions } from './query-hooks'\n\nexport function collectionKeys<T extends PublicCollection>(collection: T) {\n return {\n all: [collection] as const,\n lists: () => [collection, 'list'] as const,\n list: (options?: ApiQueryOptions) => [collection, 'list', options] as const,\n details: () => [collection, 'detail'] as const,\n detail: (id: string, options?: ApiQueryOptions) =>\n [collection, 'detail', id, options] as const,\n infinites: () => [collection, 'infinite'] as const,\n infinite: (options?: Omit<ApiQueryOptions, 'page'>) =>\n [collection, 'infinite', options] as const,\n }\n}\n\nexport const customerKeys = {\n all: ['customer'] as const,\n me: () => ['customer', 'me'] as const,\n}\n\nexport const productKeys = {\n listingGroups: (options?: ProductListingGroupsQueryOptions) =>\n ['products', 'listing-groups', 'list', options] as const,\n listingGroupsInfinite: (\n options?: Omit<ProductListingGroupsQueryOptions, 'page' | 'limit'>,\n ) =>\n ['products', 'listing-groups', 'infinite', options] as const,\n detail: (params: { slug: string } | { id: string }) =>\n ['products', 'detail', params] as const,\n detailAll: () => ['products', 'detail'] as const,\n}\n"],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@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { R as RealtimeEvent } from './realtime-D7HtUpqt.cjs';
|
|
2
2
|
export { a as RealtimeConnection, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
|
|
3
|
-
import { P as PublicCollection } from './const-
|
|
4
|
-
import './payload-types-
|
|
3
|
+
import { P as PublicCollection } from './const-Dsixdi6z.cjs';
|
|
4
|
+
import './payload-types-Ci-ZA7aM.cjs';
|
|
5
5
|
|
|
6
6
|
interface UseRealtimeQueryOptions {
|
|
7
7
|
/** Filter events to specific collections. Empty/undefined = all collections. */
|
package/dist/realtime.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { R as RealtimeEvent } from './realtime-D7HtUpqt.js';
|
|
2
2
|
export { a as RealtimeConnection, b as RealtimeListener } from './realtime-D7HtUpqt.js';
|
|
3
|
-
import { P as PublicCollection } from './const-
|
|
4
|
-
import './payload-types-
|
|
3
|
+
import { P as PublicCollection } from './const-DAjQYNuM.js';
|
|
4
|
+
import './payload-types-Ci-ZA7aM.js';
|
|
5
5
|
|
|
6
6
|
interface UseRealtimeQueryOptions {
|
|
7
7
|
/** Filter events to specific collections. Empty/undefined = all collections. */
|