@cstar.help/js 0.6.0 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat/index.d.cts +1 -0
- package/dist/chat/index.d.ts +1 -0
- package/dist/community/index.d.cts +1 -0
- package/dist/community/index.d.ts +1 -0
- package/dist/index.cjs +8 -4
- package/dist/index.d.cts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +8 -4
- package/package.json +1 -1
package/dist/chat/index.d.cts
CHANGED
package/dist/chat/index.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -292,7 +292,7 @@ var CStarRealtime = class {
|
|
|
292
292
|
this.maxRetries = options?.maxRetries ?? 10;
|
|
293
293
|
this.types = options?.types;
|
|
294
294
|
}
|
|
295
|
-
/** Subscribe to a specific event type. Supports wildcards (e.g., 'ticket.*'). */
|
|
295
|
+
/** Subscribe to a specific event type. Supports wildcards (e.g., 'ticket.*'). Returns an unsubscribe function. */
|
|
296
296
|
on(eventType, handler) {
|
|
297
297
|
let set = this.handlers.get(eventType);
|
|
298
298
|
if (!set) {
|
|
@@ -301,13 +301,17 @@ var CStarRealtime = class {
|
|
|
301
301
|
}
|
|
302
302
|
set.add(handler);
|
|
303
303
|
this.ensureConnected();
|
|
304
|
-
return
|
|
304
|
+
return () => {
|
|
305
|
+
set.delete(handler);
|
|
306
|
+
};
|
|
305
307
|
}
|
|
306
|
-
/** Subscribe to all events. */
|
|
308
|
+
/** Subscribe to all events. Returns an unsubscribe function. */
|
|
307
309
|
onAny(handler) {
|
|
308
310
|
this.anyHandlers.add(handler);
|
|
309
311
|
this.ensureConnected();
|
|
310
|
-
return
|
|
312
|
+
return () => {
|
|
313
|
+
this.anyHandlers.delete(handler);
|
|
314
|
+
};
|
|
311
315
|
}
|
|
312
316
|
/** Handle connection errors. */
|
|
313
317
|
onError(handler) {
|
package/dist/index.d.cts
CHANGED
|
@@ -94,10 +94,10 @@ declare class CStarRealtime {
|
|
|
94
94
|
private readonly maxRetries;
|
|
95
95
|
private readonly types;
|
|
96
96
|
constructor(httpClient: HttpClient, options?: RealtimeOptions);
|
|
97
|
-
/** Subscribe to a specific event type. Supports wildcards (e.g., 'ticket.*'). */
|
|
98
|
-
on<T = unknown>(eventType: string, handler: EventHandler<T>):
|
|
99
|
-
/** Subscribe to all events. */
|
|
100
|
-
onAny<T = unknown>(handler: EventHandler<T>):
|
|
97
|
+
/** Subscribe to a specific event type. Supports wildcards (e.g., 'ticket.*'). Returns an unsubscribe function. */
|
|
98
|
+
on<T = unknown>(eventType: string, handler: EventHandler<T>): () => void;
|
|
99
|
+
/** Subscribe to all events. Returns an unsubscribe function. */
|
|
100
|
+
onAny<T = unknown>(handler: EventHandler<T>): () => void;
|
|
101
101
|
/** Handle connection errors. */
|
|
102
102
|
onError(handler: ErrorHandler): this;
|
|
103
103
|
/** Handle connection state changes. */
|
|
@@ -846,6 +846,11 @@ interface CommunityAttachment {
|
|
|
846
846
|
size_bytes: number;
|
|
847
847
|
storage_path: string;
|
|
848
848
|
}
|
|
849
|
+
/** Custom field configuration entry for a topic. */
|
|
850
|
+
interface TopicFieldConfigEntry {
|
|
851
|
+
fieldId: string;
|
|
852
|
+
required: boolean;
|
|
853
|
+
}
|
|
849
854
|
/** A community discussion topic (category/board). */
|
|
850
855
|
interface CommunityTopic {
|
|
851
856
|
id: string;
|
|
@@ -855,6 +860,7 @@ interface CommunityTopic {
|
|
|
855
860
|
icon: string;
|
|
856
861
|
visibility: 'public' | 'members_only';
|
|
857
862
|
sortOrder: number;
|
|
863
|
+
customFieldConfig: TopicFieldConfigEntry[];
|
|
858
864
|
postCount: number;
|
|
859
865
|
createdAt: string;
|
|
860
866
|
}
|
|
@@ -874,6 +880,7 @@ interface CommunityPost {
|
|
|
874
880
|
isFeatured: boolean;
|
|
875
881
|
isLocked: boolean;
|
|
876
882
|
commentsEnabled: boolean;
|
|
883
|
+
customFields: Record<string, string>;
|
|
877
884
|
attachments: CommunityAttachment[];
|
|
878
885
|
authorName: string;
|
|
879
886
|
lastActivityAt: string;
|
|
@@ -906,6 +913,7 @@ interface CommunityPostCreateParams {
|
|
|
906
913
|
body?: string;
|
|
907
914
|
topicId: string;
|
|
908
915
|
visibility?: 'public' | 'members_only';
|
|
916
|
+
customFields?: Record<string, string>;
|
|
909
917
|
attachments?: CommunityAttachment[];
|
|
910
918
|
}
|
|
911
919
|
/** Parameters for updating a community post. */
|
|
@@ -919,6 +927,7 @@ interface CommunityPostUpdateParams {
|
|
|
919
927
|
isLocked?: boolean;
|
|
920
928
|
isHidden?: boolean;
|
|
921
929
|
commentsEnabled?: boolean;
|
|
930
|
+
customFields?: Record<string, string>;
|
|
922
931
|
attachments?: CommunityAttachment[];
|
|
923
932
|
}
|
|
924
933
|
/** Parameters for creating a comment on a community post. */
|
package/dist/index.d.ts
CHANGED
|
@@ -94,10 +94,10 @@ declare class CStarRealtime {
|
|
|
94
94
|
private readonly maxRetries;
|
|
95
95
|
private readonly types;
|
|
96
96
|
constructor(httpClient: HttpClient, options?: RealtimeOptions);
|
|
97
|
-
/** Subscribe to a specific event type. Supports wildcards (e.g., 'ticket.*'). */
|
|
98
|
-
on<T = unknown>(eventType: string, handler: EventHandler<T>):
|
|
99
|
-
/** Subscribe to all events. */
|
|
100
|
-
onAny<T = unknown>(handler: EventHandler<T>):
|
|
97
|
+
/** Subscribe to a specific event type. Supports wildcards (e.g., 'ticket.*'). Returns an unsubscribe function. */
|
|
98
|
+
on<T = unknown>(eventType: string, handler: EventHandler<T>): () => void;
|
|
99
|
+
/** Subscribe to all events. Returns an unsubscribe function. */
|
|
100
|
+
onAny<T = unknown>(handler: EventHandler<T>): () => void;
|
|
101
101
|
/** Handle connection errors. */
|
|
102
102
|
onError(handler: ErrorHandler): this;
|
|
103
103
|
/** Handle connection state changes. */
|
|
@@ -846,6 +846,11 @@ interface CommunityAttachment {
|
|
|
846
846
|
size_bytes: number;
|
|
847
847
|
storage_path: string;
|
|
848
848
|
}
|
|
849
|
+
/** Custom field configuration entry for a topic. */
|
|
850
|
+
interface TopicFieldConfigEntry {
|
|
851
|
+
fieldId: string;
|
|
852
|
+
required: boolean;
|
|
853
|
+
}
|
|
849
854
|
/** A community discussion topic (category/board). */
|
|
850
855
|
interface CommunityTopic {
|
|
851
856
|
id: string;
|
|
@@ -855,6 +860,7 @@ interface CommunityTopic {
|
|
|
855
860
|
icon: string;
|
|
856
861
|
visibility: 'public' | 'members_only';
|
|
857
862
|
sortOrder: number;
|
|
863
|
+
customFieldConfig: TopicFieldConfigEntry[];
|
|
858
864
|
postCount: number;
|
|
859
865
|
createdAt: string;
|
|
860
866
|
}
|
|
@@ -874,6 +880,7 @@ interface CommunityPost {
|
|
|
874
880
|
isFeatured: boolean;
|
|
875
881
|
isLocked: boolean;
|
|
876
882
|
commentsEnabled: boolean;
|
|
883
|
+
customFields: Record<string, string>;
|
|
877
884
|
attachments: CommunityAttachment[];
|
|
878
885
|
authorName: string;
|
|
879
886
|
lastActivityAt: string;
|
|
@@ -906,6 +913,7 @@ interface CommunityPostCreateParams {
|
|
|
906
913
|
body?: string;
|
|
907
914
|
topicId: string;
|
|
908
915
|
visibility?: 'public' | 'members_only';
|
|
916
|
+
customFields?: Record<string, string>;
|
|
909
917
|
attachments?: CommunityAttachment[];
|
|
910
918
|
}
|
|
911
919
|
/** Parameters for updating a community post. */
|
|
@@ -919,6 +927,7 @@ interface CommunityPostUpdateParams {
|
|
|
919
927
|
isLocked?: boolean;
|
|
920
928
|
isHidden?: boolean;
|
|
921
929
|
commentsEnabled?: boolean;
|
|
930
|
+
customFields?: Record<string, string>;
|
|
922
931
|
attachments?: CommunityAttachment[];
|
|
923
932
|
}
|
|
924
933
|
/** Parameters for creating a comment on a community post. */
|
package/dist/index.js
CHANGED
|
@@ -254,7 +254,7 @@ var CStarRealtime = class {
|
|
|
254
254
|
this.maxRetries = options?.maxRetries ?? 10;
|
|
255
255
|
this.types = options?.types;
|
|
256
256
|
}
|
|
257
|
-
/** Subscribe to a specific event type. Supports wildcards (e.g., 'ticket.*'). */
|
|
257
|
+
/** Subscribe to a specific event type. Supports wildcards (e.g., 'ticket.*'). Returns an unsubscribe function. */
|
|
258
258
|
on(eventType, handler) {
|
|
259
259
|
let set = this.handlers.get(eventType);
|
|
260
260
|
if (!set) {
|
|
@@ -263,13 +263,17 @@ var CStarRealtime = class {
|
|
|
263
263
|
}
|
|
264
264
|
set.add(handler);
|
|
265
265
|
this.ensureConnected();
|
|
266
|
-
return
|
|
266
|
+
return () => {
|
|
267
|
+
set.delete(handler);
|
|
268
|
+
};
|
|
267
269
|
}
|
|
268
|
-
/** Subscribe to all events. */
|
|
270
|
+
/** Subscribe to all events. Returns an unsubscribe function. */
|
|
269
271
|
onAny(handler) {
|
|
270
272
|
this.anyHandlers.add(handler);
|
|
271
273
|
this.ensureConnected();
|
|
272
|
-
return
|
|
274
|
+
return () => {
|
|
275
|
+
this.anyHandlers.delete(handler);
|
|
276
|
+
};
|
|
273
277
|
}
|
|
274
278
|
/** Handle connection errors. */
|
|
275
279
|
onError(handler) {
|