@xylex-group/athena 2.9.0 → 2.11.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 +112 -28
- package/dist/browser.cjs +865 -74
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +3 -3
- package/dist/browser.d.ts +3 -3
- package/dist/browser.js +862 -75
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +785 -40
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.js +785 -40
- package/dist/cli/index.js.map +1 -1
- package/dist/{client-D6EIJdQS.d.ts → client-DD_UeF3Q.d.ts} +508 -22
- package/dist/{client-CfAE_QOj.d.cts → client-WqBuu60O.d.cts} +508 -22
- package/dist/index.cjs +865 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +862 -75
- package/dist/index.js.map +1 -1
- package/dist/{react-email-BvJ3fj_F.d.cts → module-BFMyVmwX.d.cts} +97 -2
- package/dist/{react-email-PLAJuZuO.d.ts → module-DRkIHtY-.d.ts} +97 -2
- package/dist/next/client.cjs +793 -40
- package/dist/next/client.cjs.map +1 -1
- package/dist/next/client.d.cts +3 -4
- package/dist/next/client.d.ts +3 -4
- package/dist/next/client.js +793 -40
- package/dist/next/client.js.map +1 -1
- package/dist/next/server.cjs +793 -40
- package/dist/next/server.cjs.map +1 -1
- package/dist/next/server.d.cts +2 -2
- package/dist/next/server.d.ts +2 -2
- package/dist/next/server.js +793 -40
- package/dist/next/server.js.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +2 -3
- package/dist/react.d.ts +2 -3
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/{shared-BW6hoLBY.d.cts → shared-B1ueL-Ox.d.cts} +3 -1
- package/dist/{shared-BiJvoURI.d.ts → shared-GPAprhBb.d.ts} +3 -1
- package/package.json +2 -2
package/dist/next/server.cjs
CHANGED
|
@@ -138,8 +138,8 @@ function parseCookies(cookieHeader) {
|
|
|
138
138
|
});
|
|
139
139
|
return cookieMap;
|
|
140
140
|
}
|
|
141
|
-
var getSessionCookie = (
|
|
142
|
-
const cookies = (
|
|
141
|
+
var getSessionCookie = (request2, config) => {
|
|
142
|
+
const cookies = (request2 instanceof Headers || !("headers" in request2) ? request2 : request2.headers).get("cookie");
|
|
143
143
|
if (!cookies) {
|
|
144
144
|
return null;
|
|
145
145
|
}
|
|
@@ -162,7 +162,7 @@ var getSessionCookie = (request, config) => {
|
|
|
162
162
|
|
|
163
163
|
// package.json
|
|
164
164
|
var package_default = {
|
|
165
|
-
version: "2.
|
|
165
|
+
version: "2.11.0"
|
|
166
166
|
};
|
|
167
167
|
|
|
168
168
|
// src/sdk-version.ts
|
|
@@ -1143,6 +1143,87 @@ function mergeCallOptions(base, override) {
|
|
|
1143
1143
|
}
|
|
1144
1144
|
};
|
|
1145
1145
|
}
|
|
1146
|
+
function copyDefinedField(target, source, targetKey, sourceKey) {
|
|
1147
|
+
if (!(sourceKey in source)) {
|
|
1148
|
+
return;
|
|
1149
|
+
}
|
|
1150
|
+
const value = source[sourceKey];
|
|
1151
|
+
if (value !== void 0) {
|
|
1152
|
+
target[targetKey] = value;
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
function normalizeEmailTemplateAttachmentsValue(value) {
|
|
1156
|
+
if (typeof value === "string" || value == null) {
|
|
1157
|
+
return value;
|
|
1158
|
+
}
|
|
1159
|
+
if (Array.isArray(value)) {
|
|
1160
|
+
return value.map((item) => normalizeEmailTemplateAttachmentsValue(item));
|
|
1161
|
+
}
|
|
1162
|
+
if (typeof value !== "object") {
|
|
1163
|
+
return value;
|
|
1164
|
+
}
|
|
1165
|
+
const attachment = { ...value };
|
|
1166
|
+
copyDefinedField(attachment, attachment, "file_url", "fileUrl");
|
|
1167
|
+
delete attachment.fileUrl;
|
|
1168
|
+
return attachment;
|
|
1169
|
+
}
|
|
1170
|
+
function normalizeAdminEmailTemplatePayload(payload) {
|
|
1171
|
+
const normalized = { ...payload };
|
|
1172
|
+
copyDefinedField(normalized, payload, "template_key", "templateKey");
|
|
1173
|
+
copyDefinedField(normalized, payload, "event_type", "eventType");
|
|
1174
|
+
copyDefinedField(normalized, payload, "subject_template", "subjectTemplate");
|
|
1175
|
+
copyDefinedField(normalized, payload, "text_template", "textTemplate");
|
|
1176
|
+
copyDefinedField(normalized, payload, "html_template", "htmlTemplate");
|
|
1177
|
+
copyDefinedField(normalized, payload, "variable_bindings", "variableBindings");
|
|
1178
|
+
copyDefinedField(normalized, payload, "attachment_failure_mode", "attachmentFailureMode");
|
|
1179
|
+
copyDefinedField(normalized, payload, "is_active", "isActive");
|
|
1180
|
+
if (Object.hasOwn(payload, "attachments")) {
|
|
1181
|
+
normalized.attachments = normalizeEmailTemplateAttachmentsValue(payload.attachments);
|
|
1182
|
+
}
|
|
1183
|
+
delete normalized.templateKey;
|
|
1184
|
+
delete normalized.eventType;
|
|
1185
|
+
delete normalized.subjectTemplate;
|
|
1186
|
+
delete normalized.textTemplate;
|
|
1187
|
+
delete normalized.htmlTemplate;
|
|
1188
|
+
delete normalized.variableBindings;
|
|
1189
|
+
delete normalized.attachmentFailureMode;
|
|
1190
|
+
delete normalized.isActive;
|
|
1191
|
+
return normalized;
|
|
1192
|
+
}
|
|
1193
|
+
function toReactEmailTemplateCompatibilityInput(input) {
|
|
1194
|
+
const payload = input;
|
|
1195
|
+
const compatibility = { ...payload };
|
|
1196
|
+
copyDefinedField(compatibility, payload, "templateKey", "template_key");
|
|
1197
|
+
copyDefinedField(compatibility, payload, "eventType", "event_type");
|
|
1198
|
+
copyDefinedField(compatibility, payload, "subjectTemplate", "subject_template");
|
|
1199
|
+
copyDefinedField(compatibility, payload, "textTemplate", "text_template");
|
|
1200
|
+
copyDefinedField(compatibility, payload, "htmlTemplate", "html_template");
|
|
1201
|
+
copyDefinedField(compatibility, payload, "variableBindings", "variable_bindings");
|
|
1202
|
+
copyDefinedField(compatibility, payload, "attachmentFailureMode", "attachment_failure_mode");
|
|
1203
|
+
copyDefinedField(compatibility, payload, "isActive", "is_active");
|
|
1204
|
+
return compatibility;
|
|
1205
|
+
}
|
|
1206
|
+
function normalizeAdminEmailTemplateSendPayload(payload) {
|
|
1207
|
+
const normalized = { ...payload };
|
|
1208
|
+
copyDefinedField(normalized, payload, "template_id", "templateId");
|
|
1209
|
+
copyDefinedField(normalized, payload, "recipient_email", "recipientEmail");
|
|
1210
|
+
copyDefinedField(normalized, payload, "render_variables", "renderVariables");
|
|
1211
|
+
copyDefinedField(normalized, payload, "user_id", "userId");
|
|
1212
|
+
copyDefinedField(normalized, payload, "organization_id", "organizationId");
|
|
1213
|
+
copyDefinedField(normalized, payload, "session_token", "sessionToken");
|
|
1214
|
+
copyDefinedField(normalized, payload, "attachment_failure_mode", "attachmentFailureMode");
|
|
1215
|
+
if (Object.hasOwn(payload, "attachments")) {
|
|
1216
|
+
normalized.attachments = normalizeEmailTemplateAttachmentsValue(payload.attachments);
|
|
1217
|
+
}
|
|
1218
|
+
delete normalized.templateId;
|
|
1219
|
+
delete normalized.recipientEmail;
|
|
1220
|
+
delete normalized.renderVariables;
|
|
1221
|
+
delete normalized.userId;
|
|
1222
|
+
delete normalized.organizationId;
|
|
1223
|
+
delete normalized.sessionToken;
|
|
1224
|
+
delete normalized.attachmentFailureMode;
|
|
1225
|
+
return normalized;
|
|
1226
|
+
}
|
|
1146
1227
|
function toSessionGuardFailure(sessionResult) {
|
|
1147
1228
|
if (sessionResult.status === 401 || sessionResult.data == null) {
|
|
1148
1229
|
return {
|
|
@@ -1449,7 +1530,7 @@ function createAuthClient(config = {}) {
|
|
|
1449
1530
|
...config,
|
|
1450
1531
|
baseUrl: normalizedBaseUrl
|
|
1451
1532
|
};
|
|
1452
|
-
const
|
|
1533
|
+
const request2 = (input, options) => {
|
|
1453
1534
|
const method = input.method ?? (input.body !== void 0 ? "POST" : inferDefaultMethod(input.endpoint));
|
|
1454
1535
|
const mergedOptions = mergeCallOptions(input.fetchOptions, options);
|
|
1455
1536
|
return callAuthEndpoint(
|
|
@@ -1462,7 +1543,7 @@ function createAuthClient(config = {}) {
|
|
|
1462
1543
|
};
|
|
1463
1544
|
const postGeneric = (endpoint, input, options) => {
|
|
1464
1545
|
const { payload, fetchOptions } = extractFetchOptions(input);
|
|
1465
|
-
return
|
|
1546
|
+
return request2(
|
|
1466
1547
|
{
|
|
1467
1548
|
endpoint,
|
|
1468
1549
|
method: "POST",
|
|
@@ -1474,7 +1555,7 @@ function createAuthClient(config = {}) {
|
|
|
1474
1555
|
};
|
|
1475
1556
|
const getGeneric = (endpoint, input, options) => {
|
|
1476
1557
|
const { fetchOptions } = extractFetchOptions(input);
|
|
1477
|
-
return
|
|
1558
|
+
return request2(
|
|
1478
1559
|
{
|
|
1479
1560
|
endpoint,
|
|
1480
1561
|
method: "GET",
|
|
@@ -1486,7 +1567,7 @@ function createAuthClient(config = {}) {
|
|
|
1486
1567
|
const getWithQuery = (endpoint, input, options) => {
|
|
1487
1568
|
const { payload, fetchOptions } = extractFetchOptions(input);
|
|
1488
1569
|
const query = payload?.query;
|
|
1489
|
-
return
|
|
1570
|
+
return request2(
|
|
1490
1571
|
{
|
|
1491
1572
|
endpoint,
|
|
1492
1573
|
method: "GET",
|
|
@@ -1504,18 +1585,19 @@ function createAuthClient(config = {}) {
|
|
|
1504
1585
|
htmlField: "htmlBody",
|
|
1505
1586
|
textField: "textBody"
|
|
1506
1587
|
}, withReactEmailRoute(route));
|
|
1507
|
-
const resolveAdminEmailTemplatePayload = (route, input) => resolveReactEmailPayloadFields(input, {
|
|
1588
|
+
const resolveAdminEmailTemplatePayload = (route, input) => resolveReactEmailPayloadFields(toReactEmailTemplateCompatibilityInput(input), {
|
|
1508
1589
|
htmlField: "htmlTemplate",
|
|
1509
1590
|
textField: "textTemplate",
|
|
1510
1591
|
variablesField: "variables"
|
|
1511
1592
|
}, withReactEmailRoute(route)).then((payload) => {
|
|
1593
|
+
const normalizedPayload = normalizeAdminEmailTemplatePayload(payload);
|
|
1512
1594
|
if ("variables" in payload && payload.variables !== void 0 && payload.variables !== null) {
|
|
1513
1595
|
assertAthenaAuthTemplateVariables(
|
|
1514
1596
|
payload.variables,
|
|
1515
1597
|
`${route} variables`
|
|
1516
1598
|
);
|
|
1517
1599
|
}
|
|
1518
|
-
return
|
|
1600
|
+
return normalizedPayload;
|
|
1519
1601
|
});
|
|
1520
1602
|
const requireSession = async (input, options) => {
|
|
1521
1603
|
const sessionInput = input?.fetchOptions ? { fetchOptions: input.fetchOptions } : void 0;
|
|
@@ -2091,7 +2173,15 @@ function createAuthClient(config = {}) {
|
|
|
2091
2173
|
await resolveAdminEmailTemplatePayload("/admin/email-template/update", input),
|
|
2092
2174
|
options
|
|
2093
2175
|
),
|
|
2094
|
-
delete: (input, options) => postGeneric("/admin/email-template/delete", input, options)
|
|
2176
|
+
delete: (input, options) => postGeneric("/admin/email-template/delete", input, options),
|
|
2177
|
+
send: (input, options) => postGeneric(
|
|
2178
|
+
"/admin/email-template/send",
|
|
2179
|
+
normalizeAdminEmailTemplateSendPayload(extractFetchOptions(input).payload),
|
|
2180
|
+
options
|
|
2181
|
+
)
|
|
2182
|
+
},
|
|
2183
|
+
eventType: {
|
|
2184
|
+
list: (input, options) => getWithQuery("/admin/email-event-type/list", input, options)
|
|
2095
2185
|
}
|
|
2096
2186
|
},
|
|
2097
2187
|
emailTemplate: {
|
|
@@ -2107,7 +2197,15 @@ function createAuthClient(config = {}) {
|
|
|
2107
2197
|
"/admin/email-template/update",
|
|
2108
2198
|
await resolveAdminEmailTemplatePayload("/admin/email-template/update", input),
|
|
2109
2199
|
options
|
|
2200
|
+
),
|
|
2201
|
+
send: (input, options) => postGeneric(
|
|
2202
|
+
"/admin/email-template/send",
|
|
2203
|
+
normalizeAdminEmailTemplateSendPayload(extractFetchOptions(input).payload),
|
|
2204
|
+
options
|
|
2110
2205
|
)
|
|
2206
|
+
},
|
|
2207
|
+
emailEventType: {
|
|
2208
|
+
list: (input, options) => getWithQuery("/admin/email-event-type/list", input, options)
|
|
2111
2209
|
}
|
|
2112
2210
|
},
|
|
2113
2211
|
apiKey: {
|
|
@@ -2147,7 +2245,7 @@ function createAuthClient(config = {}) {
|
|
|
2147
2245
|
throw new Error("callback.provider requires non-empty code and state values");
|
|
2148
2246
|
}
|
|
2149
2247
|
const endpoint = `/callback/${encodeURIComponent(provider)}`;
|
|
2150
|
-
return
|
|
2248
|
+
return request2({
|
|
2151
2249
|
endpoint,
|
|
2152
2250
|
method: "GET",
|
|
2153
2251
|
query: {
|
|
@@ -2161,7 +2259,7 @@ function createAuthClient(config = {}) {
|
|
|
2161
2259
|
};
|
|
2162
2260
|
return {
|
|
2163
2261
|
baseUrl: normalizedBaseUrl,
|
|
2164
|
-
request,
|
|
2262
|
+
request: request2,
|
|
2165
2263
|
signIn: {
|
|
2166
2264
|
email: (input, options) => executePostWithCompatibleInput(
|
|
2167
2265
|
resolvedConfig,
|
|
@@ -2699,16 +2797,16 @@ function createStorageFileModule(base, config = {}) {
|
|
|
2699
2797
|
};
|
|
2700
2798
|
});
|
|
2701
2799
|
input.onProgress?.(createProgressSnapshot("preparing", sources, 0, 0, 0));
|
|
2702
|
-
const uploadUrls = uploadRequests.length === 1 ? [await base.createStorageUploadUrl(uploadRequests[0].uploadRequest, options)] : (await base.createStorageUploadUrls({ files: uploadRequests.map((
|
|
2800
|
+
const uploadUrls = uploadRequests.length === 1 ? [await base.createStorageUploadUrl(uploadRequests[0].uploadRequest, options)] : (await base.createStorageUploadUrls({ files: uploadRequests.map((request2) => request2.uploadRequest) }, options)).files;
|
|
2703
2801
|
const aggregateLoaded = new Array(uploadRequests.length).fill(0);
|
|
2704
2802
|
const uploaded = [];
|
|
2705
2803
|
for (let index = 0; index < uploadRequests.length; index += 1) {
|
|
2706
|
-
const
|
|
2804
|
+
const request2 = uploadRequests[index];
|
|
2707
2805
|
const uploadUrl = uploadUrls[index];
|
|
2708
2806
|
const response = await putUploadBody(
|
|
2709
2807
|
uploadUrl.upload.url,
|
|
2710
2808
|
uploadUrl.upload.headers ?? {},
|
|
2711
|
-
|
|
2809
|
+
request2.source,
|
|
2712
2810
|
input,
|
|
2713
2811
|
options,
|
|
2714
2812
|
(progress) => {
|
|
@@ -2719,13 +2817,13 @@ function createStorageFileModule(base, config = {}) {
|
|
|
2719
2817
|
uploaded.push({
|
|
2720
2818
|
file: uploadUrl.file,
|
|
2721
2819
|
upload: uploadUrl.upload,
|
|
2722
|
-
source:
|
|
2723
|
-
fileName:
|
|
2724
|
-
storage_key:
|
|
2820
|
+
source: request2.source.source,
|
|
2821
|
+
fileName: request2.source.fileName,
|
|
2822
|
+
storage_key: request2.uploadRequest.storage_key,
|
|
2725
2823
|
response
|
|
2726
2824
|
});
|
|
2727
|
-
aggregateLoaded[index] =
|
|
2728
|
-
input.onProgress?.(createProgressSnapshot("complete", sources, index,
|
|
2825
|
+
aggregateLoaded[index] = request2.source.sizeBytes;
|
|
2826
|
+
input.onProgress?.(createProgressSnapshot("complete", sources, index, request2.source.sizeBytes, sum(aggregateLoaded)));
|
|
2729
2827
|
}
|
|
2730
2828
|
return {
|
|
2731
2829
|
files: uploaded,
|
|
@@ -4686,6 +4784,484 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4686
4784
|
};
|
|
4687
4785
|
}
|
|
4688
4786
|
|
|
4787
|
+
// src/chat/module.ts
|
|
4788
|
+
var SDK_NAME3 = "xylex-group/athena-chat";
|
|
4789
|
+
var SDK_HEADER_VALUE3 = buildSdkHeaderValue(SDK_NAME3);
|
|
4790
|
+
var NO_CACHE_HEADER_VALUE3 = "no-cache";
|
|
4791
|
+
var AthenaChatError = class extends Error {
|
|
4792
|
+
status;
|
|
4793
|
+
endpoint;
|
|
4794
|
+
method;
|
|
4795
|
+
requestId;
|
|
4796
|
+
body;
|
|
4797
|
+
constructor(input) {
|
|
4798
|
+
super(input.message);
|
|
4799
|
+
this.name = "AthenaChatError";
|
|
4800
|
+
this.status = input.status;
|
|
4801
|
+
this.endpoint = input.endpoint;
|
|
4802
|
+
this.method = input.method;
|
|
4803
|
+
this.requestId = input.requestId;
|
|
4804
|
+
this.body = input.body;
|
|
4805
|
+
}
|
|
4806
|
+
};
|
|
4807
|
+
function deriveRealtimeInfoUrl(wsUrl) {
|
|
4808
|
+
if (!wsUrl) {
|
|
4809
|
+
return void 0;
|
|
4810
|
+
}
|
|
4811
|
+
const parsed = new URL(normalizeWsUrl(wsUrl, "Athena chat WebSocket URL"));
|
|
4812
|
+
parsed.protocol = parsed.protocol === "wss:" ? "https:" : "http:";
|
|
4813
|
+
parsed.pathname = parsed.pathname.replace(/\/wss\/gateway$/, "/wss/info");
|
|
4814
|
+
return parsed.toString();
|
|
4815
|
+
}
|
|
4816
|
+
function normalizeWsUrl(value, label) {
|
|
4817
|
+
const normalized = value.trim();
|
|
4818
|
+
if (!normalized) {
|
|
4819
|
+
throw new Error(`${label} is required.`);
|
|
4820
|
+
}
|
|
4821
|
+
let parsed;
|
|
4822
|
+
try {
|
|
4823
|
+
parsed = new URL(normalized);
|
|
4824
|
+
} catch {
|
|
4825
|
+
throw new Error(`${label} must be a valid absolute ws(s) URL.`);
|
|
4826
|
+
}
|
|
4827
|
+
if (parsed.protocol !== "ws:" && parsed.protocol !== "wss:") {
|
|
4828
|
+
throw new Error(`${label} must use ws or wss.`);
|
|
4829
|
+
}
|
|
4830
|
+
parsed.pathname = parsed.pathname.replace(/\/+$/, "");
|
|
4831
|
+
return parsed.toString().replace(/\/$/, "");
|
|
4832
|
+
}
|
|
4833
|
+
function isRecord7(value) {
|
|
4834
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
4835
|
+
}
|
|
4836
|
+
function normalizeHeaderValue3(value) {
|
|
4837
|
+
return value ? value : void 0;
|
|
4838
|
+
}
|
|
4839
|
+
function parseResponseBody4(rawText, contentType) {
|
|
4840
|
+
if (!rawText) {
|
|
4841
|
+
return { parsed: null, parseFailed: false };
|
|
4842
|
+
}
|
|
4843
|
+
const contentTypeSuggestsJson = contentType?.toLowerCase().includes("application/json") ?? false;
|
|
4844
|
+
const looksJson = contentTypeSuggestsJson || rawText.startsWith("{") || rawText.startsWith("[");
|
|
4845
|
+
if (!looksJson) {
|
|
4846
|
+
return { parsed: rawText, parseFailed: false };
|
|
4847
|
+
}
|
|
4848
|
+
try {
|
|
4849
|
+
return { parsed: JSON.parse(rawText), parseFailed: false };
|
|
4850
|
+
} catch {
|
|
4851
|
+
return { parsed: rawText, parseFailed: true };
|
|
4852
|
+
}
|
|
4853
|
+
}
|
|
4854
|
+
function resolveRequestId3(headers) {
|
|
4855
|
+
return headers.get("x-request-id") ?? headers.get("x-correlation-id") ?? headers.get("x-athena-request-id") ?? void 0;
|
|
4856
|
+
}
|
|
4857
|
+
function resolveErrorMessage4(payload, fallback) {
|
|
4858
|
+
if (isRecord7(payload)) {
|
|
4859
|
+
for (const candidate of [payload.error, payload.message, payload.details]) {
|
|
4860
|
+
if (typeof candidate === "string" && candidate.trim().length > 0) {
|
|
4861
|
+
return candidate.trim();
|
|
4862
|
+
}
|
|
4863
|
+
}
|
|
4864
|
+
}
|
|
4865
|
+
if (typeof payload === "string" && payload.trim().length > 0) {
|
|
4866
|
+
return payload.trim();
|
|
4867
|
+
}
|
|
4868
|
+
return fallback;
|
|
4869
|
+
}
|
|
4870
|
+
function encodePathSegment(value, label) {
|
|
4871
|
+
const normalized = value.trim();
|
|
4872
|
+
if (!normalized) {
|
|
4873
|
+
throw new Error(`${label} is required.`);
|
|
4874
|
+
}
|
|
4875
|
+
return encodeURIComponent(normalized);
|
|
4876
|
+
}
|
|
4877
|
+
function encodeQuery(query) {
|
|
4878
|
+
if (!query) {
|
|
4879
|
+
return "";
|
|
4880
|
+
}
|
|
4881
|
+
const params = new URLSearchParams();
|
|
4882
|
+
for (const [key, value] of Object.entries(query)) {
|
|
4883
|
+
if (value === void 0 || value === null) {
|
|
4884
|
+
continue;
|
|
4885
|
+
}
|
|
4886
|
+
if (Array.isArray(value)) {
|
|
4887
|
+
for (const item of value) {
|
|
4888
|
+
if (item !== void 0 && item !== null) {
|
|
4889
|
+
params.append(key, String(item));
|
|
4890
|
+
}
|
|
4891
|
+
}
|
|
4892
|
+
continue;
|
|
4893
|
+
}
|
|
4894
|
+
params.set(key, String(value));
|
|
4895
|
+
}
|
|
4896
|
+
const encoded = params.toString();
|
|
4897
|
+
return encoded ? `?${encoded}` : "";
|
|
4898
|
+
}
|
|
4899
|
+
function createSocket(factory, url, protocols) {
|
|
4900
|
+
try {
|
|
4901
|
+
return new factory(url, protocols);
|
|
4902
|
+
} catch (error) {
|
|
4903
|
+
if (error instanceof TypeError) {
|
|
4904
|
+
return factory(url, protocols);
|
|
4905
|
+
}
|
|
4906
|
+
throw error;
|
|
4907
|
+
}
|
|
4908
|
+
}
|
|
4909
|
+
function buildHeaders3(config, options) {
|
|
4910
|
+
const headers = {
|
|
4911
|
+
Accept: "application/json",
|
|
4912
|
+
apikey: config.apiKey,
|
|
4913
|
+
"x-api-key": config.apiKey,
|
|
4914
|
+
"X-Athena-Sdk": SDK_HEADER_VALUE3
|
|
4915
|
+
};
|
|
4916
|
+
if (config.client || options?.client) {
|
|
4917
|
+
headers["X-Athena-Client"] = options?.client ?? config.client ?? "";
|
|
4918
|
+
}
|
|
4919
|
+
const bearerToken = options?.bearerToken ?? config.bearerToken;
|
|
4920
|
+
if (typeof bearerToken === "string" && bearerToken.trim()) {
|
|
4921
|
+
headers.Authorization = bearerToken.startsWith("Bearer ") ? bearerToken : `Bearer ${bearerToken}`;
|
|
4922
|
+
}
|
|
4923
|
+
const cookie = options?.cookie ?? config.cookie;
|
|
4924
|
+
if (typeof cookie === "string" && cookie.trim()) {
|
|
4925
|
+
headers.Cookie = cookie;
|
|
4926
|
+
}
|
|
4927
|
+
const sessionToken = options?.sessionToken ?? config.sessionToken;
|
|
4928
|
+
if (typeof sessionToken === "string" && sessionToken.trim()) {
|
|
4929
|
+
headers["X-Athena-Auth-Session-Token"] = sessionToken;
|
|
4930
|
+
}
|
|
4931
|
+
if (config.forceNoCache || options?.forceNoCache) {
|
|
4932
|
+
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE3;
|
|
4933
|
+
}
|
|
4934
|
+
for (const source of [config.headers, options?.headers]) {
|
|
4935
|
+
for (const [key, value] of Object.entries(source ?? {})) {
|
|
4936
|
+
const normalized = normalizeHeaderValue3(value);
|
|
4937
|
+
if (normalized) {
|
|
4938
|
+
headers[key] = normalized;
|
|
4939
|
+
}
|
|
4940
|
+
}
|
|
4941
|
+
}
|
|
4942
|
+
return headers;
|
|
4943
|
+
}
|
|
4944
|
+
function withJsonBody(init, body) {
|
|
4945
|
+
return {
|
|
4946
|
+
...init,
|
|
4947
|
+
body: body === void 0 ? void 0 : JSON.stringify(body),
|
|
4948
|
+
headers: {
|
|
4949
|
+
"Content-Type": "application/json",
|
|
4950
|
+
...init.headers
|
|
4951
|
+
}
|
|
4952
|
+
};
|
|
4953
|
+
}
|
|
4954
|
+
async function request(config, method, endpoint, options, body) {
|
|
4955
|
+
if (!config.baseUrl) {
|
|
4956
|
+
throw new Error(
|
|
4957
|
+
"Athena chat base URL is not configured. Pass createClient({ url }) for unified routing or set chat.url / chatUrl explicitly."
|
|
4958
|
+
);
|
|
4959
|
+
}
|
|
4960
|
+
const url = `${config.baseUrl}${endpoint}`;
|
|
4961
|
+
const init = {
|
|
4962
|
+
method,
|
|
4963
|
+
headers: buildHeaders3(config, options),
|
|
4964
|
+
signal: options?.signal
|
|
4965
|
+
};
|
|
4966
|
+
const finalInit = body === void 0 || method === "GET" ? init : withJsonBody(init, body);
|
|
4967
|
+
const response = await fetch(url, finalInit);
|
|
4968
|
+
const rawText = await response.text();
|
|
4969
|
+
const { parsed } = parseResponseBody4(rawText, response.headers.get("content-type"));
|
|
4970
|
+
if (!response.ok) {
|
|
4971
|
+
throw new AthenaChatError({
|
|
4972
|
+
message: resolveErrorMessage4(parsed, `Athena chat ${method} ${endpoint} failed with ${response.status}`),
|
|
4973
|
+
status: response.status,
|
|
4974
|
+
endpoint,
|
|
4975
|
+
method,
|
|
4976
|
+
requestId: resolveRequestId3(response.headers),
|
|
4977
|
+
body: parsed
|
|
4978
|
+
});
|
|
4979
|
+
}
|
|
4980
|
+
return parsed;
|
|
4981
|
+
}
|
|
4982
|
+
function createRealtimeConnection(config, options) {
|
|
4983
|
+
if (!config.wsUrl) {
|
|
4984
|
+
throw new Error(
|
|
4985
|
+
"Athena chat WebSocket URL is not configured. Pass createClient({ url }) for unified routing or set chat.wsUrl / chatWsUrl explicitly."
|
|
4986
|
+
);
|
|
4987
|
+
}
|
|
4988
|
+
const wsFactory = config.webSocketFactory ?? globalThis.WebSocket;
|
|
4989
|
+
if (!wsFactory) {
|
|
4990
|
+
throw new Error(
|
|
4991
|
+
"No WebSocket implementation is available. Provide chat.webSocketFactory in createClient(...) or run in a runtime with global WebSocket support."
|
|
4992
|
+
);
|
|
4993
|
+
}
|
|
4994
|
+
const socket = createSocket(wsFactory, config.wsUrl, options?.protocols);
|
|
4995
|
+
const send = (command) => {
|
|
4996
|
+
socket.send(JSON.stringify(command));
|
|
4997
|
+
};
|
|
4998
|
+
if (options?.onMessage) {
|
|
4999
|
+
const listener = (event) => {
|
|
5000
|
+
const messageEvent = event;
|
|
5001
|
+
const raw = messageEvent?.data;
|
|
5002
|
+
if (typeof raw !== "string") {
|
|
5003
|
+
return;
|
|
5004
|
+
}
|
|
5005
|
+
try {
|
|
5006
|
+
options.onMessage?.(JSON.parse(raw));
|
|
5007
|
+
} catch {
|
|
5008
|
+
options.onMessage?.({ type: "error", error: "Invalid JSON message from Athena chat realtime gateway." });
|
|
5009
|
+
}
|
|
5010
|
+
};
|
|
5011
|
+
if (typeof socket.addEventListener === "function") {
|
|
5012
|
+
socket.addEventListener("message", listener);
|
|
5013
|
+
} else {
|
|
5014
|
+
socket.onmessage = listener;
|
|
5015
|
+
}
|
|
5016
|
+
}
|
|
5017
|
+
const hello = (command) => {
|
|
5018
|
+
send({
|
|
5019
|
+
type: "auth.hello",
|
|
5020
|
+
token: command?.token,
|
|
5021
|
+
room_subscriptions: command?.room_subscriptions
|
|
5022
|
+
});
|
|
5023
|
+
};
|
|
5024
|
+
if (options?.hello) {
|
|
5025
|
+
const onOpen = () => hello({
|
|
5026
|
+
token: options.hello?.token ?? void 0,
|
|
5027
|
+
room_subscriptions: options.hello?.room_subscriptions ?? void 0
|
|
5028
|
+
});
|
|
5029
|
+
if (typeof socket.addEventListener === "function") {
|
|
5030
|
+
socket.addEventListener("open", onOpen);
|
|
5031
|
+
} else {
|
|
5032
|
+
socket.onopen = onOpen;
|
|
5033
|
+
}
|
|
5034
|
+
}
|
|
5035
|
+
return {
|
|
5036
|
+
socket,
|
|
5037
|
+
send,
|
|
5038
|
+
hello,
|
|
5039
|
+
subscribe(roomId, fromSeq) {
|
|
5040
|
+
send({
|
|
5041
|
+
type: "chat.subscribe",
|
|
5042
|
+
room_id: roomId,
|
|
5043
|
+
from_seq: fromSeq ?? void 0
|
|
5044
|
+
});
|
|
5045
|
+
},
|
|
5046
|
+
unsubscribe(roomId) {
|
|
5047
|
+
send({
|
|
5048
|
+
type: "chat.unsubscribe",
|
|
5049
|
+
room_id: roomId
|
|
5050
|
+
});
|
|
5051
|
+
},
|
|
5052
|
+
resume(rooms) {
|
|
5053
|
+
send({
|
|
5054
|
+
type: "chat.resume",
|
|
5055
|
+
rooms
|
|
5056
|
+
});
|
|
5057
|
+
},
|
|
5058
|
+
typingStart(roomId) {
|
|
5059
|
+
send({
|
|
5060
|
+
type: "chat.typing.start",
|
|
5061
|
+
room_id: roomId
|
|
5062
|
+
});
|
|
5063
|
+
},
|
|
5064
|
+
typingStop(roomId) {
|
|
5065
|
+
send({
|
|
5066
|
+
type: "chat.typing.stop",
|
|
5067
|
+
room_id: roomId
|
|
5068
|
+
});
|
|
5069
|
+
},
|
|
5070
|
+
presenceHeartbeat(activeRoomId) {
|
|
5071
|
+
send({
|
|
5072
|
+
type: "chat.presence.heartbeat",
|
|
5073
|
+
active_room_id: activeRoomId ?? void 0
|
|
5074
|
+
});
|
|
5075
|
+
},
|
|
5076
|
+
readUpTo(roomId, input) {
|
|
5077
|
+
send({
|
|
5078
|
+
type: "chat.read.up_to",
|
|
5079
|
+
room_id: roomId,
|
|
5080
|
+
message_id: input?.message_id ?? void 0,
|
|
5081
|
+
seq: input?.seq ?? void 0
|
|
5082
|
+
});
|
|
5083
|
+
},
|
|
5084
|
+
ping(at = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
5085
|
+
send({
|
|
5086
|
+
type: "ping",
|
|
5087
|
+
at
|
|
5088
|
+
});
|
|
5089
|
+
},
|
|
5090
|
+
close(code, reason) {
|
|
5091
|
+
socket.close(code, reason);
|
|
5092
|
+
}
|
|
5093
|
+
};
|
|
5094
|
+
}
|
|
5095
|
+
function createChatModule(config) {
|
|
5096
|
+
const realtime = {
|
|
5097
|
+
info(options) {
|
|
5098
|
+
const realtimeInfoUrl = config.realtimeInfoUrl ?? deriveRealtimeInfoUrl(config.wsUrl);
|
|
5099
|
+
if (!realtimeInfoUrl) {
|
|
5100
|
+
throw new Error(
|
|
5101
|
+
"Athena chat realtime info URL is not configured. Pass createClient({ url }) for unified routing or set chat.wsUrl / chatWsUrl explicitly."
|
|
5102
|
+
);
|
|
5103
|
+
}
|
|
5104
|
+
return request(
|
|
5105
|
+
{
|
|
5106
|
+
...config,
|
|
5107
|
+
baseUrl: realtimeInfoUrl
|
|
5108
|
+
},
|
|
5109
|
+
"GET",
|
|
5110
|
+
"",
|
|
5111
|
+
options
|
|
5112
|
+
);
|
|
5113
|
+
},
|
|
5114
|
+
connect(options) {
|
|
5115
|
+
return createRealtimeConnection(config, options);
|
|
5116
|
+
}
|
|
5117
|
+
};
|
|
5118
|
+
return {
|
|
5119
|
+
room: {
|
|
5120
|
+
list(query, options) {
|
|
5121
|
+
return request(
|
|
5122
|
+
config,
|
|
5123
|
+
"GET",
|
|
5124
|
+
`/rooms${encodeQuery(query)}`,
|
|
5125
|
+
options
|
|
5126
|
+
);
|
|
5127
|
+
},
|
|
5128
|
+
create(input, options) {
|
|
5129
|
+
return request(config, "POST", "/rooms", options, input);
|
|
5130
|
+
},
|
|
5131
|
+
get(roomId, options) {
|
|
5132
|
+
return request(
|
|
5133
|
+
config,
|
|
5134
|
+
"GET",
|
|
5135
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}`,
|
|
5136
|
+
options
|
|
5137
|
+
);
|
|
5138
|
+
},
|
|
5139
|
+
update(roomId, input, options) {
|
|
5140
|
+
return request(
|
|
5141
|
+
config,
|
|
5142
|
+
"PATCH",
|
|
5143
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}`,
|
|
5144
|
+
options,
|
|
5145
|
+
input
|
|
5146
|
+
);
|
|
5147
|
+
},
|
|
5148
|
+
archive(roomId, options) {
|
|
5149
|
+
return request(
|
|
5150
|
+
config,
|
|
5151
|
+
"POST",
|
|
5152
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/archive`,
|
|
5153
|
+
options
|
|
5154
|
+
);
|
|
5155
|
+
},
|
|
5156
|
+
readCursor: {
|
|
5157
|
+
upTo(roomId, input, options) {
|
|
5158
|
+
return request(
|
|
5159
|
+
config,
|
|
5160
|
+
"POST",
|
|
5161
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/read-cursor`,
|
|
5162
|
+
options,
|
|
5163
|
+
input ?? {}
|
|
5164
|
+
);
|
|
5165
|
+
}
|
|
5166
|
+
},
|
|
5167
|
+
member: {
|
|
5168
|
+
list(roomId, options) {
|
|
5169
|
+
return request(
|
|
5170
|
+
config,
|
|
5171
|
+
"GET",
|
|
5172
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/members`,
|
|
5173
|
+
options
|
|
5174
|
+
);
|
|
5175
|
+
},
|
|
5176
|
+
add(roomId, input, options) {
|
|
5177
|
+
return request(
|
|
5178
|
+
config,
|
|
5179
|
+
"POST",
|
|
5180
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/members`,
|
|
5181
|
+
options,
|
|
5182
|
+
input
|
|
5183
|
+
);
|
|
5184
|
+
},
|
|
5185
|
+
remove(roomId, userId, options) {
|
|
5186
|
+
return request(
|
|
5187
|
+
config,
|
|
5188
|
+
"DELETE",
|
|
5189
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/members/${encodePathSegment(userId, "chat user ID")}`,
|
|
5190
|
+
options
|
|
5191
|
+
);
|
|
5192
|
+
}
|
|
5193
|
+
},
|
|
5194
|
+
message: {
|
|
5195
|
+
list(roomId, query, options) {
|
|
5196
|
+
return request(
|
|
5197
|
+
config,
|
|
5198
|
+
"GET",
|
|
5199
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/messages${encodeQuery(query)}`,
|
|
5200
|
+
options
|
|
5201
|
+
);
|
|
5202
|
+
},
|
|
5203
|
+
send(roomId, input, options) {
|
|
5204
|
+
return request(
|
|
5205
|
+
config,
|
|
5206
|
+
"POST",
|
|
5207
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/messages`,
|
|
5208
|
+
options,
|
|
5209
|
+
input
|
|
5210
|
+
);
|
|
5211
|
+
},
|
|
5212
|
+
update(roomId, messageId, input, options) {
|
|
5213
|
+
return request(
|
|
5214
|
+
config,
|
|
5215
|
+
"PATCH",
|
|
5216
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/messages/${encodePathSegment(messageId, "chat message ID")}`,
|
|
5217
|
+
options,
|
|
5218
|
+
input
|
|
5219
|
+
);
|
|
5220
|
+
},
|
|
5221
|
+
delete(roomId, messageId, options) {
|
|
5222
|
+
return request(
|
|
5223
|
+
config,
|
|
5224
|
+
"DELETE",
|
|
5225
|
+
`/rooms/${encodePathSegment(roomId, "chat room ID")}/messages/${encodePathSegment(messageId, "chat message ID")}`,
|
|
5226
|
+
options
|
|
5227
|
+
);
|
|
5228
|
+
}
|
|
5229
|
+
}
|
|
5230
|
+
},
|
|
5231
|
+
message: {
|
|
5232
|
+
reaction: {
|
|
5233
|
+
add(messageId, input, options) {
|
|
5234
|
+
return request(
|
|
5235
|
+
config,
|
|
5236
|
+
"POST",
|
|
5237
|
+
`/messages/${encodePathSegment(messageId, "chat message ID")}/reactions`,
|
|
5238
|
+
options,
|
|
5239
|
+
input
|
|
5240
|
+
);
|
|
5241
|
+
},
|
|
5242
|
+
remove(messageId, emoji, options) {
|
|
5243
|
+
return request(
|
|
5244
|
+
config,
|
|
5245
|
+
"DELETE",
|
|
5246
|
+
`/messages/${encodePathSegment(messageId, "chat message ID")}/reactions/${encodePathSegment(emoji, "reaction emoji")}`,
|
|
5247
|
+
options
|
|
5248
|
+
);
|
|
5249
|
+
}
|
|
5250
|
+
},
|
|
5251
|
+
search(input, options) {
|
|
5252
|
+
return request(
|
|
5253
|
+
config,
|
|
5254
|
+
"POST",
|
|
5255
|
+
"/messages/search",
|
|
5256
|
+
options,
|
|
5257
|
+
input
|
|
5258
|
+
);
|
|
5259
|
+
}
|
|
5260
|
+
},
|
|
5261
|
+
realtime
|
|
5262
|
+
};
|
|
5263
|
+
}
|
|
5264
|
+
|
|
4689
5265
|
// src/client-builder.ts
|
|
4690
5266
|
var DEFAULT_BACKEND = { type: "athena" };
|
|
4691
5267
|
function toBackendConfig(value) {
|
|
@@ -4898,7 +5474,7 @@ var BOOLEAN_SAFE_OPERATORS = /* @__PURE__ */ new Set([
|
|
|
4898
5474
|
"ilike",
|
|
4899
5475
|
"is"
|
|
4900
5476
|
]);
|
|
4901
|
-
function
|
|
5477
|
+
function isRecord8(value) {
|
|
4902
5478
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
4903
5479
|
}
|
|
4904
5480
|
function isUuidString(value) {
|
|
@@ -4911,7 +5487,7 @@ function shouldUseUuidTextComparison(column, value) {
|
|
|
4911
5487
|
return typeof value === "string" && isUuidString(value) && isUuidIdentifierColumn(column);
|
|
4912
5488
|
}
|
|
4913
5489
|
function isRelationSelectNode(value) {
|
|
4914
|
-
return
|
|
5490
|
+
return isRecord8(value) && isRecord8(value.select);
|
|
4915
5491
|
}
|
|
4916
5492
|
function normalizeIdentifier(value, label) {
|
|
4917
5493
|
const normalized = value.trim();
|
|
@@ -4967,7 +5543,7 @@ function compileRelationToken(key, node) {
|
|
|
4967
5543
|
return `${prefix}${relationToken}(${nested})`;
|
|
4968
5544
|
}
|
|
4969
5545
|
function compileSelectShape(select) {
|
|
4970
|
-
if (!
|
|
5546
|
+
if (!isRecord8(select)) {
|
|
4971
5547
|
throw new Error("findMany select must be an object");
|
|
4972
5548
|
}
|
|
4973
5549
|
const tokens = [];
|
|
@@ -4991,7 +5567,7 @@ function compileSelectShape(select) {
|
|
|
4991
5567
|
return tokens.join(",");
|
|
4992
5568
|
}
|
|
4993
5569
|
function selectShapeUsesRelationSchema(select) {
|
|
4994
|
-
if (!
|
|
5570
|
+
if (!isRecord8(select)) {
|
|
4995
5571
|
return false;
|
|
4996
5572
|
}
|
|
4997
5573
|
for (const rawValue of Object.values(select)) {
|
|
@@ -5009,7 +5585,7 @@ function selectShapeUsesRelationSchema(select) {
|
|
|
5009
5585
|
}
|
|
5010
5586
|
function compileColumnWhere(column, input) {
|
|
5011
5587
|
const normalizedColumn = normalizeIdentifier(column, "where column");
|
|
5012
|
-
if (!
|
|
5588
|
+
if (!isRecord8(input)) {
|
|
5013
5589
|
return [buildGatewayCondition("eq", normalizedColumn, input)];
|
|
5014
5590
|
}
|
|
5015
5591
|
const conditions = [];
|
|
@@ -5037,7 +5613,7 @@ function compileColumnWhere(column, input) {
|
|
|
5037
5613
|
return conditions;
|
|
5038
5614
|
}
|
|
5039
5615
|
function compileBooleanExpressionTerms(clause, label) {
|
|
5040
|
-
if (!
|
|
5616
|
+
if (!isRecord8(clause)) {
|
|
5041
5617
|
throw new Error(`findMany where.${label} clauses must be objects`);
|
|
5042
5618
|
}
|
|
5043
5619
|
const entries = Object.entries(clause).filter(([, value]) => value !== void 0);
|
|
@@ -5046,7 +5622,7 @@ function compileBooleanExpressionTerms(clause, label) {
|
|
|
5046
5622
|
}
|
|
5047
5623
|
const [rawColumn, rawValue] = entries[0];
|
|
5048
5624
|
const column = normalizeIdentifier(rawColumn, `where.${label} column`);
|
|
5049
|
-
if (!
|
|
5625
|
+
if (!isRecord8(rawValue)) {
|
|
5050
5626
|
return [`${column}.eq.${stringifyFilterValue(rawValue)}`];
|
|
5051
5627
|
}
|
|
5052
5628
|
const operatorEntries = Object.entries(rawValue).filter(([, value]) => value !== void 0);
|
|
@@ -5070,7 +5646,7 @@ function compileWhere(where) {
|
|
|
5070
5646
|
if (where === void 0) {
|
|
5071
5647
|
return void 0;
|
|
5072
5648
|
}
|
|
5073
|
-
if (!
|
|
5649
|
+
if (!isRecord8(where)) {
|
|
5074
5650
|
throw new Error("findMany where must be an object");
|
|
5075
5651
|
}
|
|
5076
5652
|
const conditions = [];
|
|
@@ -5120,7 +5696,7 @@ function compileOrderBy(orderBy) {
|
|
|
5120
5696
|
if (orderBy === void 0) {
|
|
5121
5697
|
return void 0;
|
|
5122
5698
|
}
|
|
5123
|
-
if (!
|
|
5699
|
+
if (!isRecord8(orderBy)) {
|
|
5124
5700
|
throw new Error("findMany orderBy must be an object");
|
|
5125
5701
|
}
|
|
5126
5702
|
if ("column" in orderBy) {
|
|
@@ -5295,11 +5871,11 @@ function toFindManyAstOrder(order) {
|
|
|
5295
5871
|
ascending: order.direction !== "descending"
|
|
5296
5872
|
};
|
|
5297
5873
|
}
|
|
5298
|
-
function
|
|
5874
|
+
function isRecord9(value) {
|
|
5299
5875
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
5300
5876
|
}
|
|
5301
5877
|
function normalizeFindManyAstColumnPredicate(value) {
|
|
5302
|
-
if (!
|
|
5878
|
+
if (!isRecord9(value)) {
|
|
5303
5879
|
return {
|
|
5304
5880
|
eq: value
|
|
5305
5881
|
};
|
|
@@ -5323,7 +5899,7 @@ function normalizeFindManyAstBooleanOperand(clause) {
|
|
|
5323
5899
|
return normalized;
|
|
5324
5900
|
}
|
|
5325
5901
|
function normalizeFindManyAstWhere(where) {
|
|
5326
|
-
if (!where || !
|
|
5902
|
+
if (!where || !isRecord9(where)) {
|
|
5327
5903
|
return where;
|
|
5328
5904
|
}
|
|
5329
5905
|
const normalized = {};
|
|
@@ -5337,7 +5913,7 @@ function normalizeFindManyAstWhere(where) {
|
|
|
5337
5913
|
);
|
|
5338
5914
|
continue;
|
|
5339
5915
|
}
|
|
5340
|
-
if (key === "not" &&
|
|
5916
|
+
if (key === "not" && isRecord9(value)) {
|
|
5341
5917
|
normalized.not = normalizeFindManyAstBooleanOperand(
|
|
5342
5918
|
value
|
|
5343
5919
|
);
|
|
@@ -5348,7 +5924,7 @@ function normalizeFindManyAstWhere(where) {
|
|
|
5348
5924
|
return normalized;
|
|
5349
5925
|
}
|
|
5350
5926
|
function predicateRequiresUuidQueryFallback(column, value) {
|
|
5351
|
-
if (!
|
|
5927
|
+
if (!isRecord9(value)) {
|
|
5352
5928
|
return shouldUseUuidTextComparison(column, value);
|
|
5353
5929
|
}
|
|
5354
5930
|
const eqValue = value.eq;
|
|
@@ -5366,7 +5942,7 @@ function booleanOperandRequiresUuidQueryFallback(clause) {
|
|
|
5366
5942
|
return false;
|
|
5367
5943
|
}
|
|
5368
5944
|
function findManyAstWhereRequiresLegacyTransport(where) {
|
|
5369
|
-
if (!where || !
|
|
5945
|
+
if (!where || !isRecord9(where)) {
|
|
5370
5946
|
return false;
|
|
5371
5947
|
}
|
|
5372
5948
|
for (const [key, value] of Object.entries(where)) {
|
|
@@ -5381,7 +5957,7 @@ function findManyAstWhereRequiresLegacyTransport(where) {
|
|
|
5381
5957
|
}
|
|
5382
5958
|
continue;
|
|
5383
5959
|
}
|
|
5384
|
-
if (key === "not" &&
|
|
5960
|
+
if (key === "not" && isRecord9(value)) {
|
|
5385
5961
|
if (booleanOperandRequiresUuidQueryFallback(value)) {
|
|
5386
5962
|
return true;
|
|
5387
5963
|
}
|
|
@@ -5924,6 +6500,7 @@ function resolveAthenaModelTargetTableName(target, options = {}) {
|
|
|
5924
6500
|
var DEFAULT_COLUMNS = "*";
|
|
5925
6501
|
var SAFE_CAST_PATTERN = /^[a-z_][a-z0-9_]*(?:\[\])?$/i;
|
|
5926
6502
|
var ATHENA_NORMALIZED_ERROR_KEY = "__athenaNormalizedError";
|
|
6503
|
+
var SDK_NAME4 = "xylex-group/athena";
|
|
5927
6504
|
function formatResult(response) {
|
|
5928
6505
|
const result = {
|
|
5929
6506
|
data: response.data ?? null,
|
|
@@ -6000,7 +6577,7 @@ async function executeExperimentalRead(experimental, runner) {
|
|
|
6000
6577
|
throw error;
|
|
6001
6578
|
}
|
|
6002
6579
|
}
|
|
6003
|
-
function
|
|
6580
|
+
function isRecord10(value) {
|
|
6004
6581
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
6005
6582
|
}
|
|
6006
6583
|
function firstNonEmptyString2(...values) {
|
|
@@ -6012,8 +6589,8 @@ function firstNonEmptyString2(...values) {
|
|
|
6012
6589
|
return void 0;
|
|
6013
6590
|
}
|
|
6014
6591
|
function resolveStructuredErrorPayload2(raw) {
|
|
6015
|
-
if (!
|
|
6016
|
-
return
|
|
6592
|
+
if (!isRecord10(raw)) return null;
|
|
6593
|
+
return isRecord10(raw.error) ? raw.error : raw;
|
|
6017
6594
|
}
|
|
6018
6595
|
function resolveStructuredErrorDetails(payload, message) {
|
|
6019
6596
|
if (!payload || !("details" in payload)) {
|
|
@@ -6029,7 +6606,7 @@ function resolveStructuredErrorDetails(payload, message) {
|
|
|
6029
6606
|
return details;
|
|
6030
6607
|
}
|
|
6031
6608
|
function createResultError(response, result, normalized) {
|
|
6032
|
-
const rawRecord =
|
|
6609
|
+
const rawRecord = isRecord10(response.raw) ? response.raw : null;
|
|
6033
6610
|
const payload = resolveStructuredErrorPayload2(response.raw);
|
|
6034
6611
|
const message = firstNonEmptyString2(
|
|
6035
6612
|
response.error,
|
|
@@ -6092,6 +6669,43 @@ function asAthenaJsonObject(value) {
|
|
|
6092
6669
|
function asAthenaJsonObjectArray(values) {
|
|
6093
6670
|
return values;
|
|
6094
6671
|
}
|
|
6672
|
+
function parseArbitraryResponseBody(rawText, contentType) {
|
|
6673
|
+
if (!rawText) {
|
|
6674
|
+
return null;
|
|
6675
|
+
}
|
|
6676
|
+
const contentTypeSuggestsJson = contentType?.toLowerCase().includes("application/json") ?? false;
|
|
6677
|
+
const looksJson = contentTypeSuggestsJson || rawText.startsWith("{") || rawText.startsWith("[");
|
|
6678
|
+
if (!looksJson) {
|
|
6679
|
+
return rawText;
|
|
6680
|
+
}
|
|
6681
|
+
try {
|
|
6682
|
+
return JSON.parse(rawText);
|
|
6683
|
+
} catch {
|
|
6684
|
+
return rawText;
|
|
6685
|
+
}
|
|
6686
|
+
}
|
|
6687
|
+
function toRequestQueryString(query) {
|
|
6688
|
+
if (!query) {
|
|
6689
|
+
return "";
|
|
6690
|
+
}
|
|
6691
|
+
const params = new URLSearchParams();
|
|
6692
|
+
for (const [key, value] of Object.entries(query)) {
|
|
6693
|
+
if (value === void 0 || value === null) {
|
|
6694
|
+
continue;
|
|
6695
|
+
}
|
|
6696
|
+
if (Array.isArray(value)) {
|
|
6697
|
+
for (const item of value) {
|
|
6698
|
+
if (item !== void 0 && item !== null) {
|
|
6699
|
+
params.append(key, String(item));
|
|
6700
|
+
}
|
|
6701
|
+
}
|
|
6702
|
+
continue;
|
|
6703
|
+
}
|
|
6704
|
+
params.set(key, String(value));
|
|
6705
|
+
}
|
|
6706
|
+
const encoded = params.toString();
|
|
6707
|
+
return encoded ? `?${encoded}` : "";
|
|
6708
|
+
}
|
|
6095
6709
|
function normalizeSelectColumnsInput(columns) {
|
|
6096
6710
|
if (columns === void 0) {
|
|
6097
6711
|
return void 0;
|
|
@@ -7398,6 +8012,8 @@ var ATHENA_ENV_GATEWAY_URL_KEYS = [
|
|
|
7398
8012
|
"NEXT_PUBLIC_ATHENA_DB_API_URL"
|
|
7399
8013
|
];
|
|
7400
8014
|
var ATHENA_ENV_AUTH_URL_KEYS = ["ATHENA_AUTH_URL", "NEXT_PUBLIC_ATHENA_AUTH_URL"];
|
|
8015
|
+
var ATHENA_ENV_CHAT_URL_KEYS = ["ATHENA_CHAT_URL", "NEXT_PUBLIC_ATHENA_CHAT_URL"];
|
|
8016
|
+
var ATHENA_ENV_CHAT_WS_URL_KEYS = ["ATHENA_CHAT_WS_URL", "NEXT_PUBLIC_ATHENA_CHAT_WS_URL"];
|
|
7401
8017
|
var ATHENA_ENV_STORAGE_URL_KEYS = ["ATHENA_STORAGE_URL", "NEXT_PUBLIC_ATHENA_STORAGE_URL"];
|
|
7402
8018
|
var ATHENA_ENV_KEY_KEYS = [
|
|
7403
8019
|
"ATHENA_API_KEY",
|
|
@@ -7478,6 +8094,15 @@ function appendServicePath(baseUrl, segment) {
|
|
|
7478
8094
|
const normalizedBaseUrl = normalizeAthenaGatewayBaseUrl(baseUrl, { label: "Athena public base URL" });
|
|
7479
8095
|
return `${normalizedBaseUrl}/${segment.replace(/^\/+/, "")}`;
|
|
7480
8096
|
}
|
|
8097
|
+
function appendRealtimeGatewayPath(baseUrl) {
|
|
8098
|
+
const normalizedBaseUrl = normalizeAthenaGatewayBaseUrl(baseUrl, { label: "Athena public base URL" });
|
|
8099
|
+
const wsUrl = new URL(normalizedBaseUrl);
|
|
8100
|
+
wsUrl.protocol = wsUrl.protocol === "https:" ? "wss:" : "ws:";
|
|
8101
|
+
wsUrl.pathname = `${wsUrl.pathname.replace(/\/+$/, "")}/wss/gateway`;
|
|
8102
|
+
wsUrl.search = "";
|
|
8103
|
+
wsUrl.hash = "";
|
|
8104
|
+
return wsUrl.toString();
|
|
8105
|
+
}
|
|
7481
8106
|
function resolveServiceUrlOverride(value, label) {
|
|
7482
8107
|
return resolveClientServiceBaseUrl(value, label);
|
|
7483
8108
|
}
|
|
@@ -7486,6 +8111,8 @@ function resolveServiceUrls(config) {
|
|
|
7486
8111
|
return {
|
|
7487
8112
|
dbUrl: resolveServiceUrlOverride(config.db?.url, "Athena DB base URL") ?? resolveServiceUrlOverride(config.gateway?.url, "Athena gateway base URL") ?? resolveServiceUrlOverride(config.dbUrl, "Athena DB base URL") ?? resolveServiceUrlOverride(config.gatewayUrl, "Athena gateway base URL") ?? (baseUrl ? appendServicePath(baseUrl, "db") : void 0),
|
|
7488
8113
|
authUrl: resolveServiceUrlOverride(config.auth?.url, "Athena auth base URL") ?? resolveServiceUrlOverride(config.auth?.baseUrl, "Athena auth base URL") ?? resolveServiceUrlOverride(config.authUrl, "Athena auth base URL") ?? (baseUrl ? appendServicePath(baseUrl, "auth") : void 0),
|
|
8114
|
+
chatUrl: resolveServiceUrlOverride(config.chat?.url, "Athena chat base URL") ?? resolveServiceUrlOverride(config.chatUrl, "Athena chat base URL") ?? (baseUrl ? appendServicePath(baseUrl, "chat") : void 0),
|
|
8115
|
+
chatWsUrl: normalizeOptionalString(config.chat?.wsUrl) ?? normalizeOptionalString(config.chatWsUrl) ?? (baseUrl ? appendRealtimeGatewayPath(baseUrl) : void 0),
|
|
7489
8116
|
storageUrl: resolveServiceUrlOverride(config.storage?.url, "Athena storage base URL") ?? resolveServiceUrlOverride(config.storageUrl, "Athena storage base URL") ?? (baseUrl ? appendServicePath(baseUrl, "storage") : void 0)
|
|
7490
8117
|
};
|
|
7491
8118
|
}
|
|
@@ -7578,6 +8205,7 @@ function mergeClientOverrideOptions(base, overrides) {
|
|
|
7578
8205
|
} : void 0,
|
|
7579
8206
|
db: base.db ? { ...base.db } : void 0,
|
|
7580
8207
|
gateway: base.gateway ? { ...base.gateway } : void 0,
|
|
8208
|
+
chat: base.chat ? { ...base.chat } : void 0,
|
|
7581
8209
|
storage: base.storage ? { ...base.storage } : void 0
|
|
7582
8210
|
};
|
|
7583
8211
|
}
|
|
@@ -7588,6 +8216,7 @@ function mergeClientOverrideOptions(base, overrides) {
|
|
|
7588
8216
|
auth: mergeAuthClientOptions(base.auth, overrides.auth),
|
|
7589
8217
|
db: mergeServiceUrlOverrides(base.db, overrides.db),
|
|
7590
8218
|
gateway: mergeServiceUrlOverrides(base.gateway, overrides.gateway),
|
|
8219
|
+
chat: mergeServiceUrlOverrides(base.chat, overrides.chat),
|
|
7591
8220
|
storage: mergeServiceUrlOverrides(base.storage, overrides.storage)
|
|
7592
8221
|
};
|
|
7593
8222
|
}
|
|
@@ -7646,6 +8275,9 @@ function resolveCreateClientConfig(config) {
|
|
|
7646
8275
|
headers: config.headers,
|
|
7647
8276
|
auth: config.auth,
|
|
7648
8277
|
authUrl: resolvedUrls.authUrl,
|
|
8278
|
+
chat: config.chat,
|
|
8279
|
+
chatUrl: resolvedUrls.chatUrl,
|
|
8280
|
+
chatWsUrl: resolvedUrls.chatWsUrl,
|
|
7649
8281
|
storageUrl: resolvedUrls.storageUrl,
|
|
7650
8282
|
experimental: config.experimental
|
|
7651
8283
|
};
|
|
@@ -7730,6 +8362,119 @@ function createClientFromConfig(config, sourceConfig) {
|
|
|
7730
8362
|
queryTracer
|
|
7731
8363
|
);
|
|
7732
8364
|
const db = createDbModule({ from, rpc, query });
|
|
8365
|
+
const chat = createChatModule({
|
|
8366
|
+
baseUrl: config.chatUrl,
|
|
8367
|
+
apiKey: config.apiKey,
|
|
8368
|
+
client: config.client,
|
|
8369
|
+
headers: config.headers,
|
|
8370
|
+
bearerToken: normalizedAuthConfig?.bearerToken,
|
|
8371
|
+
cookie: normalizedAuthConfig?.cookie,
|
|
8372
|
+
sessionToken: normalizedAuthConfig?.sessionToken,
|
|
8373
|
+
forceNoCache: config.forceNoCache,
|
|
8374
|
+
wsUrl: config.chatWsUrl,
|
|
8375
|
+
webSocketFactory: config.chat?.webSocketFactory ?? void 0
|
|
8376
|
+
});
|
|
8377
|
+
const request2 = async (options) => {
|
|
8378
|
+
const method = options.method ?? "GET";
|
|
8379
|
+
const responseType = options.responseType ?? "json";
|
|
8380
|
+
const service = options.service ?? "db";
|
|
8381
|
+
const baseUrlByService = {
|
|
8382
|
+
db: config.baseUrl,
|
|
8383
|
+
auth: config.authUrl,
|
|
8384
|
+
chat: config.chatUrl,
|
|
8385
|
+
storage: config.storageUrl
|
|
8386
|
+
};
|
|
8387
|
+
const resolvedBaseUrl = options.url ?? baseUrlByService[service];
|
|
8388
|
+
if (!resolvedBaseUrl) {
|
|
8389
|
+
throw new Error(
|
|
8390
|
+
`Athena ${service} base URL is not configured. Pass createClient({ url }) for unified routing or set the service-specific URL first.`
|
|
8391
|
+
);
|
|
8392
|
+
}
|
|
8393
|
+
const normalizedBaseUrl = normalizeAthenaGatewayBaseUrl(resolvedBaseUrl, {
|
|
8394
|
+
label: `Athena ${service} base URL`
|
|
8395
|
+
});
|
|
8396
|
+
const normalizedPath = options.url ? "" : (() => {
|
|
8397
|
+
const path = options.path?.trim();
|
|
8398
|
+
if (!path) {
|
|
8399
|
+
throw new Error("client.request(...) requires either an absolute url or a non-empty path.");
|
|
8400
|
+
}
|
|
8401
|
+
return path.startsWith("/") ? path : `/${path}`;
|
|
8402
|
+
})();
|
|
8403
|
+
const targetUrl = options.url ? `${normalizedBaseUrl}${toRequestQueryString(options.query)}` : `${normalizedBaseUrl}${normalizedPath}${toRequestQueryString(options.query)}`;
|
|
8404
|
+
const headers = {
|
|
8405
|
+
"X-Athena-Sdk": buildSdkHeaderValue(SDK_NAME4),
|
|
8406
|
+
...config.headers ?? {},
|
|
8407
|
+
...options.headers ?? {}
|
|
8408
|
+
};
|
|
8409
|
+
if (service !== "auth") {
|
|
8410
|
+
headers.apikey = headers.apikey ?? config.apiKey;
|
|
8411
|
+
headers["x-api-key"] = headers["x-api-key"] ?? config.apiKey;
|
|
8412
|
+
if (config.client && !hasHeaderIgnoreCase(headers, "X-Athena-Client")) {
|
|
8413
|
+
headers["X-Athena-Client"] = config.client;
|
|
8414
|
+
}
|
|
8415
|
+
if (config.userId && !hasHeaderIgnoreCase(headers, "X-User-Id")) {
|
|
8416
|
+
headers["X-User-Id"] = config.userId;
|
|
8417
|
+
}
|
|
8418
|
+
if (config.organizationId && !hasHeaderIgnoreCase(headers, "X-Organization-Id")) {
|
|
8419
|
+
headers["X-Organization-Id"] = config.organizationId;
|
|
8420
|
+
}
|
|
8421
|
+
if (normalizedAuthConfig?.sessionToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Session-Token")) {
|
|
8422
|
+
headers["X-Athena-Auth-Session-Token"] = normalizedAuthConfig.sessionToken;
|
|
8423
|
+
}
|
|
8424
|
+
if (normalizedAuthConfig?.bearerToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Bearer-Token")) {
|
|
8425
|
+
headers["X-Athena-Auth-Bearer-Token"] = normalizedAuthConfig.bearerToken;
|
|
8426
|
+
}
|
|
8427
|
+
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
8428
|
+
headers.Cookie = normalizedAuthConfig.cookie;
|
|
8429
|
+
}
|
|
8430
|
+
} else {
|
|
8431
|
+
const authApiKey = normalizedAuthConfig?.apiKey ?? config.apiKey;
|
|
8432
|
+
if (authApiKey && !hasHeaderIgnoreCase(headers, "x-api-key")) {
|
|
8433
|
+
headers.apikey = headers.apikey ?? authApiKey;
|
|
8434
|
+
headers["x-api-key"] = headers["x-api-key"] ?? authApiKey;
|
|
8435
|
+
}
|
|
8436
|
+
if (normalizedAuthConfig?.bearerToken && !hasHeaderIgnoreCase(headers, "Authorization")) {
|
|
8437
|
+
headers.Authorization = `Bearer ${normalizedAuthConfig.bearerToken}`;
|
|
8438
|
+
}
|
|
8439
|
+
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(headers, "Cookie")) {
|
|
8440
|
+
headers.Cookie = normalizedAuthConfig.cookie;
|
|
8441
|
+
}
|
|
8442
|
+
if (normalizedAuthConfig?.sessionToken && !hasHeaderIgnoreCase(headers, "X-Athena-Auth-Session-Token")) {
|
|
8443
|
+
headers["X-Athena-Auth-Session-Token"] = normalizedAuthConfig.sessionToken;
|
|
8444
|
+
}
|
|
8445
|
+
}
|
|
8446
|
+
const shouldSendJsonBody = options.body !== void 0 && options.body !== null && !(options.body instanceof FormData) && !(options.body instanceof Blob) && !(options.body instanceof URLSearchParams) && !(options.body instanceof ArrayBuffer) && !ArrayBuffer.isView(options.body) && typeof options.body !== "string";
|
|
8447
|
+
if (shouldSendJsonBody && !hasHeaderIgnoreCase(headers, "Content-Type")) {
|
|
8448
|
+
headers["Content-Type"] = "application/json";
|
|
8449
|
+
}
|
|
8450
|
+
const response = await fetch(targetUrl, {
|
|
8451
|
+
method,
|
|
8452
|
+
headers,
|
|
8453
|
+
body: options.body === void 0 || options.body === null ? void 0 : shouldSendJsonBody ? JSON.stringify(options.body) : options.body,
|
|
8454
|
+
signal: options.signal,
|
|
8455
|
+
credentials: options.credentials
|
|
8456
|
+
});
|
|
8457
|
+
if (responseType === "response") {
|
|
8458
|
+
return {
|
|
8459
|
+
ok: response.ok,
|
|
8460
|
+
status: response.status,
|
|
8461
|
+
statusText: response.statusText,
|
|
8462
|
+
headers: response.headers,
|
|
8463
|
+
data: null,
|
|
8464
|
+
raw: response
|
|
8465
|
+
};
|
|
8466
|
+
}
|
|
8467
|
+
const rawText = await response.text();
|
|
8468
|
+
const parsed = responseType === "text" ? rawText : parseArbitraryResponseBody(rawText, response.headers.get("content-type"));
|
|
8469
|
+
return {
|
|
8470
|
+
ok: response.ok,
|
|
8471
|
+
status: response.status,
|
|
8472
|
+
statusText: response.statusText,
|
|
8473
|
+
headers: response.headers,
|
|
8474
|
+
data: parsed,
|
|
8475
|
+
raw: response
|
|
8476
|
+
};
|
|
8477
|
+
};
|
|
7733
8478
|
const withContext = (context) => createClientFromInput(
|
|
7734
8479
|
mergeClientOverrideOptions(sourceConfig, toClientContextOverrides(context))
|
|
7735
8480
|
);
|
|
@@ -7745,8 +8490,10 @@ function createClientFromConfig(config, sourceConfig) {
|
|
|
7745
8490
|
db,
|
|
7746
8491
|
rpc,
|
|
7747
8492
|
query,
|
|
8493
|
+
request: request2,
|
|
7748
8494
|
verifyConnection: gateway.verifyConnection,
|
|
7749
8495
|
auth: auth.auth,
|
|
8496
|
+
chat,
|
|
7750
8497
|
withContext,
|
|
7751
8498
|
withSession,
|
|
7752
8499
|
withOptions: authWithOptions
|
|
@@ -7791,6 +8538,8 @@ var AthenaClient = class {
|
|
|
7791
8538
|
const url = options.url ?? readFirstEnvValue(env, ATHENA_ENV_URL_KEYS);
|
|
7792
8539
|
const gatewayUrl = options.gatewayUrl ?? readFirstEnvValue(env, ATHENA_ENV_GATEWAY_URL_KEYS);
|
|
7793
8540
|
const authUrl = options.authUrl ?? readFirstEnvValue(env, ATHENA_ENV_AUTH_URL_KEYS);
|
|
8541
|
+
const chatUrl = options.chatUrl ?? readFirstEnvValue(env, ATHENA_ENV_CHAT_URL_KEYS);
|
|
8542
|
+
const chatWsUrl = options.chatWsUrl ?? readFirstEnvValue(env, ATHENA_ENV_CHAT_WS_URL_KEYS);
|
|
7794
8543
|
const storageUrl = options.storageUrl ?? readFirstEnvValue(env, ATHENA_ENV_STORAGE_URL_KEYS);
|
|
7795
8544
|
const key = options.key ?? readFirstEnvValue(env, ATHENA_ENV_KEY_KEYS);
|
|
7796
8545
|
const client = options.client ?? readFirstEnvValue(env, ATHENA_ENV_CLIENT_KEYS);
|
|
@@ -7805,6 +8554,8 @@ var AthenaClient = class {
|
|
|
7805
8554
|
url,
|
|
7806
8555
|
gatewayUrl,
|
|
7807
8556
|
authUrl,
|
|
8557
|
+
chatUrl,
|
|
8558
|
+
chatWsUrl,
|
|
7808
8559
|
storageUrl,
|
|
7809
8560
|
key,
|
|
7810
8561
|
client
|
|
@@ -7925,6 +8676,8 @@ function createAdapterClient(options, context) {
|
|
|
7925
8676
|
url: options?.url,
|
|
7926
8677
|
gatewayUrl: options?.gatewayUrl,
|
|
7927
8678
|
authUrl: options?.authUrl,
|
|
8679
|
+
chatUrl: options?.chatUrl,
|
|
8680
|
+
chatWsUrl: options?.chatWsUrl,
|
|
7928
8681
|
storageUrl: options?.storageUrl,
|
|
7929
8682
|
key: options?.key,
|
|
7930
8683
|
client: options?.client,
|