@cstar.help/js 0.18.1 → 0.18.4
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 +14 -8
- package/dist/auth/index.cjs +16 -13
- package/dist/auth/index.d.cts +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +16 -13
- package/dist/chat/index.d.cts +2 -2
- package/dist/chat/index.d.ts +2 -2
- package/dist/community/index.cjs +16 -13
- package/dist/community/index.d.cts +3 -3
- package/dist/community/index.d.ts +3 -3
- package/dist/community/index.js +16 -13
- package/dist/{errors-bW8CwTn4.d.cts → errors-BnUUTVlT.d.cts} +2 -1
- package/dist/{errors-bW8CwTn4.d.ts → errors-BnUUTVlT.d.ts} +2 -1
- package/dist/index.cjs +283 -123
- package/dist/index.d.cts +185 -64
- package/dist/index.d.ts +185 -64
- package/dist/index.js +283 -123
- package/dist/library/index.cjs +16 -13
- package/dist/library/index.d.cts +1 -1
- package/dist/library/index.d.ts +1 -1
- package/dist/library/index.js +16 -13
- package/dist/quickhelp/index.cjs +20 -15
- package/dist/quickhelp/index.d.cts +26 -2
- package/dist/quickhelp/index.d.ts +26 -2
- package/dist/quickhelp/index.js +20 -15
- package/dist/{types-DF7GprCV.d.cts → types-BHCahwev.d.cts} +3 -3
- package/dist/{types-DF7GprCV.d.ts → types-BHCahwev.d.ts} +3 -3
- package/dist/webhook/index.d.cts +1 -1
- package/dist/webhook/index.d.ts +1 -1
- package/dist/webhook/node.d.cts +1 -1
- package/dist/webhook/node.d.ts +1 -1
- package/dist/{webhookEvents-Lqpsj935.d.cts → webhookEvents-YQer37My.d.cts} +208 -83
- package/dist/{webhookEvents-Lqpsj935.d.ts → webhookEvents-YQer37My.d.ts} +208 -83
- package/package.json +1 -1
package/dist/library/index.cjs
CHANGED
|
@@ -49,7 +49,7 @@ var ErrorType = {
|
|
|
49
49
|
API_ERROR: "api_error",
|
|
50
50
|
SERVER_ERROR: "server_error"
|
|
51
51
|
};
|
|
52
|
-
var DEFAULT_DOC_URL = "https://cstar.help/developers/
|
|
52
|
+
var DEFAULT_DOC_URL = "https://www.cstar.help/developers/errors";
|
|
53
53
|
function normalizeArgs(messageOrStatus, maybeBody, defaults) {
|
|
54
54
|
if (typeof messageOrStatus === "string") {
|
|
55
55
|
return {
|
|
@@ -92,7 +92,7 @@ var CStarAuthenticationErrorImpl = class extends CStarErrorImpl {
|
|
|
92
92
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
93
93
|
type: ErrorType.AUTHENTICATION_ERROR,
|
|
94
94
|
code: "authentication_failed",
|
|
95
|
-
doc_url: `${DEFAULT_DOC_URL}#authentication-
|
|
95
|
+
doc_url: `${DEFAULT_DOC_URL}#authentication-errors`
|
|
96
96
|
});
|
|
97
97
|
super(statusCode, resolved);
|
|
98
98
|
this.name = "CStarAuthenticationError";
|
|
@@ -103,11 +103,11 @@ var CStarRateLimitErrorImpl = class extends CStarErrorImpl {
|
|
|
103
103
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
104
104
|
type: ErrorType.RATE_LIMIT_ERROR,
|
|
105
105
|
code: "rate_limit_exceeded",
|
|
106
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
106
|
+
doc_url: `${DEFAULT_DOC_URL}#rate_limit_exceeded`
|
|
107
107
|
});
|
|
108
108
|
super(statusCode === 0 ? 429 : statusCode, resolved);
|
|
109
109
|
this.name = "CStarRateLimitError";
|
|
110
|
-
this.retryAfter = retryAfter
|
|
110
|
+
this.retryAfter = retryAfter;
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
|
|
@@ -115,7 +115,7 @@ var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
|
|
|
115
115
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
116
116
|
type: ErrorType.NOT_FOUND_ERROR,
|
|
117
117
|
code: "resource_not_found",
|
|
118
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
118
|
+
doc_url: `${DEFAULT_DOC_URL}#resource_not_found`
|
|
119
119
|
});
|
|
120
120
|
super(statusCode, resolved);
|
|
121
121
|
this.name = "CStarNotFoundError";
|
|
@@ -126,7 +126,7 @@ var CStarValidationErrorImpl = class extends CStarErrorImpl {
|
|
|
126
126
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
127
127
|
type: ErrorType.INVALID_REQUEST_ERROR,
|
|
128
128
|
code: "validation_error",
|
|
129
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
129
|
+
doc_url: `${DEFAULT_DOC_URL}#invalid-request-errors`
|
|
130
130
|
});
|
|
131
131
|
super(statusCode, resolved);
|
|
132
132
|
this.name = "CStarValidationError";
|
|
@@ -137,7 +137,7 @@ var CStarPermissionErrorImpl = class extends CStarErrorImpl {
|
|
|
137
137
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
138
138
|
type: ErrorType.PERMISSION_ERROR,
|
|
139
139
|
code: "permission_denied",
|
|
140
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
140
|
+
doc_url: `${DEFAULT_DOC_URL}#insufficient_permissions`
|
|
141
141
|
});
|
|
142
142
|
super(statusCode, resolved);
|
|
143
143
|
this.name = "CStarPermissionError";
|
|
@@ -148,7 +148,7 @@ var CStarConflictErrorImpl = class extends CStarErrorImpl {
|
|
|
148
148
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
149
149
|
type: ErrorType.CONFLICT_ERROR,
|
|
150
150
|
code: "conflict",
|
|
151
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
151
|
+
doc_url: `${DEFAULT_DOC_URL}#resource_conflict`
|
|
152
152
|
});
|
|
153
153
|
super(statusCode, resolved);
|
|
154
154
|
this.name = "CStarConflictError";
|
|
@@ -159,7 +159,7 @@ var CStarServerErrorImpl = class extends CStarErrorImpl {
|
|
|
159
159
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
160
160
|
type: ErrorType.SERVER_ERROR,
|
|
161
161
|
code: "server_error",
|
|
162
|
-
doc_url: `${DEFAULT_DOC_URL}#server-
|
|
162
|
+
doc_url: `${DEFAULT_DOC_URL}#server-errors`
|
|
163
163
|
});
|
|
164
164
|
super(statusCode, resolved);
|
|
165
165
|
this.name = "CStarServerError";
|
|
@@ -170,7 +170,7 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
|
|
|
170
170
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
171
171
|
type: ErrorType.FEATURE_NOT_CONFIGURED,
|
|
172
172
|
code: "feature_not_configured",
|
|
173
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
173
|
+
doc_url: `${DEFAULT_DOC_URL}#feature_disabled`
|
|
174
174
|
});
|
|
175
175
|
super(statusCode, resolved);
|
|
176
176
|
this.name = "CStarFeatureDisabledError";
|
|
@@ -180,12 +180,12 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
|
|
|
180
180
|
};
|
|
181
181
|
var CStarRealtimeUnavailableErrorImpl = class extends CStarErrorImpl {
|
|
182
182
|
constructor(message) {
|
|
183
|
-
const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://cstar.help/developers/sdk/realtime#ssr";
|
|
183
|
+
const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://www.cstar.help/developers/sdk/js/realtime#ssr";
|
|
184
184
|
super(0, {
|
|
185
185
|
type: ErrorType.API_ERROR,
|
|
186
186
|
code: "realtime_unavailable",
|
|
187
187
|
message: resolved,
|
|
188
|
-
doc_url: "https://cstar.help/developers/sdk/realtime#ssr"
|
|
188
|
+
doc_url: "https://www.cstar.help/developers/sdk/js/realtime#ssr"
|
|
189
189
|
});
|
|
190
190
|
this.name = "CStarRealtimeUnavailableError";
|
|
191
191
|
}
|
|
@@ -292,7 +292,10 @@ function parseError(statusCode, body, retryAfter) {
|
|
|
292
292
|
doc_url: DEFAULT_DOC_URL
|
|
293
293
|
};
|
|
294
294
|
if (statusCode === 429) {
|
|
295
|
-
return new CStarRateLimitError(statusCode, errorBody, retryAfter
|
|
295
|
+
return new CStarRateLimitError(statusCode, errorBody, retryAfter);
|
|
296
|
+
}
|
|
297
|
+
if (errorBody.code === "feature_disabled") {
|
|
298
|
+
return new CStarFeatureDisabledError(statusCode, errorBody);
|
|
296
299
|
}
|
|
297
300
|
const StatusCls = STATUS_TO_CLASS[statusCode];
|
|
298
301
|
if (StatusCls) {
|
package/dist/library/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiErrorBody, C as CStarAuthenticationError, a as CStarConflictError, b as CStarError, c as CStarFeatureDisabledError, d as CStarNotFoundError, e as CStarPermissionError, f as CStarRateLimitError, g as CStarRealtimeUnavailableError, h as CStarServerError, i as CStarValidationError, E as ErrorType, p as parseError, j as parsePublicError } from '../errors-
|
|
1
|
+
export { A as ApiErrorBody, C as CStarAuthenticationError, a as CStarConflictError, b as CStarError, c as CStarFeatureDisabledError, d as CStarNotFoundError, e as CStarPermissionError, f as CStarRateLimitError, g as CStarRealtimeUnavailableError, h as CStarServerError, i as CStarValidationError, E as ErrorType, p as parseError, j as parsePublicError } from '../errors-BnUUTVlT.cjs';
|
|
2
2
|
|
|
3
3
|
/** Configuration for the LibraryClient. */
|
|
4
4
|
interface LibraryConfig {
|
package/dist/library/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiErrorBody, C as CStarAuthenticationError, a as CStarConflictError, b as CStarError, c as CStarFeatureDisabledError, d as CStarNotFoundError, e as CStarPermissionError, f as CStarRateLimitError, g as CStarRealtimeUnavailableError, h as CStarServerError, i as CStarValidationError, E as ErrorType, p as parseError, j as parsePublicError } from '../errors-
|
|
1
|
+
export { A as ApiErrorBody, C as CStarAuthenticationError, a as CStarConflictError, b as CStarError, c as CStarFeatureDisabledError, d as CStarNotFoundError, e as CStarPermissionError, f as CStarRateLimitError, g as CStarRealtimeUnavailableError, h as CStarServerError, i as CStarValidationError, E as ErrorType, p as parseError, j as parsePublicError } from '../errors-BnUUTVlT.js';
|
|
2
2
|
|
|
3
3
|
/** Configuration for the LibraryClient. */
|
|
4
4
|
interface LibraryConfig {
|
package/dist/library/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var ErrorType = {
|
|
|
10
10
|
API_ERROR: "api_error",
|
|
11
11
|
SERVER_ERROR: "server_error"
|
|
12
12
|
};
|
|
13
|
-
var DEFAULT_DOC_URL = "https://cstar.help/developers/
|
|
13
|
+
var DEFAULT_DOC_URL = "https://www.cstar.help/developers/errors";
|
|
14
14
|
function normalizeArgs(messageOrStatus, maybeBody, defaults) {
|
|
15
15
|
if (typeof messageOrStatus === "string") {
|
|
16
16
|
return {
|
|
@@ -53,7 +53,7 @@ var CStarAuthenticationErrorImpl = class extends CStarErrorImpl {
|
|
|
53
53
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
54
54
|
type: ErrorType.AUTHENTICATION_ERROR,
|
|
55
55
|
code: "authentication_failed",
|
|
56
|
-
doc_url: `${DEFAULT_DOC_URL}#authentication-
|
|
56
|
+
doc_url: `${DEFAULT_DOC_URL}#authentication-errors`
|
|
57
57
|
});
|
|
58
58
|
super(statusCode, resolved);
|
|
59
59
|
this.name = "CStarAuthenticationError";
|
|
@@ -64,11 +64,11 @@ var CStarRateLimitErrorImpl = class extends CStarErrorImpl {
|
|
|
64
64
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
65
65
|
type: ErrorType.RATE_LIMIT_ERROR,
|
|
66
66
|
code: "rate_limit_exceeded",
|
|
67
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
67
|
+
doc_url: `${DEFAULT_DOC_URL}#rate_limit_exceeded`
|
|
68
68
|
});
|
|
69
69
|
super(statusCode === 0 ? 429 : statusCode, resolved);
|
|
70
70
|
this.name = "CStarRateLimitError";
|
|
71
|
-
this.retryAfter = retryAfter
|
|
71
|
+
this.retryAfter = retryAfter;
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
|
|
@@ -76,7 +76,7 @@ var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
|
|
|
76
76
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
77
77
|
type: ErrorType.NOT_FOUND_ERROR,
|
|
78
78
|
code: "resource_not_found",
|
|
79
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
79
|
+
doc_url: `${DEFAULT_DOC_URL}#resource_not_found`
|
|
80
80
|
});
|
|
81
81
|
super(statusCode, resolved);
|
|
82
82
|
this.name = "CStarNotFoundError";
|
|
@@ -87,7 +87,7 @@ var CStarValidationErrorImpl = class extends CStarErrorImpl {
|
|
|
87
87
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
88
88
|
type: ErrorType.INVALID_REQUEST_ERROR,
|
|
89
89
|
code: "validation_error",
|
|
90
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
90
|
+
doc_url: `${DEFAULT_DOC_URL}#invalid-request-errors`
|
|
91
91
|
});
|
|
92
92
|
super(statusCode, resolved);
|
|
93
93
|
this.name = "CStarValidationError";
|
|
@@ -98,7 +98,7 @@ var CStarPermissionErrorImpl = class extends CStarErrorImpl {
|
|
|
98
98
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
99
99
|
type: ErrorType.PERMISSION_ERROR,
|
|
100
100
|
code: "permission_denied",
|
|
101
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
101
|
+
doc_url: `${DEFAULT_DOC_URL}#insufficient_permissions`
|
|
102
102
|
});
|
|
103
103
|
super(statusCode, resolved);
|
|
104
104
|
this.name = "CStarPermissionError";
|
|
@@ -109,7 +109,7 @@ var CStarConflictErrorImpl = class extends CStarErrorImpl {
|
|
|
109
109
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
110
110
|
type: ErrorType.CONFLICT_ERROR,
|
|
111
111
|
code: "conflict",
|
|
112
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
112
|
+
doc_url: `${DEFAULT_DOC_URL}#resource_conflict`
|
|
113
113
|
});
|
|
114
114
|
super(statusCode, resolved);
|
|
115
115
|
this.name = "CStarConflictError";
|
|
@@ -120,7 +120,7 @@ var CStarServerErrorImpl = class extends CStarErrorImpl {
|
|
|
120
120
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
121
121
|
type: ErrorType.SERVER_ERROR,
|
|
122
122
|
code: "server_error",
|
|
123
|
-
doc_url: `${DEFAULT_DOC_URL}#server-
|
|
123
|
+
doc_url: `${DEFAULT_DOC_URL}#server-errors`
|
|
124
124
|
});
|
|
125
125
|
super(statusCode, resolved);
|
|
126
126
|
this.name = "CStarServerError";
|
|
@@ -131,7 +131,7 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
|
|
|
131
131
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
132
132
|
type: ErrorType.FEATURE_NOT_CONFIGURED,
|
|
133
133
|
code: "feature_not_configured",
|
|
134
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
134
|
+
doc_url: `${DEFAULT_DOC_URL}#feature_disabled`
|
|
135
135
|
});
|
|
136
136
|
super(statusCode, resolved);
|
|
137
137
|
this.name = "CStarFeatureDisabledError";
|
|
@@ -141,12 +141,12 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
|
|
|
141
141
|
};
|
|
142
142
|
var CStarRealtimeUnavailableErrorImpl = class extends CStarErrorImpl {
|
|
143
143
|
constructor(message) {
|
|
144
|
-
const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://cstar.help/developers/sdk/realtime#ssr";
|
|
144
|
+
const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://www.cstar.help/developers/sdk/js/realtime#ssr";
|
|
145
145
|
super(0, {
|
|
146
146
|
type: ErrorType.API_ERROR,
|
|
147
147
|
code: "realtime_unavailable",
|
|
148
148
|
message: resolved,
|
|
149
|
-
doc_url: "https://cstar.help/developers/sdk/realtime#ssr"
|
|
149
|
+
doc_url: "https://www.cstar.help/developers/sdk/js/realtime#ssr"
|
|
150
150
|
});
|
|
151
151
|
this.name = "CStarRealtimeUnavailableError";
|
|
152
152
|
}
|
|
@@ -253,7 +253,10 @@ function parseError(statusCode, body, retryAfter) {
|
|
|
253
253
|
doc_url: DEFAULT_DOC_URL
|
|
254
254
|
};
|
|
255
255
|
if (statusCode === 429) {
|
|
256
|
-
return new CStarRateLimitError(statusCode, errorBody, retryAfter
|
|
256
|
+
return new CStarRateLimitError(statusCode, errorBody, retryAfter);
|
|
257
|
+
}
|
|
258
|
+
if (errorBody.code === "feature_disabled") {
|
|
259
|
+
return new CStarFeatureDisabledError(statusCode, errorBody);
|
|
257
260
|
}
|
|
258
261
|
const StatusCls = STATUS_TO_CLASS[statusCode];
|
|
259
262
|
if (StatusCls) {
|
package/dist/quickhelp/index.cjs
CHANGED
|
@@ -50,7 +50,7 @@ var ErrorType = {
|
|
|
50
50
|
API_ERROR: "api_error",
|
|
51
51
|
SERVER_ERROR: "server_error"
|
|
52
52
|
};
|
|
53
|
-
var DEFAULT_DOC_URL = "https://cstar.help/developers/
|
|
53
|
+
var DEFAULT_DOC_URL = "https://www.cstar.help/developers/errors";
|
|
54
54
|
function normalizeArgs(messageOrStatus, maybeBody, defaults) {
|
|
55
55
|
if (typeof messageOrStatus === "string") {
|
|
56
56
|
return {
|
|
@@ -93,7 +93,7 @@ var CStarAuthenticationErrorImpl = class extends CStarErrorImpl {
|
|
|
93
93
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
94
94
|
type: ErrorType.AUTHENTICATION_ERROR,
|
|
95
95
|
code: "authentication_failed",
|
|
96
|
-
doc_url: `${DEFAULT_DOC_URL}#authentication-
|
|
96
|
+
doc_url: `${DEFAULT_DOC_URL}#authentication-errors`
|
|
97
97
|
});
|
|
98
98
|
super(statusCode, resolved);
|
|
99
99
|
this.name = "CStarAuthenticationError";
|
|
@@ -104,11 +104,11 @@ var CStarRateLimitErrorImpl = class extends CStarErrorImpl {
|
|
|
104
104
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
105
105
|
type: ErrorType.RATE_LIMIT_ERROR,
|
|
106
106
|
code: "rate_limit_exceeded",
|
|
107
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
107
|
+
doc_url: `${DEFAULT_DOC_URL}#rate_limit_exceeded`
|
|
108
108
|
});
|
|
109
109
|
super(statusCode === 0 ? 429 : statusCode, resolved);
|
|
110
110
|
this.name = "CStarRateLimitError";
|
|
111
|
-
this.retryAfter = retryAfter
|
|
111
|
+
this.retryAfter = retryAfter;
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
|
|
@@ -116,7 +116,7 @@ var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
|
|
|
116
116
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
117
117
|
type: ErrorType.NOT_FOUND_ERROR,
|
|
118
118
|
code: "resource_not_found",
|
|
119
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
119
|
+
doc_url: `${DEFAULT_DOC_URL}#resource_not_found`
|
|
120
120
|
});
|
|
121
121
|
super(statusCode, resolved);
|
|
122
122
|
this.name = "CStarNotFoundError";
|
|
@@ -127,7 +127,7 @@ var CStarValidationErrorImpl = class extends CStarErrorImpl {
|
|
|
127
127
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
128
128
|
type: ErrorType.INVALID_REQUEST_ERROR,
|
|
129
129
|
code: "validation_error",
|
|
130
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
130
|
+
doc_url: `${DEFAULT_DOC_URL}#invalid-request-errors`
|
|
131
131
|
});
|
|
132
132
|
super(statusCode, resolved);
|
|
133
133
|
this.name = "CStarValidationError";
|
|
@@ -138,7 +138,7 @@ var CStarPermissionErrorImpl = class extends CStarErrorImpl {
|
|
|
138
138
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
139
139
|
type: ErrorType.PERMISSION_ERROR,
|
|
140
140
|
code: "permission_denied",
|
|
141
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
141
|
+
doc_url: `${DEFAULT_DOC_URL}#insufficient_permissions`
|
|
142
142
|
});
|
|
143
143
|
super(statusCode, resolved);
|
|
144
144
|
this.name = "CStarPermissionError";
|
|
@@ -149,7 +149,7 @@ var CStarConflictErrorImpl = class extends CStarErrorImpl {
|
|
|
149
149
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
150
150
|
type: ErrorType.CONFLICT_ERROR,
|
|
151
151
|
code: "conflict",
|
|
152
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
152
|
+
doc_url: `${DEFAULT_DOC_URL}#resource_conflict`
|
|
153
153
|
});
|
|
154
154
|
super(statusCode, resolved);
|
|
155
155
|
this.name = "CStarConflictError";
|
|
@@ -160,7 +160,7 @@ var CStarServerErrorImpl = class extends CStarErrorImpl {
|
|
|
160
160
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
161
161
|
type: ErrorType.SERVER_ERROR,
|
|
162
162
|
code: "server_error",
|
|
163
|
-
doc_url: `${DEFAULT_DOC_URL}#server-
|
|
163
|
+
doc_url: `${DEFAULT_DOC_URL}#server-errors`
|
|
164
164
|
});
|
|
165
165
|
super(statusCode, resolved);
|
|
166
166
|
this.name = "CStarServerError";
|
|
@@ -171,7 +171,7 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
|
|
|
171
171
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
172
172
|
type: ErrorType.FEATURE_NOT_CONFIGURED,
|
|
173
173
|
code: "feature_not_configured",
|
|
174
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
174
|
+
doc_url: `${DEFAULT_DOC_URL}#feature_disabled`
|
|
175
175
|
});
|
|
176
176
|
super(statusCode, resolved);
|
|
177
177
|
this.name = "CStarFeatureDisabledError";
|
|
@@ -181,12 +181,12 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
|
|
|
181
181
|
};
|
|
182
182
|
var CStarRealtimeUnavailableErrorImpl = class extends CStarErrorImpl {
|
|
183
183
|
constructor(message) {
|
|
184
|
-
const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://cstar.help/developers/sdk/realtime#ssr";
|
|
184
|
+
const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://www.cstar.help/developers/sdk/js/realtime#ssr";
|
|
185
185
|
super(0, {
|
|
186
186
|
type: ErrorType.API_ERROR,
|
|
187
187
|
code: "realtime_unavailable",
|
|
188
188
|
message: resolved,
|
|
189
|
-
doc_url: "https://cstar.help/developers/sdk/realtime#ssr"
|
|
189
|
+
doc_url: "https://www.cstar.help/developers/sdk/js/realtime#ssr"
|
|
190
190
|
});
|
|
191
191
|
this.name = "CStarRealtimeUnavailableError";
|
|
192
192
|
}
|
|
@@ -293,7 +293,10 @@ function parseError(statusCode, body, retryAfter) {
|
|
|
293
293
|
doc_url: DEFAULT_DOC_URL
|
|
294
294
|
};
|
|
295
295
|
if (statusCode === 429) {
|
|
296
|
-
return new CStarRateLimitError(statusCode, errorBody, retryAfter
|
|
296
|
+
return new CStarRateLimitError(statusCode, errorBody, retryAfter);
|
|
297
|
+
}
|
|
298
|
+
if (errorBody.code === "feature_disabled") {
|
|
299
|
+
return new CStarFeatureDisabledError(statusCode, errorBody);
|
|
297
300
|
}
|
|
298
301
|
const StatusCls = STATUS_TO_CLASS[statusCode];
|
|
299
302
|
if (StatusCls) {
|
|
@@ -408,7 +411,7 @@ var QuickHelpClient = class {
|
|
|
408
411
|
type: "feature_not_configured",
|
|
409
412
|
code: "feature_not_configured",
|
|
410
413
|
message: body?.error?.message ?? "Quick Help is not available on this team. Enable an AI Agent (Settings \u2192 AI Agents) and configure Quick Help (Settings \u2192 Quick Help) before calling .ask().",
|
|
411
|
-
doc_url: "https://cstar.help/developers/
|
|
414
|
+
doc_url: "https://www.cstar.help/developers/errors#service_unavailable",
|
|
412
415
|
feature: "quickHelp",
|
|
413
416
|
enable_url: `${this.baseUrl}/team/${encodeURIComponent(teamId)}/settings?section=quickHelp`
|
|
414
417
|
});
|
|
@@ -417,11 +420,12 @@ var QuickHelpClient = class {
|
|
|
417
420
|
const err = new QuickHelpError(message, {
|
|
418
421
|
status: res.status,
|
|
419
422
|
code: body?.error?.code,
|
|
423
|
+
reason: body?.error?.reason,
|
|
420
424
|
retryAfterSeconds: parseRetryAfter(res.headers.get("retry-after"))
|
|
421
425
|
});
|
|
422
426
|
throw err;
|
|
423
427
|
}
|
|
424
|
-
return body.data;
|
|
428
|
+
return { ...body.data, sources: body.data.sources ?? [] };
|
|
425
429
|
}
|
|
426
430
|
};
|
|
427
431
|
var QuickHelpError = class extends Error {
|
|
@@ -430,6 +434,7 @@ var QuickHelpError = class extends Error {
|
|
|
430
434
|
this.name = "QuickHelpError";
|
|
431
435
|
this.status = opts.status;
|
|
432
436
|
this.code = opts.code;
|
|
437
|
+
this.reason = opts.reason;
|
|
433
438
|
this.retryAfterSeconds = opts.retryAfterSeconds;
|
|
434
439
|
}
|
|
435
440
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiErrorBody, C as CStarAuthenticationError, a as CStarConflictError, b as CStarError, c as CStarFeatureDisabledError, d as CStarNotFoundError, e as CStarPermissionError, f as CStarRateLimitError, g as CStarRealtimeUnavailableError, h as CStarServerError, i as CStarValidationError, E as ErrorType, p as parseError, j as parsePublicError } from '../errors-
|
|
1
|
+
export { A as ApiErrorBody, C as CStarAuthenticationError, a as CStarConflictError, b as CStarError, c as CStarFeatureDisabledError, d as CStarNotFoundError, e as CStarPermissionError, f as CStarRateLimitError, g as CStarRealtimeUnavailableError, h as CStarServerError, i as CStarValidationError, E as ErrorType, p as parseError, j as parsePublicError } from '../errors-BnUUTVlT.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for the QuickHelpClient. No auth — Quick Help is anonymous by
|
|
@@ -50,9 +50,30 @@ interface QuickHelpAskParams {
|
|
|
50
50
|
*/
|
|
51
51
|
sessionId?: string | null;
|
|
52
52
|
}
|
|
53
|
+
/** A help article or page an answer was drawn from. */
|
|
54
|
+
interface QuickHelpSource {
|
|
55
|
+
title: string;
|
|
56
|
+
/**
|
|
57
|
+
* Public URL: the article in your help center (your verified custom help
|
|
58
|
+
* domain, or your cStar library), or a page on one of your Atlas sites.
|
|
59
|
+
* `null` when the source has no public page, for example when your public
|
|
60
|
+
* library is off or the article is test data. Show the title as text then.
|
|
61
|
+
*/
|
|
62
|
+
url: string | null;
|
|
63
|
+
}
|
|
53
64
|
interface QuickHelpAskResult {
|
|
54
65
|
sessionId: string;
|
|
66
|
+
/**
|
|
67
|
+
* The answer, in light markdown. It comes only from your published help
|
|
68
|
+
* content. When nothing matches, it is a fixed "not covered" message plus
|
|
69
|
+
* your configured contact options, and `turnOutcome` is `escalated`.
|
|
70
|
+
*/
|
|
55
71
|
answer: string;
|
|
72
|
+
/**
|
|
73
|
+
* The articles and pages this answer used. Empty when the help content
|
|
74
|
+
* did not cover the question.
|
|
75
|
+
*/
|
|
76
|
+
sources: QuickHelpSource[];
|
|
56
77
|
turnOutcome: QuickHelpTurnOutcome;
|
|
57
78
|
turnNumber: number;
|
|
58
79
|
}
|
|
@@ -121,12 +142,15 @@ declare class QuickHelpClient {
|
|
|
121
142
|
declare class QuickHelpError extends Error {
|
|
122
143
|
readonly status: number;
|
|
123
144
|
readonly code?: string;
|
|
145
|
+
/** The Quick Help cause behind `code`, e.g. `rate_limited`. */
|
|
146
|
+
readonly reason?: string;
|
|
124
147
|
readonly retryAfterSeconds?: number;
|
|
125
148
|
constructor(message: string, opts: {
|
|
126
149
|
status: number;
|
|
127
150
|
code?: string;
|
|
151
|
+
reason?: string;
|
|
128
152
|
retryAfterSeconds?: number;
|
|
129
153
|
});
|
|
130
154
|
}
|
|
131
155
|
|
|
132
|
-
export { type QuickHelpAskParams, type QuickHelpAskResult, QuickHelpClient, type QuickHelpConfig, QuickHelpError, type QuickHelpPublicConfig, type QuickHelpTurnOutcome };
|
|
156
|
+
export { type QuickHelpAskParams, type QuickHelpAskResult, QuickHelpClient, type QuickHelpConfig, QuickHelpError, type QuickHelpPublicConfig, type QuickHelpSource, type QuickHelpTurnOutcome };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiErrorBody, C as CStarAuthenticationError, a as CStarConflictError, b as CStarError, c as CStarFeatureDisabledError, d as CStarNotFoundError, e as CStarPermissionError, f as CStarRateLimitError, g as CStarRealtimeUnavailableError, h as CStarServerError, i as CStarValidationError, E as ErrorType, p as parseError, j as parsePublicError } from '../errors-
|
|
1
|
+
export { A as ApiErrorBody, C as CStarAuthenticationError, a as CStarConflictError, b as CStarError, c as CStarFeatureDisabledError, d as CStarNotFoundError, e as CStarPermissionError, f as CStarRateLimitError, g as CStarRealtimeUnavailableError, h as CStarServerError, i as CStarValidationError, E as ErrorType, p as parseError, j as parsePublicError } from '../errors-BnUUTVlT.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Options for the QuickHelpClient. No auth — Quick Help is anonymous by
|
|
@@ -50,9 +50,30 @@ interface QuickHelpAskParams {
|
|
|
50
50
|
*/
|
|
51
51
|
sessionId?: string | null;
|
|
52
52
|
}
|
|
53
|
+
/** A help article or page an answer was drawn from. */
|
|
54
|
+
interface QuickHelpSource {
|
|
55
|
+
title: string;
|
|
56
|
+
/**
|
|
57
|
+
* Public URL: the article in your help center (your verified custom help
|
|
58
|
+
* domain, or your cStar library), or a page on one of your Atlas sites.
|
|
59
|
+
* `null` when the source has no public page, for example when your public
|
|
60
|
+
* library is off or the article is test data. Show the title as text then.
|
|
61
|
+
*/
|
|
62
|
+
url: string | null;
|
|
63
|
+
}
|
|
53
64
|
interface QuickHelpAskResult {
|
|
54
65
|
sessionId: string;
|
|
66
|
+
/**
|
|
67
|
+
* The answer, in light markdown. It comes only from your published help
|
|
68
|
+
* content. When nothing matches, it is a fixed "not covered" message plus
|
|
69
|
+
* your configured contact options, and `turnOutcome` is `escalated`.
|
|
70
|
+
*/
|
|
55
71
|
answer: string;
|
|
72
|
+
/**
|
|
73
|
+
* The articles and pages this answer used. Empty when the help content
|
|
74
|
+
* did not cover the question.
|
|
75
|
+
*/
|
|
76
|
+
sources: QuickHelpSource[];
|
|
56
77
|
turnOutcome: QuickHelpTurnOutcome;
|
|
57
78
|
turnNumber: number;
|
|
58
79
|
}
|
|
@@ -121,12 +142,15 @@ declare class QuickHelpClient {
|
|
|
121
142
|
declare class QuickHelpError extends Error {
|
|
122
143
|
readonly status: number;
|
|
123
144
|
readonly code?: string;
|
|
145
|
+
/** The Quick Help cause behind `code`, e.g. `rate_limited`. */
|
|
146
|
+
readonly reason?: string;
|
|
124
147
|
readonly retryAfterSeconds?: number;
|
|
125
148
|
constructor(message: string, opts: {
|
|
126
149
|
status: number;
|
|
127
150
|
code?: string;
|
|
151
|
+
reason?: string;
|
|
128
152
|
retryAfterSeconds?: number;
|
|
129
153
|
});
|
|
130
154
|
}
|
|
131
155
|
|
|
132
|
-
export { type QuickHelpAskParams, type QuickHelpAskResult, QuickHelpClient, type QuickHelpConfig, QuickHelpError, type QuickHelpPublicConfig, type QuickHelpTurnOutcome };
|
|
156
|
+
export { type QuickHelpAskParams, type QuickHelpAskResult, QuickHelpClient, type QuickHelpConfig, QuickHelpError, type QuickHelpPublicConfig, type QuickHelpSource, type QuickHelpTurnOutcome };
|
package/dist/quickhelp/index.js
CHANGED
|
@@ -10,7 +10,7 @@ var ErrorType = {
|
|
|
10
10
|
API_ERROR: "api_error",
|
|
11
11
|
SERVER_ERROR: "server_error"
|
|
12
12
|
};
|
|
13
|
-
var DEFAULT_DOC_URL = "https://cstar.help/developers/
|
|
13
|
+
var DEFAULT_DOC_URL = "https://www.cstar.help/developers/errors";
|
|
14
14
|
function normalizeArgs(messageOrStatus, maybeBody, defaults) {
|
|
15
15
|
if (typeof messageOrStatus === "string") {
|
|
16
16
|
return {
|
|
@@ -53,7 +53,7 @@ var CStarAuthenticationErrorImpl = class extends CStarErrorImpl {
|
|
|
53
53
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
54
54
|
type: ErrorType.AUTHENTICATION_ERROR,
|
|
55
55
|
code: "authentication_failed",
|
|
56
|
-
doc_url: `${DEFAULT_DOC_URL}#authentication-
|
|
56
|
+
doc_url: `${DEFAULT_DOC_URL}#authentication-errors`
|
|
57
57
|
});
|
|
58
58
|
super(statusCode, resolved);
|
|
59
59
|
this.name = "CStarAuthenticationError";
|
|
@@ -64,11 +64,11 @@ var CStarRateLimitErrorImpl = class extends CStarErrorImpl {
|
|
|
64
64
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
65
65
|
type: ErrorType.RATE_LIMIT_ERROR,
|
|
66
66
|
code: "rate_limit_exceeded",
|
|
67
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
67
|
+
doc_url: `${DEFAULT_DOC_URL}#rate_limit_exceeded`
|
|
68
68
|
});
|
|
69
69
|
super(statusCode === 0 ? 429 : statusCode, resolved);
|
|
70
70
|
this.name = "CStarRateLimitError";
|
|
71
|
-
this.retryAfter = retryAfter
|
|
71
|
+
this.retryAfter = retryAfter;
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
|
|
@@ -76,7 +76,7 @@ var CStarNotFoundErrorImpl = class extends CStarErrorImpl {
|
|
|
76
76
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
77
77
|
type: ErrorType.NOT_FOUND_ERROR,
|
|
78
78
|
code: "resource_not_found",
|
|
79
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
79
|
+
doc_url: `${DEFAULT_DOC_URL}#resource_not_found`
|
|
80
80
|
});
|
|
81
81
|
super(statusCode, resolved);
|
|
82
82
|
this.name = "CStarNotFoundError";
|
|
@@ -87,7 +87,7 @@ var CStarValidationErrorImpl = class extends CStarErrorImpl {
|
|
|
87
87
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
88
88
|
type: ErrorType.INVALID_REQUEST_ERROR,
|
|
89
89
|
code: "validation_error",
|
|
90
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
90
|
+
doc_url: `${DEFAULT_DOC_URL}#invalid-request-errors`
|
|
91
91
|
});
|
|
92
92
|
super(statusCode, resolved);
|
|
93
93
|
this.name = "CStarValidationError";
|
|
@@ -98,7 +98,7 @@ var CStarPermissionErrorImpl = class extends CStarErrorImpl {
|
|
|
98
98
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
99
99
|
type: ErrorType.PERMISSION_ERROR,
|
|
100
100
|
code: "permission_denied",
|
|
101
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
101
|
+
doc_url: `${DEFAULT_DOC_URL}#insufficient_permissions`
|
|
102
102
|
});
|
|
103
103
|
super(statusCode, resolved);
|
|
104
104
|
this.name = "CStarPermissionError";
|
|
@@ -109,7 +109,7 @@ var CStarConflictErrorImpl = class extends CStarErrorImpl {
|
|
|
109
109
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
110
110
|
type: ErrorType.CONFLICT_ERROR,
|
|
111
111
|
code: "conflict",
|
|
112
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
112
|
+
doc_url: `${DEFAULT_DOC_URL}#resource_conflict`
|
|
113
113
|
});
|
|
114
114
|
super(statusCode, resolved);
|
|
115
115
|
this.name = "CStarConflictError";
|
|
@@ -120,7 +120,7 @@ var CStarServerErrorImpl = class extends CStarErrorImpl {
|
|
|
120
120
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
121
121
|
type: ErrorType.SERVER_ERROR,
|
|
122
122
|
code: "server_error",
|
|
123
|
-
doc_url: `${DEFAULT_DOC_URL}#server-
|
|
123
|
+
doc_url: `${DEFAULT_DOC_URL}#server-errors`
|
|
124
124
|
});
|
|
125
125
|
super(statusCode, resolved);
|
|
126
126
|
this.name = "CStarServerError";
|
|
@@ -131,7 +131,7 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
|
|
|
131
131
|
const { statusCode, body: resolved } = normalizeArgs(messageOrStatus, body, {
|
|
132
132
|
type: ErrorType.FEATURE_NOT_CONFIGURED,
|
|
133
133
|
code: "feature_not_configured",
|
|
134
|
-
doc_url: `${DEFAULT_DOC_URL}#
|
|
134
|
+
doc_url: `${DEFAULT_DOC_URL}#feature_disabled`
|
|
135
135
|
});
|
|
136
136
|
super(statusCode, resolved);
|
|
137
137
|
this.name = "CStarFeatureDisabledError";
|
|
@@ -141,12 +141,12 @@ var CStarFeatureDisabledErrorImpl = class extends CStarErrorImpl {
|
|
|
141
141
|
};
|
|
142
142
|
var CStarRealtimeUnavailableErrorImpl = class extends CStarErrorImpl {
|
|
143
143
|
constructor(message) {
|
|
144
|
-
const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://cstar.help/developers/sdk/realtime#ssr";
|
|
144
|
+
const resolved = message ?? "EventSource is not available in this environment. Real-time subscriptions only work in the browser. Move the call to a client-only path (`useEffect` / `onMount`), or pass an `eventSource` polyfill via the realtime options. See https://www.cstar.help/developers/sdk/js/realtime#ssr";
|
|
145
145
|
super(0, {
|
|
146
146
|
type: ErrorType.API_ERROR,
|
|
147
147
|
code: "realtime_unavailable",
|
|
148
148
|
message: resolved,
|
|
149
|
-
doc_url: "https://cstar.help/developers/sdk/realtime#ssr"
|
|
149
|
+
doc_url: "https://www.cstar.help/developers/sdk/js/realtime#ssr"
|
|
150
150
|
});
|
|
151
151
|
this.name = "CStarRealtimeUnavailableError";
|
|
152
152
|
}
|
|
@@ -253,7 +253,10 @@ function parseError(statusCode, body, retryAfter) {
|
|
|
253
253
|
doc_url: DEFAULT_DOC_URL
|
|
254
254
|
};
|
|
255
255
|
if (statusCode === 429) {
|
|
256
|
-
return new CStarRateLimitError(statusCode, errorBody, retryAfter
|
|
256
|
+
return new CStarRateLimitError(statusCode, errorBody, retryAfter);
|
|
257
|
+
}
|
|
258
|
+
if (errorBody.code === "feature_disabled") {
|
|
259
|
+
return new CStarFeatureDisabledError(statusCode, errorBody);
|
|
257
260
|
}
|
|
258
261
|
const StatusCls = STATUS_TO_CLASS[statusCode];
|
|
259
262
|
if (StatusCls) {
|
|
@@ -368,7 +371,7 @@ var QuickHelpClient = class {
|
|
|
368
371
|
type: "feature_not_configured",
|
|
369
372
|
code: "feature_not_configured",
|
|
370
373
|
message: body?.error?.message ?? "Quick Help is not available on this team. Enable an AI Agent (Settings \u2192 AI Agents) and configure Quick Help (Settings \u2192 Quick Help) before calling .ask().",
|
|
371
|
-
doc_url: "https://cstar.help/developers/
|
|
374
|
+
doc_url: "https://www.cstar.help/developers/errors#service_unavailable",
|
|
372
375
|
feature: "quickHelp",
|
|
373
376
|
enable_url: `${this.baseUrl}/team/${encodeURIComponent(teamId)}/settings?section=quickHelp`
|
|
374
377
|
});
|
|
@@ -377,11 +380,12 @@ var QuickHelpClient = class {
|
|
|
377
380
|
const err = new QuickHelpError(message, {
|
|
378
381
|
status: res.status,
|
|
379
382
|
code: body?.error?.code,
|
|
383
|
+
reason: body?.error?.reason,
|
|
380
384
|
retryAfterSeconds: parseRetryAfter(res.headers.get("retry-after"))
|
|
381
385
|
});
|
|
382
386
|
throw err;
|
|
383
387
|
}
|
|
384
|
-
return body.data;
|
|
388
|
+
return { ...body.data, sources: body.data.sources ?? [] };
|
|
385
389
|
}
|
|
386
390
|
};
|
|
387
391
|
var QuickHelpError = class extends Error {
|
|
@@ -390,6 +394,7 @@ var QuickHelpError = class extends Error {
|
|
|
390
394
|
this.name = "QuickHelpError";
|
|
391
395
|
this.status = opts.status;
|
|
392
396
|
this.code = opts.code;
|
|
397
|
+
this.reason = opts.reason;
|
|
393
398
|
this.retryAfterSeconds = opts.retryAfterSeconds;
|
|
394
399
|
}
|
|
395
400
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Attachment metadata for community posts and comments (images only, max
|
|
1
|
+
/** Attachment metadata for community posts and comments (images only, max 4 MB each). */
|
|
2
2
|
interface CommunityAttachment {
|
|
3
3
|
filename: string;
|
|
4
4
|
content_type: string;
|
|
@@ -30,7 +30,7 @@ interface CommunityCreatePostParams {
|
|
|
30
30
|
topicId: string;
|
|
31
31
|
/** Custom field values keyed by field definition ID. */
|
|
32
32
|
customFields?: Record<string, string>;
|
|
33
|
-
/** Image attachments (max 10, images only,
|
|
33
|
+
/** Image attachments (max 10, images only, 4 MB each). */
|
|
34
34
|
attachments?: CommunityAttachment[];
|
|
35
35
|
}
|
|
36
36
|
/** Parameters for updating a post as the original author. */
|
|
@@ -53,7 +53,7 @@ interface CommunityCreateCommentParams {
|
|
|
53
53
|
body: string;
|
|
54
54
|
/** Parent comment ID for replies (optional, 1-level nesting). */
|
|
55
55
|
parentCommentId?: string | null;
|
|
56
|
-
/** Image attachments (max 5, images only,
|
|
56
|
+
/** Image attachments (max 5, images only, 4 MB each). */
|
|
57
57
|
attachments?: CommunityAttachment[];
|
|
58
58
|
}
|
|
59
59
|
/** Response from creating a post. */
|