@01.software/sdk 0.5.9 → 0.6.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 +12 -0
- package/dist/auth.d.cts +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/{const-EdTT21dc.d.ts → const-Bk3-zigV.d.ts} +2 -2
- package/dist/{const-rK0y0s2r.d.cts → const-DQZQAXex.d.cts} +2 -2
- package/dist/index.cjs +210 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +207 -8
- package/dist/index.d.ts +207 -8
- package/dist/index.js +210 -3
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-D70l0uF9.d.cts → payload-types-DCVm1syH.d.cts} +387 -3
- package/dist/{payload-types-D70l0uF9.d.ts → payload-types-DCVm1syH.d.ts} +387 -3
- 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/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-BVU0Qfsu.d.ts → webhook-BTtG_8f2.d.ts} +2 -2
- package/dist/{webhook-C_aXaaBz.d.cts → webhook-TDfT7aKA.d.cts} +2 -2
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/package.json +1 -1
|
@@ -87,6 +87,14 @@ interface Config {
|
|
|
87
87
|
'video-categories': VideoCategory;
|
|
88
88
|
'video-tags': VideoTag;
|
|
89
89
|
'live-streams': LiveStream;
|
|
90
|
+
threads: Thread;
|
|
91
|
+
comments: Comment;
|
|
92
|
+
reactions: Reaction;
|
|
93
|
+
'reaction-types': ReactionType;
|
|
94
|
+
bookmarks: Bookmark;
|
|
95
|
+
'thread-categories': ThreadCategory;
|
|
96
|
+
reports: Report;
|
|
97
|
+
'community-bans': CommunityBan;
|
|
90
98
|
forms: Form;
|
|
91
99
|
'form-submissions': FormSubmission;
|
|
92
100
|
'payload-kv': PayloadKv;
|
|
@@ -141,6 +149,9 @@ interface Config {
|
|
|
141
149
|
galleries: {
|
|
142
150
|
items: 'gallery-items';
|
|
143
151
|
};
|
|
152
|
+
threads: {
|
|
153
|
+
comments: 'comments';
|
|
154
|
+
};
|
|
144
155
|
};
|
|
145
156
|
collectionsSelect: {
|
|
146
157
|
users: UsersSelect<false> | UsersSelect<true>;
|
|
@@ -209,6 +220,14 @@ interface Config {
|
|
|
209
220
|
'video-categories': VideoCategoriesSelect<false> | VideoCategoriesSelect<true>;
|
|
210
221
|
'video-tags': VideoTagsSelect<false> | VideoTagsSelect<true>;
|
|
211
222
|
'live-streams': LiveStreamsSelect<false> | LiveStreamsSelect<true>;
|
|
223
|
+
threads: ThreadsSelect<false> | ThreadsSelect<true>;
|
|
224
|
+
comments: CommentsSelect<false> | CommentsSelect<true>;
|
|
225
|
+
reactions: ReactionsSelect<false> | ReactionsSelect<true>;
|
|
226
|
+
'reaction-types': ReactionTypesSelect<false> | ReactionTypesSelect<true>;
|
|
227
|
+
bookmarks: BookmarksSelect<false> | BookmarksSelect<true>;
|
|
228
|
+
'thread-categories': ThreadCategoriesSelect<false> | ThreadCategoriesSelect<true>;
|
|
229
|
+
reports: ReportsSelect<false> | ReportsSelect<true>;
|
|
230
|
+
'community-bans': CommunityBansSelect<false> | CommunityBansSelect<true>;
|
|
212
231
|
forms: FormsSelect<false> | FormsSelect<true>;
|
|
213
232
|
'form-submissions': FormSubmissionsSelect<false> | FormSubmissionsSelect<true>;
|
|
214
233
|
'payload-kv': PayloadKvSelect<false> | PayloadKvSelect<true>;
|
|
@@ -351,11 +370,15 @@ interface Tenant {
|
|
|
351
370
|
*/
|
|
352
371
|
owner: string | User;
|
|
353
372
|
plan: 'free' | 'starter' | 'basic' | 'pro' | 'enterprise';
|
|
354
|
-
features?: ('ecommerce' | 'customers' | 'playlists' | 'galleries' | 'links' | 'forms' | 'posts' | 'documents' | 'flows' | 'videos' | 'live-streaming')[] | null;
|
|
373
|
+
features?: ('ecommerce' | 'customers' | 'playlists' | 'galleries' | 'links' | 'forms' | 'posts' | 'documents' | 'flows' | 'videos' | 'live-streaming' | 'community')[] | null;
|
|
355
374
|
/**
|
|
356
375
|
* Require email verification on customer registration. Verification token is delivered via webhook (operation: verification). You must configure a webhook URL first.
|
|
357
376
|
*/
|
|
358
377
|
requireEmailVerification?: boolean | null;
|
|
378
|
+
/**
|
|
379
|
+
* When enabled, new threads require admin approval before being published.
|
|
380
|
+
*/
|
|
381
|
+
requirePostApproval?: boolean | null;
|
|
359
382
|
/**
|
|
360
383
|
* Dev mode shows configuration tools like the field settings panel. Turn off after setup for a clean production UI.
|
|
361
384
|
*/
|
|
@@ -410,7 +433,7 @@ interface Tenant {
|
|
|
410
433
|
interface FieldConfig {
|
|
411
434
|
id: string;
|
|
412
435
|
tenant?: (string | null) | Tenant;
|
|
413
|
-
collectionSlug: 'products' | 'product-variants' | 'product-options' | 'product-collections' | 'product-categories' | 'product-tags' | 'brands' | 'discounts' | 'shipping-policies' | 'orders' | 'carts' | 'transactions' | 'fulfillments' | 'returns' | 'exchanges' | 'customers' | 'customer-groups' | 'post-authors' | 'posts' | 'post-categories' | 'post-tags' | 'documents' | 'document-categories' | 'document-types' | 'playlists' | 'playlist-categories' | 'playlist-tags' | 'musics' | 'music-categories' | 'music-tags' | 'galleries' | 'gallery-categories' | 'gallery-tags' | 'gallery-items' | 'links' | 'link-categories' | 'link-tags' | 'flows' | 'flow-categories' | 'flow-tags' | 'flow-node-types' | 'flow-edge-types' | 'videos' | 'video-categories' | 'video-tags' | 'live-streams' | 'forms';
|
|
436
|
+
collectionSlug: 'products' | 'product-variants' | 'product-options' | 'product-collections' | 'product-categories' | 'product-tags' | 'brands' | 'discounts' | 'shipping-policies' | 'orders' | 'carts' | 'transactions' | 'fulfillments' | 'returns' | 'exchanges' | 'customers' | 'customer-groups' | 'post-authors' | 'posts' | 'post-categories' | 'post-tags' | 'documents' | 'document-categories' | 'document-types' | 'playlists' | 'playlist-categories' | 'playlist-tags' | 'musics' | 'music-categories' | 'music-tags' | 'galleries' | 'gallery-categories' | 'gallery-tags' | 'gallery-items' | 'links' | 'link-categories' | 'link-tags' | 'flows' | 'flow-categories' | 'flow-tags' | 'flow-node-types' | 'flow-edge-types' | 'videos' | 'video-categories' | 'video-tags' | 'live-streams' | 'forms' | 'threads' | 'comments' | 'reactions' | 'reaction-types' | 'bookmarks' | 'thread-categories';
|
|
414
437
|
isHidden?: boolean | null;
|
|
415
438
|
hiddenFields?: {
|
|
416
439
|
[k: string]: unknown;
|
|
@@ -3347,6 +3370,204 @@ interface FlowEdgeType {
|
|
|
3347
3370
|
createdAt: string;
|
|
3348
3371
|
deletedAt?: string | null;
|
|
3349
3372
|
}
|
|
3373
|
+
/**
|
|
3374
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
3375
|
+
* via the `definition` "threads".
|
|
3376
|
+
*/
|
|
3377
|
+
interface Thread {
|
|
3378
|
+
id: string;
|
|
3379
|
+
_order?: string | null;
|
|
3380
|
+
tenant?: (string | null) | Tenant;
|
|
3381
|
+
title: string;
|
|
3382
|
+
content?: {
|
|
3383
|
+
root: {
|
|
3384
|
+
type: string;
|
|
3385
|
+
children: {
|
|
3386
|
+
type: any;
|
|
3387
|
+
version: number;
|
|
3388
|
+
[k: string]: unknown;
|
|
3389
|
+
}[];
|
|
3390
|
+
direction: ('ltr' | 'rtl') | null;
|
|
3391
|
+
format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | '';
|
|
3392
|
+
indent: number;
|
|
3393
|
+
version: number;
|
|
3394
|
+
};
|
|
3395
|
+
[k: string]: unknown;
|
|
3396
|
+
} | null;
|
|
3397
|
+
categories?: (string | ThreadCategory)[] | null;
|
|
3398
|
+
comments?: {
|
|
3399
|
+
docs?: (string | Comment)[];
|
|
3400
|
+
hasNextPage?: boolean;
|
|
3401
|
+
totalDocs?: number;
|
|
3402
|
+
};
|
|
3403
|
+
/**
|
|
3404
|
+
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
|
3405
|
+
*/
|
|
3406
|
+
generateSlug?: boolean | null;
|
|
3407
|
+
slug?: string | null;
|
|
3408
|
+
thumbnail?: (string | null) | Image;
|
|
3409
|
+
customer: string | Customer;
|
|
3410
|
+
moderationStatus?: ('pending' | 'approved' | 'rejected' | 'reported' | 'hidden') | null;
|
|
3411
|
+
viewCount?: number | null;
|
|
3412
|
+
commentCount?: number | null;
|
|
3413
|
+
reactionCount?: number | null;
|
|
3414
|
+
reportCount?: number | null;
|
|
3415
|
+
isPinned?: boolean | null;
|
|
3416
|
+
allowComments?: boolean | null;
|
|
3417
|
+
isFeatured?: boolean | null;
|
|
3418
|
+
publishedAt?: string | null;
|
|
3419
|
+
metadata?: {
|
|
3420
|
+
[k: string]: unknown;
|
|
3421
|
+
} | unknown[] | string | number | boolean | null;
|
|
3422
|
+
updatedAt: string;
|
|
3423
|
+
createdAt: string;
|
|
3424
|
+
deletedAt?: string | null;
|
|
3425
|
+
}
|
|
3426
|
+
/**
|
|
3427
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
3428
|
+
* via the `definition` "thread-categories".
|
|
3429
|
+
*/
|
|
3430
|
+
interface ThreadCategory {
|
|
3431
|
+
id: string;
|
|
3432
|
+
_order?: string | null;
|
|
3433
|
+
tenant?: (string | null) | Tenant;
|
|
3434
|
+
title: string;
|
|
3435
|
+
/**
|
|
3436
|
+
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
|
3437
|
+
*/
|
|
3438
|
+
generateSlug?: boolean | null;
|
|
3439
|
+
slug?: string | null;
|
|
3440
|
+
/**
|
|
3441
|
+
* Short summary for listing/cards
|
|
3442
|
+
*/
|
|
3443
|
+
description?: string | null;
|
|
3444
|
+
image?: (string | null) | Image;
|
|
3445
|
+
parent?: (string | null) | ThreadCategory;
|
|
3446
|
+
color?: string | null;
|
|
3447
|
+
updatedAt: string;
|
|
3448
|
+
createdAt: string;
|
|
3449
|
+
deletedAt?: string | null;
|
|
3450
|
+
}
|
|
3451
|
+
/**
|
|
3452
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
3453
|
+
* via the `definition` "comments".
|
|
3454
|
+
*/
|
|
3455
|
+
interface Comment {
|
|
3456
|
+
id: string;
|
|
3457
|
+
tenant?: (string | null) | Tenant;
|
|
3458
|
+
thread: string | Thread;
|
|
3459
|
+
customer: string | Customer;
|
|
3460
|
+
content: string;
|
|
3461
|
+
parent?: (string | null) | Comment;
|
|
3462
|
+
depth?: number | null;
|
|
3463
|
+
rootId?: string | null;
|
|
3464
|
+
status?: ('published' | 'hidden' | 'reported') | null;
|
|
3465
|
+
isEdited?: boolean | null;
|
|
3466
|
+
reactionCount?: number | null;
|
|
3467
|
+
reportCount?: number | null;
|
|
3468
|
+
metadata?: {
|
|
3469
|
+
[k: string]: unknown;
|
|
3470
|
+
} | unknown[] | string | number | boolean | null;
|
|
3471
|
+
updatedAt: string;
|
|
3472
|
+
createdAt: string;
|
|
3473
|
+
}
|
|
3474
|
+
/**
|
|
3475
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
3476
|
+
* via the `definition` "reactions".
|
|
3477
|
+
*/
|
|
3478
|
+
interface Reaction {
|
|
3479
|
+
id: string;
|
|
3480
|
+
tenant?: (string | null) | Tenant;
|
|
3481
|
+
thread?: (string | null) | Thread;
|
|
3482
|
+
comment?: (string | null) | Comment;
|
|
3483
|
+
customer: string | Customer;
|
|
3484
|
+
type: string | ReactionType;
|
|
3485
|
+
metadata?: {
|
|
3486
|
+
[k: string]: unknown;
|
|
3487
|
+
} | unknown[] | string | number | boolean | null;
|
|
3488
|
+
updatedAt: string;
|
|
3489
|
+
createdAt: string;
|
|
3490
|
+
}
|
|
3491
|
+
/**
|
|
3492
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
3493
|
+
* via the `definition` "reaction-types".
|
|
3494
|
+
*/
|
|
3495
|
+
interface ReactionType {
|
|
3496
|
+
id: string;
|
|
3497
|
+
_order?: string | null;
|
|
3498
|
+
tenant?: (string | null) | Tenant;
|
|
3499
|
+
title: string;
|
|
3500
|
+
/**
|
|
3501
|
+
* When enabled, the slug will auto-generate from the title field on save and autosave.
|
|
3502
|
+
*/
|
|
3503
|
+
generateSlug?: boolean | null;
|
|
3504
|
+
slug?: string | null;
|
|
3505
|
+
/**
|
|
3506
|
+
* Emoji (e.g. 👍)
|
|
3507
|
+
*/
|
|
3508
|
+
emoji?: string | null;
|
|
3509
|
+
/**
|
|
3510
|
+
* Icon name or path
|
|
3511
|
+
*/
|
|
3512
|
+
icon?: string | null;
|
|
3513
|
+
metadata?: {
|
|
3514
|
+
[k: string]: unknown;
|
|
3515
|
+
} | unknown[] | string | number | boolean | null;
|
|
3516
|
+
updatedAt: string;
|
|
3517
|
+
createdAt: string;
|
|
3518
|
+
deletedAt?: string | null;
|
|
3519
|
+
}
|
|
3520
|
+
/**
|
|
3521
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
3522
|
+
* via the `definition` "bookmarks".
|
|
3523
|
+
*/
|
|
3524
|
+
interface Bookmark {
|
|
3525
|
+
id: string;
|
|
3526
|
+
tenant?: (string | null) | Tenant;
|
|
3527
|
+
thread: string | Thread;
|
|
3528
|
+
customer: string | Customer;
|
|
3529
|
+
metadata?: {
|
|
3530
|
+
[k: string]: unknown;
|
|
3531
|
+
} | unknown[] | string | number | boolean | null;
|
|
3532
|
+
updatedAt: string;
|
|
3533
|
+
createdAt: string;
|
|
3534
|
+
}
|
|
3535
|
+
/**
|
|
3536
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
3537
|
+
* via the `definition` "reports".
|
|
3538
|
+
*/
|
|
3539
|
+
interface Report {
|
|
3540
|
+
id: string;
|
|
3541
|
+
tenant?: (string | null) | Tenant;
|
|
3542
|
+
target?: (string | null) | Thread;
|
|
3543
|
+
targetComment?: (string | null) | Comment;
|
|
3544
|
+
customer: string | Customer;
|
|
3545
|
+
reason: 'spam' | 'harassment' | 'inappropriate' | 'off-topic' | 'other';
|
|
3546
|
+
reasonDetail?: string | null;
|
|
3547
|
+
updatedAt: string;
|
|
3548
|
+
createdAt: string;
|
|
3549
|
+
}
|
|
3550
|
+
/**
|
|
3551
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
3552
|
+
* via the `definition` "community-bans".
|
|
3553
|
+
*/
|
|
3554
|
+
interface CommunityBan {
|
|
3555
|
+
id: string;
|
|
3556
|
+
tenant?: (string | null) | Tenant;
|
|
3557
|
+
customer: string | Customer;
|
|
3558
|
+
/**
|
|
3559
|
+
* Temp ban expiry. null means check isPermanent
|
|
3560
|
+
*/
|
|
3561
|
+
bannedUntil?: string | null;
|
|
3562
|
+
isPermanent: boolean;
|
|
3563
|
+
reason?: string | null;
|
|
3564
|
+
/**
|
|
3565
|
+
* Admin who issued the ban (auto-set)
|
|
3566
|
+
*/
|
|
3567
|
+
bannedBy?: (string | null) | User;
|
|
3568
|
+
updatedAt: string;
|
|
3569
|
+
createdAt: string;
|
|
3570
|
+
}
|
|
3350
3571
|
/**
|
|
3351
3572
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
3352
3573
|
* via the `definition` "forms".
|
|
@@ -3751,6 +3972,30 @@ interface PayloadLockedDocument {
|
|
|
3751
3972
|
} | null) | ({
|
|
3752
3973
|
relationTo: 'live-streams';
|
|
3753
3974
|
value: string | LiveStream;
|
|
3975
|
+
} | null) | ({
|
|
3976
|
+
relationTo: 'threads';
|
|
3977
|
+
value: string | Thread;
|
|
3978
|
+
} | null) | ({
|
|
3979
|
+
relationTo: 'comments';
|
|
3980
|
+
value: string | Comment;
|
|
3981
|
+
} | null) | ({
|
|
3982
|
+
relationTo: 'reactions';
|
|
3983
|
+
value: string | Reaction;
|
|
3984
|
+
} | null) | ({
|
|
3985
|
+
relationTo: 'reaction-types';
|
|
3986
|
+
value: string | ReactionType;
|
|
3987
|
+
} | null) | ({
|
|
3988
|
+
relationTo: 'bookmarks';
|
|
3989
|
+
value: string | Bookmark;
|
|
3990
|
+
} | null) | ({
|
|
3991
|
+
relationTo: 'thread-categories';
|
|
3992
|
+
value: string | ThreadCategory;
|
|
3993
|
+
} | null) | ({
|
|
3994
|
+
relationTo: 'reports';
|
|
3995
|
+
value: string | Report;
|
|
3996
|
+
} | null) | ({
|
|
3997
|
+
relationTo: 'community-bans';
|
|
3998
|
+
value: string | CommunityBan;
|
|
3754
3999
|
} | null) | ({
|
|
3755
4000
|
relationTo: 'forms';
|
|
3756
4001
|
value: string | Form;
|
|
@@ -3979,6 +4224,7 @@ interface TenantsSelect<T extends boolean = true> {
|
|
|
3979
4224
|
plan?: T;
|
|
3980
4225
|
features?: T;
|
|
3981
4226
|
requireEmailVerification?: T;
|
|
4227
|
+
requirePostApproval?: T;
|
|
3982
4228
|
devMode?: T;
|
|
3983
4229
|
cors?: T | {
|
|
3984
4230
|
origin?: T;
|
|
@@ -5611,6 +5857,144 @@ interface LiveStreamsSelect<T extends boolean = true> {
|
|
|
5611
5857
|
createdAt?: T;
|
|
5612
5858
|
deletedAt?: T;
|
|
5613
5859
|
}
|
|
5860
|
+
/**
|
|
5861
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
5862
|
+
* via the `definition` "threads_select".
|
|
5863
|
+
*/
|
|
5864
|
+
interface ThreadsSelect<T extends boolean = true> {
|
|
5865
|
+
_order?: T;
|
|
5866
|
+
tenant?: T;
|
|
5867
|
+
title?: T;
|
|
5868
|
+
content?: T;
|
|
5869
|
+
categories?: T;
|
|
5870
|
+
comments?: T;
|
|
5871
|
+
generateSlug?: T;
|
|
5872
|
+
slug?: T;
|
|
5873
|
+
thumbnail?: T;
|
|
5874
|
+
customer?: T;
|
|
5875
|
+
moderationStatus?: T;
|
|
5876
|
+
viewCount?: T;
|
|
5877
|
+
commentCount?: T;
|
|
5878
|
+
reactionCount?: T;
|
|
5879
|
+
reportCount?: T;
|
|
5880
|
+
isPinned?: T;
|
|
5881
|
+
allowComments?: T;
|
|
5882
|
+
isFeatured?: T;
|
|
5883
|
+
publishedAt?: T;
|
|
5884
|
+
metadata?: T;
|
|
5885
|
+
updatedAt?: T;
|
|
5886
|
+
createdAt?: T;
|
|
5887
|
+
deletedAt?: T;
|
|
5888
|
+
}
|
|
5889
|
+
/**
|
|
5890
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
5891
|
+
* via the `definition` "comments_select".
|
|
5892
|
+
*/
|
|
5893
|
+
interface CommentsSelect<T extends boolean = true> {
|
|
5894
|
+
tenant?: T;
|
|
5895
|
+
thread?: T;
|
|
5896
|
+
customer?: T;
|
|
5897
|
+
content?: T;
|
|
5898
|
+
parent?: T;
|
|
5899
|
+
depth?: T;
|
|
5900
|
+
rootId?: T;
|
|
5901
|
+
status?: T;
|
|
5902
|
+
isEdited?: T;
|
|
5903
|
+
reactionCount?: T;
|
|
5904
|
+
reportCount?: T;
|
|
5905
|
+
metadata?: T;
|
|
5906
|
+
updatedAt?: T;
|
|
5907
|
+
createdAt?: T;
|
|
5908
|
+
}
|
|
5909
|
+
/**
|
|
5910
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
5911
|
+
* via the `definition` "reactions_select".
|
|
5912
|
+
*/
|
|
5913
|
+
interface ReactionsSelect<T extends boolean = true> {
|
|
5914
|
+
tenant?: T;
|
|
5915
|
+
thread?: T;
|
|
5916
|
+
comment?: T;
|
|
5917
|
+
customer?: T;
|
|
5918
|
+
type?: T;
|
|
5919
|
+
metadata?: T;
|
|
5920
|
+
updatedAt?: T;
|
|
5921
|
+
createdAt?: T;
|
|
5922
|
+
}
|
|
5923
|
+
/**
|
|
5924
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
5925
|
+
* via the `definition` "reaction-types_select".
|
|
5926
|
+
*/
|
|
5927
|
+
interface ReactionTypesSelect<T extends boolean = true> {
|
|
5928
|
+
_order?: T;
|
|
5929
|
+
tenant?: T;
|
|
5930
|
+
title?: T;
|
|
5931
|
+
generateSlug?: T;
|
|
5932
|
+
slug?: T;
|
|
5933
|
+
emoji?: T;
|
|
5934
|
+
icon?: T;
|
|
5935
|
+
metadata?: T;
|
|
5936
|
+
updatedAt?: T;
|
|
5937
|
+
createdAt?: T;
|
|
5938
|
+
deletedAt?: T;
|
|
5939
|
+
}
|
|
5940
|
+
/**
|
|
5941
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
5942
|
+
* via the `definition` "bookmarks_select".
|
|
5943
|
+
*/
|
|
5944
|
+
interface BookmarksSelect<T extends boolean = true> {
|
|
5945
|
+
tenant?: T;
|
|
5946
|
+
thread?: T;
|
|
5947
|
+
customer?: T;
|
|
5948
|
+
metadata?: T;
|
|
5949
|
+
updatedAt?: T;
|
|
5950
|
+
createdAt?: T;
|
|
5951
|
+
}
|
|
5952
|
+
/**
|
|
5953
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
5954
|
+
* via the `definition` "thread-categories_select".
|
|
5955
|
+
*/
|
|
5956
|
+
interface ThreadCategoriesSelect<T extends boolean = true> {
|
|
5957
|
+
_order?: T;
|
|
5958
|
+
tenant?: T;
|
|
5959
|
+
title?: T;
|
|
5960
|
+
generateSlug?: T;
|
|
5961
|
+
slug?: T;
|
|
5962
|
+
description?: T;
|
|
5963
|
+
image?: T;
|
|
5964
|
+
parent?: T;
|
|
5965
|
+
color?: T;
|
|
5966
|
+
updatedAt?: T;
|
|
5967
|
+
createdAt?: T;
|
|
5968
|
+
deletedAt?: T;
|
|
5969
|
+
}
|
|
5970
|
+
/**
|
|
5971
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
5972
|
+
* via the `definition` "reports_select".
|
|
5973
|
+
*/
|
|
5974
|
+
interface ReportsSelect<T extends boolean = true> {
|
|
5975
|
+
tenant?: T;
|
|
5976
|
+
target?: T;
|
|
5977
|
+
targetComment?: T;
|
|
5978
|
+
customer?: T;
|
|
5979
|
+
reason?: T;
|
|
5980
|
+
reasonDetail?: T;
|
|
5981
|
+
updatedAt?: T;
|
|
5982
|
+
createdAt?: T;
|
|
5983
|
+
}
|
|
5984
|
+
/**
|
|
5985
|
+
* This interface was referenced by `Config`'s JSON-Schema
|
|
5986
|
+
* via the `definition` "community-bans_select".
|
|
5987
|
+
*/
|
|
5988
|
+
interface CommunityBansSelect<T extends boolean = true> {
|
|
5989
|
+
tenant?: T;
|
|
5990
|
+
customer?: T;
|
|
5991
|
+
bannedUntil?: T;
|
|
5992
|
+
isPermanent?: T;
|
|
5993
|
+
reason?: T;
|
|
5994
|
+
bannedBy?: T;
|
|
5995
|
+
updatedAt?: T;
|
|
5996
|
+
createdAt?: T;
|
|
5997
|
+
}
|
|
5614
5998
|
/**
|
|
5615
5999
|
* This interface was referenced by `Config`'s JSON-Schema
|
|
5616
6000
|
* via the `definition` "forms_select".
|
|
@@ -5804,4 +6188,4 @@ declare module 'payload' {
|
|
|
5804
6188
|
}
|
|
5805
6189
|
}
|
|
5806
6190
|
|
|
5807
|
-
export type { Document as $, Audience as A, BrandLogo as B, Config as C, ProductCollection as D, Exchange as E, Form as F, Customer as G, CustomerGroup as H, IframeBlock as I, CustomerAddress as J, FulfillmentItem as K, LiveStream as L, ReturnProduct as M, ExchangeProduct as N, Order as O, Product as P, OrderStatusLog as Q, Return as R, SupportedTimezones as S, Transaction as T, UserAuthOperations as U, Video as V, Discount as W, Post as X, PostAuthor as Y, PostCategory as Z, PostTag as _, OrderProduct as a,
|
|
6191
|
+
export type { Document as $, Audience as A, BrandLogo as B, Config as C, ProductCollection as D, Exchange as E, Form as F, Customer as G, CustomerGroup as H, IframeBlock as I, CustomerAddress as J, FulfillmentItem as K, LiveStream as L, ReturnProduct as M, ExchangeProduct as N, Order as O, Product as P, OrderStatusLog as Q, Return as R, SupportedTimezones as S, Transaction as T, UserAuthOperations as U, Video as V, Discount as W, Post as X, PostAuthor as Y, PostCategory as Z, PostTag as _, OrderProduct as a, ShippingPoliciesSelect as a$, DocumentType as a0, DocumentCategory as a1, Playlist as a2, PlaylistCategory as a3, PlaylistTag as a4, Music as a5, MusicCategory as a6, MusicTag as a7, Gallery as a8, GalleryCategory as a9, SystemMediaSelect as aA, AudiencesSelect as aB, EmailLogsSelect as aC, TenantsSelect as aD, TenantMetadataSelect as aE, ApiUsageSelect as aF, SubscriptionsSelect as aG, BillingHistorySelect as aH, TenantLogosSelect as aI, ProductsSelect as aJ, ProductVariantsSelect as aK, ProductOptionsSelect as aL, ProductCategoriesSelect as aM, ProductTagsSelect as aN, ProductCollectionsSelect as aO, BrandsSelect as aP, BrandLogosSelect as aQ, OrdersSelect as aR, OrderProductsSelect as aS, TransactionsSelect as aT, OrderStatusLogsSelect as aU, FulfillmentsSelect as aV, FulfillmentItemsSelect as aW, ReturnsSelect as aX, ReturnProductsSelect as aY, ExchangesSelect as aZ, ExchangeProductsSelect as a_, GalleryTag as aa, GalleryItem as ab, Link as ac, LinkCategory as ad, LinkTag as ae, Flow as af, FlowCategory as ag, FlowTag as ah, FlowNodeType as ai, FlowEdgeType as aj, Thread as ak, ThreadCategory as al, Comment as am, Reaction as an, ReactionType as ao, Bookmark as ap, Report as aq, CommunityBan as ar, FormSubmission as as, PayloadKv as at, PayloadLockedDocument as au, PayloadPreference as av, PayloadMigration as aw, UsersSelect as ax, FieldConfigsSelect as ay, ImagesSelect as az, Fulfillment as b, CustomersSelect as b0, CustomerAddressesSelect as b1, CustomerGroupsSelect as b2, CartsSelect as b3, CartItemsSelect as b4, DiscountsSelect as b5, PostsSelect as b6, PostAuthorsSelect as b7, PostCategoriesSelect as b8, PostTagsSelect as b9, CommentsSelect as bA, ReactionsSelect as bB, ReactionTypesSelect as bC, BookmarksSelect as bD, ThreadCategoriesSelect as bE, ReportsSelect as bF, CommunityBansSelect as bG, FormsSelect as bH, FormSubmissionsSelect as bI, PayloadKvSelect as bJ, PayloadLockedDocumentsSelect as bK, PayloadPreferencesSelect as bL, PayloadMigrationsSelect as bM, CollectionsWidget as bN, Auth as bO, DocumentsSelect as ba, DocumentCategoriesSelect as bb, DocumentTypesSelect as bc, PlaylistsSelect as bd, PlaylistCategoriesSelect as be, PlaylistTagsSelect as bf, MusicsSelect as bg, MusicCategoriesSelect as bh, MusicTagsSelect as bi, GalleriesSelect as bj, GalleryCategoriesSelect as bk, GalleryTagsSelect as bl, GalleryItemsSelect as bm, LinksSelect as bn, LinkCategoriesSelect as bo, LinkTagsSelect as bp, FlowsSelect as bq, FlowNodeTypesSelect as br, FlowEdgeTypesSelect as bs, FlowCategoriesSelect as bt, FlowTagsSelect as bu, VideosSelect as bv, VideoCategoriesSelect as bw, VideoTagsSelect as bx, LiveStreamsSelect as by, ThreadsSelect as bz, Cart as c, CartItem as d, CustomerAuthOperations as e, PlayerBlock as f, CodeBlock as g, User as h, Tenant as i, FieldConfig as j, Image as k, SystemMedia as l, EmailLog as m, TenantMetadatum as n, ApiUsage as o, Subscription as p, BillingHistory as q, TenantLogo as r, VideoCategory as s, VideoTag as t, ProductVariant as u, ProductOption as v, ProductCategory as w, ProductTag as x, Brand as y, ShippingPolicy as z };
|
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 * clientKey: 'your-key',\n * getToken: () => client.customer.getToken(),\n * collections: ['products', 'orders'],\n * })\n * ```\n */\nexport function useRealtimeQuery(options: {\n clientKey: string\n getToken: () => string | null\n collections?: PublicCollection[]\n enabled?: boolean\n}): UseRealtimeQueryResult {\n const { clientKey, getToken, collections, enabled = true } = options\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 || !clientKey) return\n\n const baseUrl = resolveApiUrl()\n const conn = new RealtimeConnection(\n baseUrl,\n clientKey,\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 }, [clientKey, 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 clientKey: 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-Client-Key': this.clientKey,\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 { Collection, PublicCollection } from '../collection/const'\n\nexport type { Collection, PublicCollection }\n\n// ============================================================================\n// API URL Configuration\n// ============================================================================\n\ndeclare const __DEFAULT_API_URL__: string\n\n/**\n * API URL을 반환합니다.\n * 환경변수 SOFTWARE_API_URL 또는 NEXT_PUBLIC_SOFTWARE_API_URL로 오버라이드 가능.\n * 빌드 시 버전에 따라 기본값 결정: dev 빌드 → api-dev, 정식 → api.01.software\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 clientKey: 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\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\n// ============================================================================\n// API Response Types\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\nexport interface ApiQueryOptions {\n page?: number\n limit?: number\n sort?: Sort\n where?: Where\n depth?: number\n select?: Record<string, 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// ============================================================================\n// Collection Types (re-exported from collection/const)\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'\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"],"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,WACA,UACA,aACR;AAJQ;AACA;AACA;AACA;AAXV,SAAQ,kBAA0C;AAClD,SAAQ,mBAAmB;AAC3B,SAAQ,kBAAkB;AAC1B,SAAQ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mCAAe;AACnC,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,KAAK;AAChD,QAAM,CAAC,WAAW,YAAY,QAAI,uBAA+B,IAAI;AACrE,QAAM,oBAAgB,qBAAkC,IAAI;AAE5D,8BAAU,MAAM;AACd,QAAI,CAAC,WAAW,CAAC,UAAW;AAE5B,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,WAAW,SAAS,aAAa,KAAK,GAAG,CAAC,CAAC;AAE/C,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 * clientKey: 'your-key',\n * getToken: () => client.customer.getToken(),\n * collections: ['products', 'orders'],\n * })\n * ```\n */\nexport function useRealtimeQuery(options: {\n clientKey: string\n getToken: () => string | null\n collections?: PublicCollection[]\n enabled?: boolean\n}): UseRealtimeQueryResult {\n const { clientKey, getToken, collections, enabled = true } = options\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 || !clientKey) return\n\n const baseUrl = resolveApiUrl()\n const conn = new RealtimeConnection(\n baseUrl,\n clientKey,\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 }, [clientKey, 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 clientKey: 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-Client-Key': this.clientKey,\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 { Collection, PublicCollection } from '../collection/const'\n\nexport type { Collection, PublicCollection }\n\n// ============================================================================\n// API URL Configuration\n// ============================================================================\n\ndeclare const __DEFAULT_API_URL__: string\n\n/**\n * API URL을 반환합니다.\n * 환경변수 SOFTWARE_API_URL 또는 NEXT_PUBLIC_SOFTWARE_API_URL로 오버라이드 가능.\n * 빌드 시 버전에 따라 기본값 결정: dev 빌드 → api-dev, 정식 → api.01.software\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 clientKey: 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\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\n// ============================================================================\n// API Response Types\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\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}\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// ============================================================================\n// Collection Types (re-exported from collection/const)\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'\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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@
|
|
|
1
1
|
import { R as RealtimeEvent } from './realtime-DupPIYx-.cjs';
|
|
2
2
|
export { a as RealtimeConnection, b as RealtimeListener } from './realtime-DupPIYx-.cjs';
|
|
3
|
-
import { P as PublicCollection } from './const-
|
|
4
|
-
import './payload-types-
|
|
3
|
+
import { P as PublicCollection } from './const-DQZQAXex.cjs';
|
|
4
|
+
import './payload-types-DCVm1syH.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-DupPIYx-.js';
|
|
2
2
|
export { a as RealtimeConnection, b as RealtimeListener } from './realtime-DupPIYx-.js';
|
|
3
|
-
import { P as PublicCollection } from './const-
|
|
4
|
-
import './payload-types-
|
|
3
|
+
import { P as PublicCollection } from './const-Bk3-zigV.js';
|
|
4
|
+
import './payload-types-DCVm1syH.js';
|
|
5
5
|
|
|
6
6
|
interface UseRealtimeQueryOptions {
|
|
7
7
|
/** Filter events to specific collections. Empty/undefined = all collections. */
|