@pushflodev/sdk 1.0.5 → 1.0.7
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 +4 -1
- package/dist/{PushFloClient-B4smuFOa.d.ts → ConnectionError-CfKkkpfA.d.ts} +24 -2
- package/dist/{PushFloClient-DqOYR0GV.d.cts → ConnectionError-DMzDtJlz.d.cts} +24 -2
- package/dist/{message-CVgilLwz.d.cts → ValidationError-izGOr1dF.d.cts} +92 -1
- package/dist/{message-CVgilLwz.d.ts → ValidationError-izGOr1dF.d.ts} +92 -1
- package/dist/{api-Dgp2k2ZF.d.cts → api-CkP76uCc.d.cts} +3 -94
- package/dist/{api-Dgp2k2ZF.d.ts → api-CkP76uCc.d.ts} +3 -94
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -28
- package/dist/index.d.ts +3 -28
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +83 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +4 -2
- package/dist/react.d.ts +4 -2
- package/dist/react.js +79 -2
- package/dist/react.js.map +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +4 -3
- package/dist/server.d.ts +4 -3
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,6 +48,9 @@ const subscription = client.subscribe('notifications', {
|
|
|
48
48
|
// 4. Cleanup when done
|
|
49
49
|
subscription.unsubscribe();
|
|
50
50
|
client.disconnect();
|
|
51
|
+
|
|
52
|
+
// 5. Clean up all resources (optional - for complete teardown)
|
|
53
|
+
client.destroy();
|
|
51
54
|
```
|
|
52
55
|
|
|
53
56
|
## Quick Start - Server (60 seconds)
|
|
@@ -422,7 +425,7 @@ Channel slugs must follow these rules:
|
|
|
422
425
|
| No special characters | `my-channel` | `my_channel`, `my.channel` |
|
|
423
426
|
| No leading/trailing hyphens | `my-channel` | `-channel`, `channel-` |
|
|
424
427
|
| No consecutive hyphens | `my-channel` | `my--channel` |
|
|
425
|
-
| 1-
|
|
428
|
+
| 1-128 characters | `a` to 128 chars | empty or >128 chars |
|
|
426
429
|
|
|
427
430
|
### Validation Utilities
|
|
428
431
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ConnectionInfo, M as Message, C as ClientOptions, b as ConnectionState,
|
|
1
|
+
import { a as ConnectionInfo, M as Message, C as ClientOptions, b as ConnectionState, f as SubscriptionOptions, S as Subscription, e as PushFloError } from './ValidationError-izGOr1dF.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Type-safe event emitter with zero dependencies
|
|
@@ -101,4 +101,26 @@ declare class PushFloClient extends TypedEventEmitter<PushFloClientEvents> {
|
|
|
101
101
|
private handleServerMessage;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Error thrown when connection to PushFlo fails
|
|
106
|
+
*/
|
|
107
|
+
declare class ConnectionError extends PushFloError {
|
|
108
|
+
constructor(message: string, code?: string, options?: {
|
|
109
|
+
retryable?: boolean;
|
|
110
|
+
cause?: Error;
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* Create a connection timeout error
|
|
114
|
+
*/
|
|
115
|
+
static timeout(timeoutMs: number): ConnectionError;
|
|
116
|
+
/**
|
|
117
|
+
* Create a connection closed error
|
|
118
|
+
*/
|
|
119
|
+
static closed(reason?: string): ConnectionError;
|
|
120
|
+
/**
|
|
121
|
+
* Create a connection failed error
|
|
122
|
+
*/
|
|
123
|
+
static failed(reason?: string, cause?: Error): ConnectionError;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { ConnectionError as C, PushFloClient as P };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ConnectionInfo, M as Message, C as ClientOptions, b as ConnectionState,
|
|
1
|
+
import { a as ConnectionInfo, M as Message, C as ClientOptions, b as ConnectionState, f as SubscriptionOptions, S as Subscription, e as PushFloError } from './ValidationError-izGOr1dF.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Type-safe event emitter with zero dependencies
|
|
@@ -101,4 +101,26 @@ declare class PushFloClient extends TypedEventEmitter<PushFloClientEvents> {
|
|
|
101
101
|
private handleServerMessage;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Error thrown when connection to PushFlo fails
|
|
106
|
+
*/
|
|
107
|
+
declare class ConnectionError extends PushFloError {
|
|
108
|
+
constructor(message: string, code?: string, options?: {
|
|
109
|
+
retryable?: boolean;
|
|
110
|
+
cause?: Error;
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* Create a connection timeout error
|
|
114
|
+
*/
|
|
115
|
+
static timeout(timeoutMs: number): ConnectionError;
|
|
116
|
+
/**
|
|
117
|
+
* Create a connection closed error
|
|
118
|
+
*/
|
|
119
|
+
static closed(reason?: string): ConnectionError;
|
|
120
|
+
/**
|
|
121
|
+
* Create a connection failed error
|
|
122
|
+
*/
|
|
123
|
+
static failed(reason?: string, cause?: Error): ConnectionError;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export { ConnectionError as C, PushFloClient as P };
|
|
@@ -127,4 +127,95 @@ interface SubscriptionOptions {
|
|
|
127
127
|
onUnsubscribed?: () => void;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Base error class for all PushFlo SDK errors
|
|
132
|
+
*/
|
|
133
|
+
declare class PushFloError extends Error {
|
|
134
|
+
/** Error code for programmatic handling */
|
|
135
|
+
readonly code: string;
|
|
136
|
+
/** Whether this error is potentially recoverable through retry */
|
|
137
|
+
readonly retryable: boolean;
|
|
138
|
+
/** Original error that caused this error, if any */
|
|
139
|
+
readonly cause?: Error;
|
|
140
|
+
constructor(message: string, code: string, options?: {
|
|
141
|
+
retryable?: boolean;
|
|
142
|
+
cause?: Error;
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* Convert error to JSON-serializable object
|
|
146
|
+
*/
|
|
147
|
+
toJSON(): Record<string, unknown>;
|
|
148
|
+
/**
|
|
149
|
+
* Create a string representation
|
|
150
|
+
*/
|
|
151
|
+
toString(): string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Error thrown when authentication fails
|
|
156
|
+
*/
|
|
157
|
+
declare class AuthenticationError extends PushFloError {
|
|
158
|
+
constructor(message: string, code?: string, options?: {
|
|
159
|
+
retryable?: boolean;
|
|
160
|
+
cause?: Error;
|
|
161
|
+
});
|
|
162
|
+
/**
|
|
163
|
+
* Create an invalid API key error
|
|
164
|
+
*/
|
|
165
|
+
static invalidKey(keyType?: string): AuthenticationError;
|
|
166
|
+
/**
|
|
167
|
+
* Create an unauthorized error
|
|
168
|
+
*/
|
|
169
|
+
static unauthorized(reason?: string): AuthenticationError;
|
|
170
|
+
/**
|
|
171
|
+
* Create a forbidden error
|
|
172
|
+
*/
|
|
173
|
+
static forbidden(action?: string): AuthenticationError;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Error thrown for network-related failures
|
|
178
|
+
*/
|
|
179
|
+
declare class NetworkError extends PushFloError {
|
|
180
|
+
/** HTTP status code, if applicable */
|
|
181
|
+
readonly statusCode?: number;
|
|
182
|
+
constructor(message: string, code?: string, options?: {
|
|
183
|
+
retryable?: boolean;
|
|
184
|
+
cause?: Error;
|
|
185
|
+
statusCode?: number;
|
|
186
|
+
});
|
|
187
|
+
/**
|
|
188
|
+
* Create a network error from fetch failure
|
|
189
|
+
*/
|
|
190
|
+
static fromFetch(cause: Error): NetworkError;
|
|
191
|
+
/**
|
|
192
|
+
* Create a request timeout error
|
|
193
|
+
*/
|
|
194
|
+
static timeout(timeoutMs: number): NetworkError;
|
|
195
|
+
/**
|
|
196
|
+
* Create an error from HTTP status code
|
|
197
|
+
*/
|
|
198
|
+
static fromStatus(statusCode: number, message?: string): NetworkError;
|
|
199
|
+
private static getStatusMessage;
|
|
200
|
+
toJSON(): Record<string, unknown>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Error thrown when input validation fails
|
|
205
|
+
*/
|
|
206
|
+
declare class ValidationError extends PushFloError {
|
|
207
|
+
/** The field that failed validation */
|
|
208
|
+
readonly field?: string;
|
|
209
|
+
constructor(message: string, field?: string);
|
|
210
|
+
/**
|
|
211
|
+
* Create an error for an invalid channel slug
|
|
212
|
+
*/
|
|
213
|
+
static invalidChannelSlug(slug: string): ValidationError;
|
|
214
|
+
/**
|
|
215
|
+
* Create an error for a required field
|
|
216
|
+
*/
|
|
217
|
+
static required(field: string): ValidationError;
|
|
218
|
+
toJSON(): Record<string, unknown>;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export { AuthenticationError as A, type ClientOptions as C, type Message as M, NetworkError as N, type PublishOptions as P, type Subscription as S, ValidationError as V, type ConnectionInfo as a, type ConnectionState as b, type MessageHistoryOptions as c, type PublishResult as d, PushFloError as e, type SubscriptionOptions as f, type ServerOptions as g };
|
|
@@ -127,4 +127,95 @@ interface SubscriptionOptions {
|
|
|
127
127
|
onUnsubscribed?: () => void;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Base error class for all PushFlo SDK errors
|
|
132
|
+
*/
|
|
133
|
+
declare class PushFloError extends Error {
|
|
134
|
+
/** Error code for programmatic handling */
|
|
135
|
+
readonly code: string;
|
|
136
|
+
/** Whether this error is potentially recoverable through retry */
|
|
137
|
+
readonly retryable: boolean;
|
|
138
|
+
/** Original error that caused this error, if any */
|
|
139
|
+
readonly cause?: Error;
|
|
140
|
+
constructor(message: string, code: string, options?: {
|
|
141
|
+
retryable?: boolean;
|
|
142
|
+
cause?: Error;
|
|
143
|
+
});
|
|
144
|
+
/**
|
|
145
|
+
* Convert error to JSON-serializable object
|
|
146
|
+
*/
|
|
147
|
+
toJSON(): Record<string, unknown>;
|
|
148
|
+
/**
|
|
149
|
+
* Create a string representation
|
|
150
|
+
*/
|
|
151
|
+
toString(): string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Error thrown when authentication fails
|
|
156
|
+
*/
|
|
157
|
+
declare class AuthenticationError extends PushFloError {
|
|
158
|
+
constructor(message: string, code?: string, options?: {
|
|
159
|
+
retryable?: boolean;
|
|
160
|
+
cause?: Error;
|
|
161
|
+
});
|
|
162
|
+
/**
|
|
163
|
+
* Create an invalid API key error
|
|
164
|
+
*/
|
|
165
|
+
static invalidKey(keyType?: string): AuthenticationError;
|
|
166
|
+
/**
|
|
167
|
+
* Create an unauthorized error
|
|
168
|
+
*/
|
|
169
|
+
static unauthorized(reason?: string): AuthenticationError;
|
|
170
|
+
/**
|
|
171
|
+
* Create a forbidden error
|
|
172
|
+
*/
|
|
173
|
+
static forbidden(action?: string): AuthenticationError;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Error thrown for network-related failures
|
|
178
|
+
*/
|
|
179
|
+
declare class NetworkError extends PushFloError {
|
|
180
|
+
/** HTTP status code, if applicable */
|
|
181
|
+
readonly statusCode?: number;
|
|
182
|
+
constructor(message: string, code?: string, options?: {
|
|
183
|
+
retryable?: boolean;
|
|
184
|
+
cause?: Error;
|
|
185
|
+
statusCode?: number;
|
|
186
|
+
});
|
|
187
|
+
/**
|
|
188
|
+
* Create a network error from fetch failure
|
|
189
|
+
*/
|
|
190
|
+
static fromFetch(cause: Error): NetworkError;
|
|
191
|
+
/**
|
|
192
|
+
* Create a request timeout error
|
|
193
|
+
*/
|
|
194
|
+
static timeout(timeoutMs: number): NetworkError;
|
|
195
|
+
/**
|
|
196
|
+
* Create an error from HTTP status code
|
|
197
|
+
*/
|
|
198
|
+
static fromStatus(statusCode: number, message?: string): NetworkError;
|
|
199
|
+
private static getStatusMessage;
|
|
200
|
+
toJSON(): Record<string, unknown>;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Error thrown when input validation fails
|
|
205
|
+
*/
|
|
206
|
+
declare class ValidationError extends PushFloError {
|
|
207
|
+
/** The field that failed validation */
|
|
208
|
+
readonly field?: string;
|
|
209
|
+
constructor(message: string, field?: string);
|
|
210
|
+
/**
|
|
211
|
+
* Create an error for an invalid channel slug
|
|
212
|
+
*/
|
|
213
|
+
static invalidChannelSlug(slug: string): ValidationError;
|
|
214
|
+
/**
|
|
215
|
+
* Create an error for a required field
|
|
216
|
+
*/
|
|
217
|
+
static required(field: string): ValidationError;
|
|
218
|
+
toJSON(): Record<string, unknown>;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export { AuthenticationError as A, type ClientOptions as C, type Message as M, NetworkError as N, type PublishOptions as P, type Subscription as S, ValidationError as V, type ConnectionInfo as a, type ConnectionState as b, type MessageHistoryOptions as c, type PublishResult as d, PushFloError as e, type SubscriptionOptions as f, type ServerOptions as g };
|
|
@@ -1,105 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base error class for all PushFlo SDK errors
|
|
3
|
-
*/
|
|
4
|
-
declare class PushFloError extends Error {
|
|
5
|
-
/** Error code for programmatic handling */
|
|
6
|
-
readonly code: string;
|
|
7
|
-
/** Whether this error is potentially recoverable through retry */
|
|
8
|
-
readonly retryable: boolean;
|
|
9
|
-
/** Original error that caused this error, if any */
|
|
10
|
-
readonly cause?: Error;
|
|
11
|
-
constructor(message: string, code: string, options?: {
|
|
12
|
-
retryable?: boolean;
|
|
13
|
-
cause?: Error;
|
|
14
|
-
});
|
|
15
|
-
/**
|
|
16
|
-
* Convert error to JSON-serializable object
|
|
17
|
-
*/
|
|
18
|
-
toJSON(): Record<string, unknown>;
|
|
19
|
-
/**
|
|
20
|
-
* Create a string representation
|
|
21
|
-
*/
|
|
22
|
-
toString(): string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Error thrown when authentication fails
|
|
27
|
-
*/
|
|
28
|
-
declare class AuthenticationError extends PushFloError {
|
|
29
|
-
constructor(message: string, code?: string, options?: {
|
|
30
|
-
retryable?: boolean;
|
|
31
|
-
cause?: Error;
|
|
32
|
-
});
|
|
33
|
-
/**
|
|
34
|
-
* Create an invalid API key error
|
|
35
|
-
*/
|
|
36
|
-
static invalidKey(keyType?: string): AuthenticationError;
|
|
37
|
-
/**
|
|
38
|
-
* Create an unauthorized error
|
|
39
|
-
*/
|
|
40
|
-
static unauthorized(reason?: string): AuthenticationError;
|
|
41
|
-
/**
|
|
42
|
-
* Create a forbidden error
|
|
43
|
-
*/
|
|
44
|
-
static forbidden(action?: string): AuthenticationError;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Error thrown for network-related failures
|
|
49
|
-
*/
|
|
50
|
-
declare class NetworkError extends PushFloError {
|
|
51
|
-
/** HTTP status code, if applicable */
|
|
52
|
-
readonly statusCode?: number;
|
|
53
|
-
constructor(message: string, code?: string, options?: {
|
|
54
|
-
retryable?: boolean;
|
|
55
|
-
cause?: Error;
|
|
56
|
-
statusCode?: number;
|
|
57
|
-
});
|
|
58
|
-
/**
|
|
59
|
-
* Create a network error from fetch failure
|
|
60
|
-
*/
|
|
61
|
-
static fromFetch(cause: Error): NetworkError;
|
|
62
|
-
/**
|
|
63
|
-
* Create a request timeout error
|
|
64
|
-
*/
|
|
65
|
-
static timeout(timeoutMs: number): NetworkError;
|
|
66
|
-
/**
|
|
67
|
-
* Create an error from HTTP status code
|
|
68
|
-
*/
|
|
69
|
-
static fromStatus(statusCode: number, message?: string): NetworkError;
|
|
70
|
-
private static getStatusMessage;
|
|
71
|
-
toJSON(): Record<string, unknown>;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Error thrown when input validation fails
|
|
76
|
-
*/
|
|
77
|
-
declare class ValidationError extends PushFloError {
|
|
78
|
-
/** The field that failed validation */
|
|
79
|
-
readonly field?: string;
|
|
80
|
-
constructor(message: string, field?: string);
|
|
81
|
-
/**
|
|
82
|
-
* Create an error for an invalid channel slug
|
|
83
|
-
*/
|
|
84
|
-
static invalidChannelSlug(slug: string): ValidationError;
|
|
85
|
-
/**
|
|
86
|
-
* Create an error for a required field
|
|
87
|
-
*/
|
|
88
|
-
static required(field: string): ValidationError;
|
|
89
|
-
toJSON(): Record<string, unknown>;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
1
|
/**
|
|
93
2
|
* Channel slug validation utilities
|
|
94
3
|
*
|
|
95
4
|
* Channel slugs must follow these rules:
|
|
96
|
-
* - 1-
|
|
5
|
+
* - 1-128 characters long
|
|
97
6
|
* - Lowercase letters (a-z), numbers (0-9), and hyphens (-) only
|
|
98
7
|
* - Cannot start or end with a hyphen
|
|
99
8
|
* - Cannot have consecutive hyphens
|
|
100
9
|
*/
|
|
101
10
|
/** Maximum length for a channel slug */
|
|
102
|
-
declare const MAX_SLUG_LENGTH =
|
|
11
|
+
declare const MAX_SLUG_LENGTH = 128;
|
|
103
12
|
/** Minimum length for a channel slug */
|
|
104
13
|
declare const MIN_SLUG_LENGTH = 1;
|
|
105
14
|
/**
|
|
@@ -226,4 +135,4 @@ interface Pagination {
|
|
|
226
135
|
totalPages: number;
|
|
227
136
|
}
|
|
228
137
|
|
|
229
|
-
export {
|
|
138
|
+
export { type Channel as C, type ListChannelsOptions as L, MAX_SLUG_LENGTH as M, type Pagination as P, type SlugValidationResult as S, type ChannelInput as a, type ChannelUpdateInput as b, MIN_SLUG_LENGTH as c, isValidChannelSlug as i, toChannelSlug as t, validateChannelSlug as v };
|
|
@@ -1,105 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base error class for all PushFlo SDK errors
|
|
3
|
-
*/
|
|
4
|
-
declare class PushFloError extends Error {
|
|
5
|
-
/** Error code for programmatic handling */
|
|
6
|
-
readonly code: string;
|
|
7
|
-
/** Whether this error is potentially recoverable through retry */
|
|
8
|
-
readonly retryable: boolean;
|
|
9
|
-
/** Original error that caused this error, if any */
|
|
10
|
-
readonly cause?: Error;
|
|
11
|
-
constructor(message: string, code: string, options?: {
|
|
12
|
-
retryable?: boolean;
|
|
13
|
-
cause?: Error;
|
|
14
|
-
});
|
|
15
|
-
/**
|
|
16
|
-
* Convert error to JSON-serializable object
|
|
17
|
-
*/
|
|
18
|
-
toJSON(): Record<string, unknown>;
|
|
19
|
-
/**
|
|
20
|
-
* Create a string representation
|
|
21
|
-
*/
|
|
22
|
-
toString(): string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Error thrown when authentication fails
|
|
27
|
-
*/
|
|
28
|
-
declare class AuthenticationError extends PushFloError {
|
|
29
|
-
constructor(message: string, code?: string, options?: {
|
|
30
|
-
retryable?: boolean;
|
|
31
|
-
cause?: Error;
|
|
32
|
-
});
|
|
33
|
-
/**
|
|
34
|
-
* Create an invalid API key error
|
|
35
|
-
*/
|
|
36
|
-
static invalidKey(keyType?: string): AuthenticationError;
|
|
37
|
-
/**
|
|
38
|
-
* Create an unauthorized error
|
|
39
|
-
*/
|
|
40
|
-
static unauthorized(reason?: string): AuthenticationError;
|
|
41
|
-
/**
|
|
42
|
-
* Create a forbidden error
|
|
43
|
-
*/
|
|
44
|
-
static forbidden(action?: string): AuthenticationError;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Error thrown for network-related failures
|
|
49
|
-
*/
|
|
50
|
-
declare class NetworkError extends PushFloError {
|
|
51
|
-
/** HTTP status code, if applicable */
|
|
52
|
-
readonly statusCode?: number;
|
|
53
|
-
constructor(message: string, code?: string, options?: {
|
|
54
|
-
retryable?: boolean;
|
|
55
|
-
cause?: Error;
|
|
56
|
-
statusCode?: number;
|
|
57
|
-
});
|
|
58
|
-
/**
|
|
59
|
-
* Create a network error from fetch failure
|
|
60
|
-
*/
|
|
61
|
-
static fromFetch(cause: Error): NetworkError;
|
|
62
|
-
/**
|
|
63
|
-
* Create a request timeout error
|
|
64
|
-
*/
|
|
65
|
-
static timeout(timeoutMs: number): NetworkError;
|
|
66
|
-
/**
|
|
67
|
-
* Create an error from HTTP status code
|
|
68
|
-
*/
|
|
69
|
-
static fromStatus(statusCode: number, message?: string): NetworkError;
|
|
70
|
-
private static getStatusMessage;
|
|
71
|
-
toJSON(): Record<string, unknown>;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Error thrown when input validation fails
|
|
76
|
-
*/
|
|
77
|
-
declare class ValidationError extends PushFloError {
|
|
78
|
-
/** The field that failed validation */
|
|
79
|
-
readonly field?: string;
|
|
80
|
-
constructor(message: string, field?: string);
|
|
81
|
-
/**
|
|
82
|
-
* Create an error for an invalid channel slug
|
|
83
|
-
*/
|
|
84
|
-
static invalidChannelSlug(slug: string): ValidationError;
|
|
85
|
-
/**
|
|
86
|
-
* Create an error for a required field
|
|
87
|
-
*/
|
|
88
|
-
static required(field: string): ValidationError;
|
|
89
|
-
toJSON(): Record<string, unknown>;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
1
|
/**
|
|
93
2
|
* Channel slug validation utilities
|
|
94
3
|
*
|
|
95
4
|
* Channel slugs must follow these rules:
|
|
96
|
-
* - 1-
|
|
5
|
+
* - 1-128 characters long
|
|
97
6
|
* - Lowercase letters (a-z), numbers (0-9), and hyphens (-) only
|
|
98
7
|
* - Cannot start or end with a hyphen
|
|
99
8
|
* - Cannot have consecutive hyphens
|
|
100
9
|
*/
|
|
101
10
|
/** Maximum length for a channel slug */
|
|
102
|
-
declare const MAX_SLUG_LENGTH =
|
|
11
|
+
declare const MAX_SLUG_LENGTH = 128;
|
|
103
12
|
/** Minimum length for a channel slug */
|
|
104
13
|
declare const MIN_SLUG_LENGTH = 1;
|
|
105
14
|
/**
|
|
@@ -226,4 +135,4 @@ interface Pagination {
|
|
|
226
135
|
totalPages: number;
|
|
227
136
|
}
|
|
228
137
|
|
|
229
|
-
export {
|
|
138
|
+
export { type Channel as C, type ListChannelsOptions as L, MAX_SLUG_LENGTH as M, type Pagination as P, type SlugValidationResult as S, type ChannelInput as a, type ChannelUpdateInput as b, MIN_SLUG_LENGTH as c, isValidChannelSlug as i, toChannelSlug as t, validateChannelSlug as v };
|
package/dist/index.cjs
CHANGED
|
@@ -312,7 +312,7 @@ var ValidationError = class _ValidationError extends PushFloError {
|
|
|
312
312
|
};
|
|
313
313
|
|
|
314
314
|
// src/utils/validation.ts
|
|
315
|
-
var MAX_SLUG_LENGTH =
|
|
315
|
+
var MAX_SLUG_LENGTH = 128;
|
|
316
316
|
var MIN_SLUG_LENGTH = 1;
|
|
317
317
|
var SLUG_REGEX = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;
|
|
318
318
|
function isValidChannelSlug(slug) {
|