@viu/emporix-sdk 2.19.0 → 2.20.1
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/CHANGELOG.md +30 -0
- package/dist/availability.d.cts +1 -1
- package/dist/availability.d.ts +1 -1
- package/dist/cart.d.cts +1 -1
- package/dist/cart.d.ts +1 -1
- package/dist/category.cjs +12 -0
- package/dist/category.cjs.map +1 -1
- package/dist/category.d.cts +12 -2
- package/dist/category.d.ts +12 -2
- package/dist/category.js +1 -1
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/{chunk-6XND7SYV.js → chunk-ZNLHLFQM.js} +14 -2
- package/dist/chunk-ZNLHLFQM.js.map +1 -0
- package/dist/companies.d.cts +1 -1
- package/dist/companies.d.ts +1 -1
- package/dist/contacts.d.cts +1 -1
- package/dist/contacts.d.ts +1 -1
- package/dist/{context-DhoFgoKf.d.cts → context-Dawv2AtS.d.cts} +16 -0
- package/dist/{context-DhoFgoKf.d.ts → context-Dawv2AtS.d.ts} +16 -0
- package/dist/customer-groups.d.cts +1 -1
- package/dist/customer-groups.d.ts +1 -1
- package/dist/customer.d.cts +1 -1
- package/dist/customer.d.ts +1 -1
- package/dist/index.cjs +461 -299
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +256 -17
- package/dist/index.d.ts +256 -17
- package/dist/index.js +153 -3
- package/dist/index.js.map +1 -1
- package/dist/locations.d.cts +1 -1
- package/dist/locations.d.ts +1 -1
- package/dist/media.d.cts +17 -2
- package/dist/media.d.ts +17 -2
- package/dist/orders.d.cts +10 -27
- package/dist/orders.d.ts +10 -27
- package/dist/payment.d.cts +1 -1
- package/dist/payment.d.ts +1 -1
- package/dist/price.d.cts +5 -18
- package/dist/price.d.ts +5 -18
- package/dist/product.d.cts +7 -1
- package/dist/product.d.ts +7 -1
- package/dist/segment.d.cts +1 -1
- package/dist/segment.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-6XND7SYV.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClientContext, b as AuthContext, P as PaginatedItems, T as TokenProvider, n as ResolvedConfig, E as EmporixConfig, j as LogLevel, o as ServiceName, e as CustomerTokenRefresher } from './context-
|
|
2
|
-
export { A as AnonymousSession, a as AnonymousSessionStore, c as AuthKind, d as CustomerRefreshRegistry, D as DEFAULT_HOST, f as DefaultTokenProvider, H as HttpClient, g as HttpClientOptions, L as LEVEL, h as LevelResolver, i as LogFields, k as Logger, l as LoggerConfig, m as LoggerObjectConfig, R as RequestOptions, S as ServiceCredentials, p as StorefrontCredentials, q as auth, r as createConsoleLogger, s as createNoopLogger, t as iterateAll, u as redact, v as resolveToken, w as validateConfig } from './context-
|
|
1
|
+
import { C as ClientContext, b as AuthContext, P as PaginatedItems, T as TokenProvider, n as ResolvedConfig, E as EmporixConfig, j as LogLevel, o as ServiceName, e as CustomerTokenRefresher } from './context-Dawv2AtS.js';
|
|
2
|
+
export { A as AnonymousSession, a as AnonymousSessionStore, c as AuthKind, d as CustomerRefreshRegistry, D as DEFAULT_HOST, f as DefaultTokenProvider, H as HttpClient, g as HttpClientOptions, L as LEVEL, h as LevelResolver, i as LogFields, k as Logger, l as LoggerConfig, m as LoggerObjectConfig, R as RequestOptions, S as ServiceCredentials, p as StorefrontCredentials, q as auth, r as createConsoleLogger, s as createNoopLogger, t as iterateAll, u as redact, v as resolveToken, w as validateConfig } from './context-Dawv2AtS.js';
|
|
3
3
|
import { CustomerService } from './customer.js';
|
|
4
4
|
export { Address, AddressCreateInput, AddressUpdateInput, Customer, CustomerSession, CustomerSignupInput, CustomerUpdateInput, PasswordChangeInput, PasswordResetConfirmInput, PasswordResetRequestInput } from './customer.js';
|
|
5
5
|
import { ProductService } from './product.js';
|
|
@@ -834,7 +834,7 @@ declare class CloudFunctionsService {
|
|
|
834
834
|
|
|
835
835
|
type AbstractWebhookConfig = {
|
|
836
836
|
/**
|
|
837
|
-
* Indicates whether a given configuration is active. Only one configuration can be active.
|
|
837
|
+
* Indicates whether a given configuration is active. Only one configuration can be active at a time.
|
|
838
838
|
*/
|
|
839
839
|
active?: boolean;
|
|
840
840
|
provider?: Provider;
|
|
@@ -942,9 +942,16 @@ type ConfigurationGet = {
|
|
|
942
942
|
}>;
|
|
943
943
|
};
|
|
944
944
|
/**
|
|
945
|
-
* Unique identifier of webhook configuration.
|
|
945
|
+
* Unique identifier of the webhook configuration type.
|
|
946
946
|
*/
|
|
947
947
|
type ConfigCode = string;
|
|
948
|
+
/**
|
|
949
|
+
* Webhook provider strategy. Maps to configuration types as follows:
|
|
950
|
+
*
|
|
951
|
+
* * `SVIX` – `svix`
|
|
952
|
+
* * `SVIX_SHARED` – `svix_shared`
|
|
953
|
+
* * `HTTP` – `http`
|
|
954
|
+
*/
|
|
948
955
|
type Provider = 'SVIX_SHARED' | 'SVIX' | 'HTTP';
|
|
949
956
|
type WebhookConfigUpdate = AbstractWebhookConfig & {
|
|
950
957
|
configuration?: Configuration;
|
|
@@ -1177,7 +1184,7 @@ declare class WebhookService {
|
|
|
1177
1184
|
/**
|
|
1178
1185
|
* Type which the schema should be assigned to. Can be one of the predefined values or any custom schema type id.
|
|
1179
1186
|
*/
|
|
1180
|
-
type SchemaType = 'CART' | 'CART_ITEM' | 'CATEGORY' | 'COMPANY' | 'COUPON' | 'CUSTOMER' | 'CUSTOMER_ADDRESS' | 'ORDER' | 'ORDER_ENTRY' | 'PRODUCT' | 'QUOTE' | 'RETURN' | 'PRICE_LIST' | 'SITE' | 'CUSTOM_ENTITY' | 'VENDOR';
|
|
1187
|
+
type SchemaType = 'CART' | 'CART_ITEM' | 'CATEGORY' | 'COMPANY' | 'COUPON' | 'CUSTOMER' | 'CUSTOMER_ADDRESS' | 'ORDER' | 'ORDER_ENTRY' | 'PRODUCT' | 'QUOTE' | 'RETURN' | 'PRICE_LIST' | 'SITE' | 'CUSTOM_ENTITY' | 'VENDOR' | 'MEDIA';
|
|
1181
1188
|
/**
|
|
1182
1189
|
* Type of the attribute.
|
|
1183
1190
|
*
|
|
@@ -1378,6 +1385,40 @@ type CustomInstanceResponse = {
|
|
|
1378
1385
|
media?: Array<string>;
|
|
1379
1386
|
metadata?: CustomInstanceMetadata;
|
|
1380
1387
|
};
|
|
1388
|
+
type BulkResponse = Array<{
|
|
1389
|
+
/**
|
|
1390
|
+
* Index of the processed item, matching the item position in request body.
|
|
1391
|
+
*/
|
|
1392
|
+
index?: number;
|
|
1393
|
+
/**
|
|
1394
|
+
* HTTP Status Code.
|
|
1395
|
+
*/
|
|
1396
|
+
code?: number;
|
|
1397
|
+
/**
|
|
1398
|
+
* HTTP Status description
|
|
1399
|
+
*/
|
|
1400
|
+
status?: string;
|
|
1401
|
+
/**
|
|
1402
|
+
* Error message.
|
|
1403
|
+
*/
|
|
1404
|
+
message?: string;
|
|
1405
|
+
details?: Array<{
|
|
1406
|
+
/**
|
|
1407
|
+
* Error details.
|
|
1408
|
+
*/
|
|
1409
|
+
message?: string;
|
|
1410
|
+
}>;
|
|
1411
|
+
}>;
|
|
1412
|
+
type BulkPatchCustomInstanceRequest = {
|
|
1413
|
+
/**
|
|
1414
|
+
* Unique identifier of the custom instance to patch.
|
|
1415
|
+
*/
|
|
1416
|
+
id: string;
|
|
1417
|
+
/**
|
|
1418
|
+
* List of patch operations to apply to the custom instance.
|
|
1419
|
+
*/
|
|
1420
|
+
data: Array<PatchOperation$1>;
|
|
1421
|
+
};
|
|
1381
1422
|
type CustomInstanceMetadata = {
|
|
1382
1423
|
/**
|
|
1383
1424
|
* Date and time when the object was created, compliant with the ISO 8601 standard. For example: `2022-03-31T09:52:15.423Z`
|
|
@@ -1398,7 +1439,31 @@ type CustomInstanceMetadata = {
|
|
|
1398
1439
|
[key: string]: unknown;
|
|
1399
1440
|
};
|
|
1400
1441
|
};
|
|
1442
|
+
type PatchOperation$1 = {
|
|
1443
|
+
/**
|
|
1444
|
+
* Indicates an operation which should be done on a return. Available operations: `add` `remove` and `replace`
|
|
1445
|
+
*/
|
|
1446
|
+
op: 'add' | 'remove' | 'replace';
|
|
1447
|
+
/**
|
|
1448
|
+
* Path to the field to update.
|
|
1449
|
+
*
|
|
1450
|
+
* Examples: `/name`, `/mixins/additionalAttributes/externalId`, `/mixins/additionalAttributes/careInstructions/1`.
|
|
1451
|
+
*
|
|
1452
|
+
* To append an item to an array mixin field (for example, a table row), use `add` with a path ending in `/-`. The `-` means append after the last element.
|
|
1453
|
+
*/
|
|
1454
|
+
path: string;
|
|
1455
|
+
/**
|
|
1456
|
+
* Indicates a value that should be changed or added. The value can be of a primitive type, like string, number, boolean or it can be an object or an array.
|
|
1457
|
+
*/
|
|
1458
|
+
value?: {
|
|
1459
|
+
[key: string]: unknown;
|
|
1460
|
+
} | string | number;
|
|
1461
|
+
};
|
|
1401
1462
|
|
|
1463
|
+
/** One item for {@link SchemaService.bulkPatchInstances} — `{ id, data: op[] }`. */
|
|
1464
|
+
type BulkPatchInstanceItem = BulkPatchCustomInstanceRequest;
|
|
1465
|
+
/** Per-item results of a bulk operation (207) — `{ index?, code?, status?, message?, details? }[]`. */
|
|
1466
|
+
type BulkInstanceResult = BulkResponse;
|
|
1402
1467
|
/** A schema definition (typed attributes attached to one or more entity types). */
|
|
1403
1468
|
type Schema = SchemaResponse;
|
|
1404
1469
|
/** A single typed attribute within a schema (recursive for `OBJECT`). */
|
|
@@ -1541,6 +1606,13 @@ declare class SchemaService {
|
|
|
1541
1606
|
replaceInstance<T = Record<string, unknown>>(type: string, id: string, draft: CustomInstanceDraft<T>, auth?: AuthContext): Promise<CustomInstance<T>>;
|
|
1542
1607
|
/** Partially update an instance (`PATCH`). */
|
|
1543
1608
|
patchInstance<T = Record<string, unknown>>(type: string, id: string, patch: Partial<CustomInstanceDraft<T>>, auth?: AuthContext): Promise<CustomInstance<T>>;
|
|
1609
|
+
/**
|
|
1610
|
+
* Patch up to 200 custom instances of `type` in one call
|
|
1611
|
+
* (`PATCH /custom-entities/{type}/instances/bulk`). Returns a 207 envelope:
|
|
1612
|
+
* a per-item result array — a 207 is success, individual failures live in
|
|
1613
|
+
* each item's `code`/`status`.
|
|
1614
|
+
*/
|
|
1615
|
+
bulkPatchInstances(type: string, items: BulkPatchInstanceItem[], auth?: AuthContext): Promise<BulkInstanceResult>;
|
|
1544
1616
|
/** Delete an instance by id. */
|
|
1545
1617
|
deleteInstance(type: string, id: string, auth?: AuthContext): Promise<void>;
|
|
1546
1618
|
/**
|
|
@@ -1619,9 +1691,9 @@ type ExpandedTokenResponse = InnerTokenResponse & {
|
|
|
1619
1691
|
*/
|
|
1620
1692
|
type ExpandableTokenResponse = InnerTokenResponse | ExpandedTokenResponse;
|
|
1621
1693
|
/**
|
|
1622
|
-
* Type of the native tool.
|
|
1694
|
+
* Type of the native tool. Value `teams` is in preview.
|
|
1623
1695
|
*/
|
|
1624
|
-
type NativeToolType = 'slack' | 'rag_custom' | 'rag_emporix';
|
|
1696
|
+
type NativeToolType = 'slack' | 'rag_custom' | 'rag_emporix' | 'teams';
|
|
1625
1697
|
type BaseNativeTool = {
|
|
1626
1698
|
type: NativeToolType;
|
|
1627
1699
|
/**
|
|
@@ -1781,6 +1853,49 @@ type SlackNativeToolResponse = BaseNativeTool & {
|
|
|
1781
1853
|
config?: SlackNativeToolConfigResponse;
|
|
1782
1854
|
metadata?: MetadataResponse$1;
|
|
1783
1855
|
};
|
|
1856
|
+
/**
|
|
1857
|
+
* MS Teams native tool operation identifier.
|
|
1858
|
+
*/
|
|
1859
|
+
type TeamsAllowedOperations = 'sendMessage' | 'createChat' | 'createChannel' | 'inviteParticipants' | 'collaborateOnChannel' | 'collaborateOnChat';
|
|
1860
|
+
/**
|
|
1861
|
+
* 
|
|
1862
|
+
*
|
|
1863
|
+
* {% hint style="danger" %}
|
|
1864
|
+
* This functionality is in preview mode - some of the features may not be fully operational yet.
|
|
1865
|
+
* {% endhint %}
|
|
1866
|
+
*
|
|
1867
|
+
* Configuration of an MS Teams native tool instance.
|
|
1868
|
+
*/
|
|
1869
|
+
type TeamsNativeToolConfigResponse = {
|
|
1870
|
+
/**
|
|
1871
|
+
* Microsoft Teams team ID the tool is bound to.
|
|
1872
|
+
*/
|
|
1873
|
+
teamId: string;
|
|
1874
|
+
/**
|
|
1875
|
+
* Customer Azure AD tenant ID for the Teams workspace.
|
|
1876
|
+
*/
|
|
1877
|
+
tenantId?: string;
|
|
1878
|
+
/**
|
|
1879
|
+
* Agent ID that handles inbound Teams replies when no conversation-specific owner is set.
|
|
1880
|
+
*/
|
|
1881
|
+
defaultInboundAgentId?: string;
|
|
1882
|
+
/**
|
|
1883
|
+
* Operations the tool instance exposes to assigned agents. At least one value is required when the tool is enabled.
|
|
1884
|
+
*/
|
|
1885
|
+
allowedOperations?: Array<TeamsAllowedOperations>;
|
|
1886
|
+
};
|
|
1887
|
+
type TeamsNativeToolResponse = BaseNativeTool & {
|
|
1888
|
+
/**
|
|
1889
|
+
* Unique identifier of the tool.
|
|
1890
|
+
*/
|
|
1891
|
+
id?: string;
|
|
1892
|
+
/**
|
|
1893
|
+
* For TeamsNativeTool it has to be set to `teams`.
|
|
1894
|
+
*/
|
|
1895
|
+
type?: unknown;
|
|
1896
|
+
config?: TeamsNativeToolConfigResponse;
|
|
1897
|
+
metadata?: MetadataResponse$1;
|
|
1898
|
+
};
|
|
1784
1899
|
type RagCustomNativeToolResponse = BaseNativeTool & {
|
|
1785
1900
|
/**
|
|
1786
1901
|
* Unique identifier of the tool.
|
|
@@ -1808,7 +1923,40 @@ type RagEmporixNativeToolResponse = BaseNativeTool & {
|
|
|
1808
1923
|
/**
|
|
1809
1924
|
* List of native tools which agents should have access to.
|
|
1810
1925
|
*/
|
|
1811
|
-
type NativeToolsResponse = Array<SlackNativeToolResponse | RagCustomNativeToolResponse | RagEmporixNativeToolResponse>;
|
|
1926
|
+
type NativeToolsResponse = Array<SlackNativeToolResponse | RagCustomNativeToolResponse | RagEmporixNativeToolResponse | TeamsNativeToolResponse>;
|
|
1927
|
+
/**
|
|
1928
|
+
* Represents an active agent conversation context (MS Teams channel or group chat).
|
|
1929
|
+
*/
|
|
1930
|
+
type ConversationResponse = {
|
|
1931
|
+
/**
|
|
1932
|
+
* Provider-side conversation identifier (Teams conversation ID).
|
|
1933
|
+
*/
|
|
1934
|
+
conversationId?: string;
|
|
1935
|
+
/**
|
|
1936
|
+
* Human-readable name of the conversation channel or group chat.
|
|
1937
|
+
*/
|
|
1938
|
+
conversationName?: string;
|
|
1939
|
+
/**
|
|
1940
|
+
* Caller-supplied reference key used to reuse an existing conversation.
|
|
1941
|
+
*/
|
|
1942
|
+
contextRef?: string;
|
|
1943
|
+
/**
|
|
1944
|
+
* Teams channel or chat identifier.
|
|
1945
|
+
*/
|
|
1946
|
+
channelId?: string;
|
|
1947
|
+
/**
|
|
1948
|
+
* Identifier of the agent that owns this conversation.
|
|
1949
|
+
*/
|
|
1950
|
+
agentId?: string;
|
|
1951
|
+
/**
|
|
1952
|
+
* LangGraph session (checkpointer) ID for agent continuity.
|
|
1953
|
+
*/
|
|
1954
|
+
sessionId?: string;
|
|
1955
|
+
/**
|
|
1956
|
+
* Timestamp of the last message activity in this conversation.
|
|
1957
|
+
*/
|
|
1958
|
+
lastMessageAt?: string;
|
|
1959
|
+
};
|
|
1812
1960
|
type McpServerConfig = {
|
|
1813
1961
|
/**
|
|
1814
1962
|
* URL of the MCP server.
|
|
@@ -1893,11 +2041,11 @@ type BaseLlm = {
|
|
|
1893
2041
|
/**
|
|
1894
2042
|
* Value between 0.1 and 1.0 (inclusive), in steps of 0.1. The lower value the more creative (but less stable) the model is.
|
|
1895
2043
|
*/
|
|
1896
|
-
temperature
|
|
2044
|
+
temperature?: 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1;
|
|
1897
2045
|
/**
|
|
1898
2046
|
* The limit of tokens which agent can burn during one request session.
|
|
1899
2047
|
*/
|
|
1900
|
-
maxTokens
|
|
2048
|
+
maxTokens?: number;
|
|
1901
2049
|
};
|
|
1902
2050
|
type EmporixLlm = BaseLlm & {
|
|
1903
2051
|
/**
|
|
@@ -1905,6 +2053,35 @@ type EmporixLlm = BaseLlm & {
|
|
|
1905
2053
|
*/
|
|
1906
2054
|
provider: 'emporix_openai';
|
|
1907
2055
|
};
|
|
2056
|
+
/**
|
|
2057
|
+
* OAuth 2.0 client-credentials settings for authenticating with a self-hosted LLM backend.
|
|
2058
|
+
*/
|
|
2059
|
+
type OAuthParams = {
|
|
2060
|
+
/**
|
|
2061
|
+
* Base URL of the OAuth 2.0 authorization server. The access token is requested from `{url}/token`.
|
|
2062
|
+
*/
|
|
2063
|
+
url: string;
|
|
2064
|
+
/**
|
|
2065
|
+
* OAuth 2.0 client identifier registered with the authorization server.
|
|
2066
|
+
*/
|
|
2067
|
+
clientId: string;
|
|
2068
|
+
/**
|
|
2069
|
+
* OAuth 2.0 grant type used to obtain an access token.
|
|
2070
|
+
*/
|
|
2071
|
+
grantType: 'client_credentials';
|
|
2072
|
+
/**
|
|
2073
|
+
* Optional space-separated list of scopes to request for the access token.
|
|
2074
|
+
*/
|
|
2075
|
+
scope?: string;
|
|
2076
|
+
};
|
|
2077
|
+
type OAuthParamsRequest = OAuthParams & {
|
|
2078
|
+
[key: string]: unknown;
|
|
2079
|
+
} & {
|
|
2080
|
+
clientSecret?: InnerTokenRequest;
|
|
2081
|
+
};
|
|
2082
|
+
type OAuthParamsResponse = OAuthParams & {
|
|
2083
|
+
clientSecret?: ExpandableTokenResponse;
|
|
2084
|
+
};
|
|
1908
2085
|
type SelfHostedParams = {
|
|
1909
2086
|
/**
|
|
1910
2087
|
* Url of the self-hosted LLM.
|
|
@@ -1919,9 +2096,11 @@ type SelfHostedParamsRequest = SelfHostedParams & {
|
|
|
1919
2096
|
[key: string]: unknown;
|
|
1920
2097
|
} & {
|
|
1921
2098
|
authorizationHeaderToken?: InnerTokenRequest;
|
|
2099
|
+
oAuthParams?: OAuthParamsRequest;
|
|
1922
2100
|
};
|
|
1923
2101
|
type SelfHostedParamsResponse = SelfHostedParams & {
|
|
1924
2102
|
authorizationHeaderToken?: ExpandableTokenResponse;
|
|
2103
|
+
oAuthParams?: OAuthParamsResponse;
|
|
1925
2104
|
};
|
|
1926
2105
|
type SelfHostedLlm = BaseLlm & {
|
|
1927
2106
|
/**
|
|
@@ -1948,8 +2127,24 @@ type ApiKeyLlmRequest = ApiKeyLlm & {
|
|
|
1948
2127
|
type ApiKeyLlmResponse = ApiKeyLlm & {
|
|
1949
2128
|
token?: ExpandableTokenResponse;
|
|
1950
2129
|
};
|
|
1951
|
-
|
|
2130
|
+
/**
|
|
2131
|
+
* 
|
|
2132
|
+
*
|
|
2133
|
+
* {% hint style="danger" %}
|
|
2134
|
+
* This functionality is in preview mode - some of the features may not be fully operational yet.
|
|
2135
|
+
* {% endhint %}
|
|
2136
|
+
*
|
|
2137
|
+
* Reference to a native tool assigned to an agent.
|
|
2138
|
+
*/
|
|
2139
|
+
type NativeToolReferenceRequest = {
|
|
2140
|
+
/**
|
|
2141
|
+
* Identifier of the native tool.
|
|
2142
|
+
*/
|
|
1952
2143
|
id: string;
|
|
2144
|
+
/**
|
|
2145
|
+
* Optional per-agent override of allowed MS Teams operations. When omitted, the tool instance defaults apply.
|
|
2146
|
+
*/
|
|
2147
|
+
allowedOperations?: Array<TeamsAllowedOperations>;
|
|
1953
2148
|
};
|
|
1954
2149
|
/**
|
|
1955
2150
|
* List of agent collaborations which allows an agent to hand off its task to other agents.
|
|
@@ -2093,6 +2288,11 @@ type BaseForAgentAndTemplate = BaseForAgentAndTemplateAndHandOff & {
|
|
|
2093
2288
|
*/
|
|
2094
2289
|
icon?: string;
|
|
2095
2290
|
tags?: Array<string>;
|
|
2291
|
+
/**
|
|
2292
|
+
* Optional JSON Schema (provided as a JSON string) that constrains the structure of the agent's generated output. Use this when you need predictable, machine-readable output instead of free-form text.
|
|
2293
|
+
*
|
|
2294
|
+
*/
|
|
2295
|
+
outputFormat?: string;
|
|
2096
2296
|
/**
|
|
2097
2297
|
* Indicates whether the agent is enabled.
|
|
2098
2298
|
*/
|
|
@@ -2112,9 +2312,9 @@ type BaseForAgentRequestAndResponse = BaseForAgentAndTemplate & {
|
|
|
2112
2312
|
};
|
|
2113
2313
|
type AgentRequest = BaseForAgentRequestAndResponse & {
|
|
2114
2314
|
/**
|
|
2115
|
-
*
|
|
2315
|
+
* Native tools assigned to the agent, optionally with per-agent `allowedOperations` overrides.
|
|
2116
2316
|
*/
|
|
2117
|
-
nativeTools?: Array<
|
|
2317
|
+
nativeTools?: Array<NativeToolReferenceRequest>;
|
|
2118
2318
|
llmConfig: EmporixLlm | ApiKeyLlmRequest | SelfHostedLlmRequest;
|
|
2119
2319
|
mcpServers: AgentMcpServersRequest;
|
|
2120
2320
|
metadata?: MetadataRequest;
|
|
@@ -2186,6 +2386,7 @@ type PatchRequest = Array<{
|
|
|
2186
2386
|
[key: string]: unknown;
|
|
2187
2387
|
};
|
|
2188
2388
|
}>;
|
|
2389
|
+
type QParamSearchBody2 = QParamSearchBody;
|
|
2189
2390
|
|
|
2190
2391
|
/** Single-shot text generation request (`POST /texts`). Has `maxTokens`. */
|
|
2191
2392
|
type TextRequest = TextGenerationRequest;
|
|
@@ -2241,6 +2442,18 @@ interface DeleteAgentOptions {
|
|
|
2241
2442
|
/** Force deletion even if the agent is referenced elsewhere (`?force=true`). */
|
|
2242
2443
|
force?: boolean;
|
|
2243
2444
|
}
|
|
2445
|
+
/** Options for {@link AiService.chatStream}. */
|
|
2446
|
+
interface ChatStreamOptions {
|
|
2447
|
+
/**
|
|
2448
|
+
* Reuse an existing chat context (sent as the `session-id` header). If
|
|
2449
|
+
* omitted, the server generates a new session id.
|
|
2450
|
+
*/
|
|
2451
|
+
sessionId?: string;
|
|
2452
|
+
}
|
|
2453
|
+
/** A stored agentic conversation (Teams-backed). */
|
|
2454
|
+
type Conversation = ConversationResponse;
|
|
2455
|
+
/** Request body for `searchConversations` (`{ q? }`) — same shape as agent search. */
|
|
2456
|
+
type ConversationSearchQuery = QParamSearchBody2;
|
|
2244
2457
|
|
|
2245
2458
|
/**
|
|
2246
2459
|
* Emporix AI Service (`/ai-service/{tenant}/…`): text generation, chat
|
|
@@ -2292,6 +2505,17 @@ declare class AiService {
|
|
|
2292
2505
|
* Returns the job-id ARRAY verbatim.
|
|
2293
2506
|
*/
|
|
2294
2507
|
chatAsync(input: ChatRequest, auth?: AuthContext): Promise<JobIdResponse[]>;
|
|
2508
|
+
/**
|
|
2509
|
+
* Streaming agent chat (`POST /agentic/chat-stream`, `text/event-stream`).
|
|
2510
|
+
* Yields each SSE `data` payload verbatim — the upstream contract types the
|
|
2511
|
+
* stream body as an opaque string, so chunks are raw strings, not parsed
|
|
2512
|
+
* objects. Consume with `for await`.
|
|
2513
|
+
*/
|
|
2514
|
+
chatStream(input: ChatRequest, opts?: ChatStreamOptions, auth?: AuthContext): AsyncIterable<string>;
|
|
2515
|
+
/** List stored agentic conversations (`GET /agentic/conversations`). */
|
|
2516
|
+
listConversations(auth?: AuthContext): Promise<Conversation[]>;
|
|
2517
|
+
/** Server-side conversation search (`POST /agentic/conversations/search`). */
|
|
2518
|
+
searchConversations(query: ConversationSearchQuery, auth?: AuthContext): Promise<Conversation[]>;
|
|
2295
2519
|
}
|
|
2296
2520
|
|
|
2297
2521
|
type Metadata$7 = {
|
|
@@ -5103,9 +5327,9 @@ declare class SepaExportService {
|
|
|
5103
5327
|
}
|
|
5104
5328
|
|
|
5105
5329
|
/**
|
|
5106
|
-
* Informs about status of reindex job. `PENDING` means that the maximum number of parallel `IN_PROGRESS` jobs is reached and such job will be processed when one of current `IN_PROGRESS` jobs is released.
|
|
5330
|
+
* Informs about status of reindex job. `PENDING` means that the maximum number of parallel `IN_PROGRESS` jobs is reached and such job will be processed when one of current `IN_PROGRESS` jobs is released. `PUBLISHED` means that all the indexing events were emitted. `SUCCESS` means that all the indexing events were consumed.
|
|
5107
5331
|
*/
|
|
5108
|
-
type ReindexJobStatus$1 = 'FAILURE' | 'IN_PROGRESS' | 'PENDING' | 'SUCCESS';
|
|
5332
|
+
type ReindexJobStatus$1 = 'FAILURE' | 'IN_PROGRESS' | 'PENDING' | 'PUBLISHED' | 'SUCCESS';
|
|
5109
5333
|
type Metadata$3 = {
|
|
5110
5334
|
/**
|
|
5111
5335
|
* Date and time when the object was created. The value is approved as an ISO-8601 representation of an Instant. For example: `2022-04-30T13:18:02.379Z`
|
|
@@ -5131,6 +5355,14 @@ type ReindexJob$1 = {
|
|
|
5131
5355
|
*/
|
|
5132
5356
|
message?: string;
|
|
5133
5357
|
status?: ReindexJobStatus$1;
|
|
5358
|
+
/**
|
|
5359
|
+
* Expected number of entities which need to be indexed.
|
|
5360
|
+
*/
|
|
5361
|
+
expectedCount?: number;
|
|
5362
|
+
/**
|
|
5363
|
+
* Actual number of entities which were indexed. Allows to track the progress of reindexing process.
|
|
5364
|
+
*/
|
|
5365
|
+
processedCount?: number;
|
|
5134
5366
|
metadata?: Metadata$3;
|
|
5135
5367
|
};
|
|
5136
5368
|
type ReindexRequest = {
|
|
@@ -5168,9 +5400,16 @@ type IndexConfiguration = IndexPublicConfiguration & {
|
|
|
5168
5400
|
*/
|
|
5169
5401
|
writeKey?: string;
|
|
5170
5402
|
/**
|
|
5171
|
-
* Optional list of root product mixin keys to exclude from indexing. When set, the specified mixin keys are omitted from both the non-localized and localized portions of the indexed document. Applies only to the `BATTERY_INCLUDED` provider
|
|
5403
|
+
* Optional list of root product mixin keys to exclude from indexing. When set, the specified mixin keys are omitted from both the non-localized and localized portions of the indexed document. Applies only to the `BATTERY_INCLUDED` provider.
|
|
5172
5404
|
*/
|
|
5173
5405
|
excludedMixinKeys?: Array<string>;
|
|
5406
|
+
/**
|
|
5407
|
+
* Optional allowlist of product mixin paths to include in indexing for the `BATTERY_INCLUDED` provider. Patterns are matched against full dot-notation paths rooted at the mixin key, for example `class_EA673_toolsClassification.sk.OnlineIsService_P`.
|
|
5408
|
+
* `*` matches within a single path segment, `**` matches across one or more path segments, and matching is case sensitive.
|
|
5409
|
+
* If a matched path points to an object, the entire subtree under that object is included. When this field is absent or an empty list, path filtering is inactive and existing `excludedMixinKeys` behavior applies.
|
|
5410
|
+
* `includedMixinPaths` and `excludedMixinKeys` are mutually exclusive when `includedMixinPaths` is non-empty. Malformed glob patterns are rejected with a validation error on configuration writes.
|
|
5411
|
+
*/
|
|
5412
|
+
includedMixinPaths?: Array<string>;
|
|
5174
5413
|
};
|
|
5175
5414
|
type IndexCreationResponse = {
|
|
5176
5415
|
/**
|
|
@@ -7444,4 +7683,4 @@ declare function createEmporixClient<S extends Record<string, ServiceClass<unkno
|
|
|
7444
7683
|
*/
|
|
7445
7684
|
declare function productIdFromYrn(yrn: string | undefined): string;
|
|
7446
7685
|
|
|
7447
|
-
export { type AddedPoints, type AdminCustomer, type AdminCustomerAddress, type AdminCustomerAddressInput, type AdminCustomerAddressList, type AdminCustomerAddressUpdate, type AdminCustomerCreated, type AdminCustomerInput, type AdminCustomerList, type AdminCustomerPatch, type AdminCustomerSearchQuery, type AdminCustomerUpdate, type Agent, type AgentInput, type AgentPatchOp, type AgentSearchQuery, AiService, type Approval, type ApprovalCreated, type ApprovalInput, type ApprovalList, type ApprovalPatch, type ApprovalPermittedInput, type ApprovalPermittedResult, ApprovalService, type ApprovalUsersQuery, type ApprovalUsersResult, type Assignee, AuthContext, AvailabilityService, type BatchNextIdEntry, type Brand, type BrandInput, type BrandList, BrandService, type BrandUpdate, CartService, type Catalog, type CatalogCreated, type CatalogInput, type CatalogList, type CatalogPatch, CatalogService, type CatalogUpdate, CategoryService, type CgRelation, type CgRelationList, type ChatRequest, type ChatResponse, CheckoutService, ClientConfigService, type ClientConfiguration, ClientContext, CloudFunctionsService, CompaniesService, type CompletionMessage, type CompletionRequest, type CompletionResponse, type Configuration$1 as Configuration, type ConfigurationDraft, ContactsService, type ConversionFactorInput, type ConversionFactorResult, type ConvertUnitInput, type ConvertUnitResult, type Country, type CountryList, CountryService, type CountryUpdate, type Coupon$1 as Coupon, type CouponCreated, type CouponInput, type CouponList, CouponService, type CouponUpdate, type Currency, type CurrencyCreated, type CurrencyInput, type CurrencyList, CurrencyService, type CurrencyUpdate, type CustomEntity, type CustomEntityDraft, type CustomInstance, type CustomInstanceDraft, CustomerAdminService, CustomerGroupsService, CustomerService, type CustomerSummaryBatch, CustomerTokenRefresher, type DeleteAgentOptions, type DeleteConfigOptions, type DeliveryCreated, type DeliveryCycleInput, type DeliverySlot, type DeliverySlotList, type DeliveryTime$1 as DeliveryTime, type DeliveryTimeInput, type DeliveryTimeList, type DeliveryTimeUpdate, type DeliveryWindow$2 as DeliveryWindow, type DeliveryWindowList, type DeliveryWindowValidation, EmporixAuthError, EmporixClient, EmporixConfig, type EmporixCore, EmporixError, EmporixForbiddenError, EmporixInsufficientScopeError, EmporixNetworkError, EmporixNotFoundError, EmporixServerError, EmporixTimeoutError, EmporixValidationError, type ExchangeRate, type ExchangeRateCreated, type ExchangeRateInput, type ExchangeRateList, type ExchangeRateUpdate, type Fee$1 as Fee, type FeeDraft, FeeService, type FindSiteInput, type IndexConfig, type IndexConfigCreated, type IndexPublicConfig, IndexingService, type InstanceSearchBody, type InvokeCloudFunctionOptions, type ItemFee, type ItemFeeDraft, type ItemFeeSearch, type JobIdResponse, type Label, type LabelInput, type LabelList, LabelService, type LabelUpdate, type ListConfigOptions, type ListCustomEntitiesOptions, type ListFeesQuery, type ListInstancesQuery, type ListReindexJobsOptions, type ListSchemasQuery, LocationsService, LogLevel, MediaService, type MetadataFilter, type MinimumFee, type NewPointsEntry, type NextIdCommandRequest, type NextIdOptions, type NextIdResponse, type NextIdsBatchRequest, type NextIdsBatchResponse, type OrderCycleList, type OrderEntryEventCreate, type OrderStatusChange, OrdersService, type PackagingProductsChange, type PackingEvent, type PackingEventList, PaginatedItems, PaymentGatewayService, type PickOrder, type PickOrderList, type PickPackAck, PickPackService, type PointsSummary, PriceService, ProductService, QueryFor, type QuoteInput, type QuoteResult, type QuoteSlotInput, RagIndexerService, type RagType, type RecalculationJob, type RecalculationJobCreated, type RecalculationJobInput, type RedeemCouponResult, type RedeemMyPointsInput, type RedeemOption, type RedeemOptionList, type RedeemedPoints, type Redemption, type RedemptionCreated, type RedemptionInput, type ReferralCoupon, type Region, type RegionList, type ReindexEntityType, type ReindexInput, type ReindexJob, type ReindexJobInput, type ReindexJobStatus, ResolvedConfig, type ResourceCreated, type Return, type ReturnCreated, type ReturnInput, type ReturnList, type ReturnPatch, type ReturnUpdate, ReturnsService, RewardPointsService, SalesOrdersService, type Schema, type SchemaAttribute, type SchemaDraft, SchemaService, type SchemaTypeName, type SchemaUpdate, SegmentService, SepaExportService, type SepaJob, type SepaJobCreated, type SepaJobInput, type SequenceSchema, type SequenceSchemaCreate, SequentialIdService, type ServiceClass, ServiceName, type SessionContext, type SessionContextPatch, SessionContextService, type SetItemFeesOptions, type ShippingGroup, type ShippingGroupList, type ShippingMethod, type ShippingMethodList, type ShippingPatch, ShippingService, type ShoppingList, type ShoppingListDraft, type ShoppingListItem, ShoppingListService, type Site$1 as Site, type SiteList, SiteService, type TaxCalculationInput, type TaxCalculationRequest, type TaxCalculationResult, type TaxClass, type TaxConfig, type TaxConfigCreated, type TaxCreation as TaxConfigInput, type TaxUpdate as TaxConfigUpdate, type TaxLocation, TaxService, TenantConfigService, type TextRequest, type TextResponse, TokenProvider, type Unit, type UnitCreated, UnitHandlingService, type UnitInput, type UnitUpdate, type Vendor, type VendorCreated, type VendorInput, type VendorList, type VendorLocation, type VendorLocationInput, type VendorLocationList, type VendorLocationUpdate, type VendorSearchQuery, VendorService, type VendorUpdate, type WebhookConfig, type WebhookConfigCreated, type WebhookConfigDraft, type WebhookConfigPatch, type WebhookDashboardAccess, WebhookService, type WebhookStatistics, type WebhookStatisticsQuery, type WebhookSubscription, type WebhookSubscriptionUpdateItem, type WebhookSubscriptionUpdateResultItem, type Zone, type ZoneList, createCore, createEmporixClient, errorFromResponse, productIdFromYrn };
|
|
7686
|
+
export { type AddedPoints, type AdminCustomer, type AdminCustomerAddress, type AdminCustomerAddressInput, type AdminCustomerAddressList, type AdminCustomerAddressUpdate, type AdminCustomerCreated, type AdminCustomerInput, type AdminCustomerList, type AdminCustomerPatch, type AdminCustomerSearchQuery, type AdminCustomerUpdate, type Agent, type AgentInput, type AgentPatchOp, type AgentSearchQuery, AiService, type Approval, type ApprovalCreated, type ApprovalInput, type ApprovalList, type ApprovalPatch, type ApprovalPermittedInput, type ApprovalPermittedResult, ApprovalService, type ApprovalUsersQuery, type ApprovalUsersResult, type Assignee, AuthContext, AvailabilityService, type BatchNextIdEntry, type Brand, type BrandInput, type BrandList, BrandService, type BrandUpdate, type BulkInstanceResult, type BulkPatchInstanceItem, CartService, type Catalog, type CatalogCreated, type CatalogInput, type CatalogList, type CatalogPatch, CatalogService, type CatalogUpdate, CategoryService, type CgRelation, type CgRelationList, type ChatRequest, type ChatResponse, type ChatStreamOptions, CheckoutService, ClientConfigService, type ClientConfiguration, ClientContext, CloudFunctionsService, CompaniesService, type CompletionMessage, type CompletionRequest, type CompletionResponse, type Configuration$1 as Configuration, type ConfigurationDraft, ContactsService, type Conversation, type ConversationSearchQuery, type ConversionFactorInput, type ConversionFactorResult, type ConvertUnitInput, type ConvertUnitResult, type Country, type CountryList, CountryService, type CountryUpdate, type Coupon$1 as Coupon, type CouponCreated, type CouponInput, type CouponList, CouponService, type CouponUpdate, type Currency, type CurrencyCreated, type CurrencyInput, type CurrencyList, CurrencyService, type CurrencyUpdate, type CustomEntity, type CustomEntityDraft, type CustomInstance, type CustomInstanceDraft, CustomerAdminService, CustomerGroupsService, CustomerService, type CustomerSummaryBatch, CustomerTokenRefresher, type DeleteAgentOptions, type DeleteConfigOptions, type DeliveryCreated, type DeliveryCycleInput, type DeliverySlot, type DeliverySlotList, type DeliveryTime$1 as DeliveryTime, type DeliveryTimeInput, type DeliveryTimeList, type DeliveryTimeUpdate, type DeliveryWindow$2 as DeliveryWindow, type DeliveryWindowList, type DeliveryWindowValidation, EmporixAuthError, EmporixClient, EmporixConfig, type EmporixCore, EmporixError, EmporixForbiddenError, EmporixInsufficientScopeError, EmporixNetworkError, EmporixNotFoundError, EmporixServerError, EmporixTimeoutError, EmporixValidationError, type ExchangeRate, type ExchangeRateCreated, type ExchangeRateInput, type ExchangeRateList, type ExchangeRateUpdate, type Fee$1 as Fee, type FeeDraft, FeeService, type FindSiteInput, type IndexConfig, type IndexConfigCreated, type IndexPublicConfig, IndexingService, type InstanceSearchBody, type InvokeCloudFunctionOptions, type ItemFee, type ItemFeeDraft, type ItemFeeSearch, type JobIdResponse, type Label, type LabelInput, type LabelList, LabelService, type LabelUpdate, type ListConfigOptions, type ListCustomEntitiesOptions, type ListFeesQuery, type ListInstancesQuery, type ListReindexJobsOptions, type ListSchemasQuery, LocationsService, LogLevel, MediaService, type MetadataFilter, type MinimumFee, type NewPointsEntry, type NextIdCommandRequest, type NextIdOptions, type NextIdResponse, type NextIdsBatchRequest, type NextIdsBatchResponse, type OrderCycleList, type OrderEntryEventCreate, type OrderStatusChange, OrdersService, type PackagingProductsChange, type PackingEvent, type PackingEventList, PaginatedItems, PaymentGatewayService, type PickOrder, type PickOrderList, type PickPackAck, PickPackService, type PointsSummary, PriceService, ProductService, QueryFor, type QuoteInput, type QuoteResult, type QuoteSlotInput, RagIndexerService, type RagType, type RecalculationJob, type RecalculationJobCreated, type RecalculationJobInput, type RedeemCouponResult, type RedeemMyPointsInput, type RedeemOption, type RedeemOptionList, type RedeemedPoints, type Redemption, type RedemptionCreated, type RedemptionInput, type ReferralCoupon, type Region, type RegionList, type ReindexEntityType, type ReindexInput, type ReindexJob, type ReindexJobInput, type ReindexJobStatus, ResolvedConfig, type ResourceCreated, type Return, type ReturnCreated, type ReturnInput, type ReturnList, type ReturnPatch, type ReturnUpdate, ReturnsService, RewardPointsService, SalesOrdersService, type Schema, type SchemaAttribute, type SchemaDraft, SchemaService, type SchemaTypeName, type SchemaUpdate, SegmentService, SepaExportService, type SepaJob, type SepaJobCreated, type SepaJobInput, type SequenceSchema, type SequenceSchemaCreate, SequentialIdService, type ServiceClass, ServiceName, type SessionContext, type SessionContextPatch, SessionContextService, type SetItemFeesOptions, type ShippingGroup, type ShippingGroupList, type ShippingMethod, type ShippingMethodList, type ShippingPatch, ShippingService, type ShoppingList, type ShoppingListDraft, type ShoppingListItem, ShoppingListService, type Site$1 as Site, type SiteList, SiteService, type TaxCalculationInput, type TaxCalculationRequest, type TaxCalculationResult, type TaxClass, type TaxConfig, type TaxConfigCreated, type TaxCreation as TaxConfigInput, type TaxUpdate as TaxConfigUpdate, type TaxLocation, TaxService, TenantConfigService, type TextRequest, type TextResponse, TokenProvider, type Unit, type UnitCreated, UnitHandlingService, type UnitInput, type UnitUpdate, type Vendor, type VendorCreated, type VendorInput, type VendorList, type VendorLocation, type VendorLocationInput, type VendorLocationList, type VendorLocationUpdate, type VendorSearchQuery, VendorService, type VendorUpdate, type WebhookConfig, type WebhookConfigCreated, type WebhookConfigDraft, type WebhookConfigPatch, type WebhookDashboardAccess, WebhookService, type WebhookStatistics, type WebhookStatisticsQuery, type WebhookSubscription, type WebhookSubscriptionUpdateItem, type WebhookSubscriptionUpdateResultItem, type Zone, type ZoneList, createCore, createEmporixClient, errorFromResponse, productIdFromYrn };
|
package/dist/index.js
CHANGED
|
@@ -16,8 +16,8 @@ import { AvailabilityService } from './chunk-IVCCGJN5.js';
|
|
|
16
16
|
export { AvailabilityService } from './chunk-IVCCGJN5.js';
|
|
17
17
|
import { CartService } from './chunk-PAT4CS36.js';
|
|
18
18
|
export { CartService } from './chunk-PAT4CS36.js';
|
|
19
|
-
import { CategoryService } from './chunk-
|
|
20
|
-
export { CategoryService } from './chunk-
|
|
19
|
+
import { CategoryService } from './chunk-ZNLHLFQM.js';
|
|
20
|
+
export { CategoryService } from './chunk-ZNLHLFQM.js';
|
|
21
21
|
export { iterateAll } from './chunk-GWJ2U2CP.js';
|
|
22
22
|
import { resolveQuery } from './chunk-S5HEIQDK.js';
|
|
23
23
|
export { resolveQuery } from './chunk-S5HEIQDK.js';
|
|
@@ -296,6 +296,47 @@ function createNoopLogger() {
|
|
|
296
296
|
return new NoopLogger();
|
|
297
297
|
}
|
|
298
298
|
|
|
299
|
+
// src/core/sse.ts
|
|
300
|
+
function parseFrame(frame) {
|
|
301
|
+
const ev = { data: "" };
|
|
302
|
+
const dataLines = [];
|
|
303
|
+
let saw = false;
|
|
304
|
+
for (const line of frame.split("\n")) {
|
|
305
|
+
if (line === "" || line.startsWith(":")) continue;
|
|
306
|
+
const colon = line.indexOf(":");
|
|
307
|
+
const field = colon === -1 ? line : line.slice(0, colon);
|
|
308
|
+
let value = colon === -1 ? "" : line.slice(colon + 1);
|
|
309
|
+
if (value.startsWith(" ")) value = value.slice(1);
|
|
310
|
+
if (field === "data") {
|
|
311
|
+
dataLines.push(value);
|
|
312
|
+
saw = true;
|
|
313
|
+
} else if (field === "event") {
|
|
314
|
+
ev.event = value;
|
|
315
|
+
saw = true;
|
|
316
|
+
} else if (field === "id") {
|
|
317
|
+
ev.id = value;
|
|
318
|
+
saw = true;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (!saw) return void 0;
|
|
322
|
+
ev.data = dataLines.join("\n");
|
|
323
|
+
return ev;
|
|
324
|
+
}
|
|
325
|
+
async function* parseSseStream(chunks) {
|
|
326
|
+
let buf = "";
|
|
327
|
+
for await (const chunk of chunks) {
|
|
328
|
+
buf += chunk.replace(/\r\n/g, "\n");
|
|
329
|
+
let idx;
|
|
330
|
+
while ((idx = buf.indexOf("\n\n")) !== -1) {
|
|
331
|
+
const ev = parseFrame(buf.slice(0, idx));
|
|
332
|
+
buf = buf.slice(idx + 2);
|
|
333
|
+
if (ev) yield ev;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
const tail = parseFrame(buf);
|
|
337
|
+
if (tail) yield tail;
|
|
338
|
+
}
|
|
339
|
+
|
|
299
340
|
// src/core/http.ts
|
|
300
341
|
var requestSeq = 0;
|
|
301
342
|
function safeJson(text) {
|
|
@@ -485,10 +526,72 @@ var HttpClient = class {
|
|
|
485
526
|
clearTimeout(timer);
|
|
486
527
|
}
|
|
487
528
|
}
|
|
529
|
+
/**
|
|
530
|
+
* Open a Server-Sent Events stream (`text/event-stream`) and yield parsed
|
|
531
|
+
* events. Unlike {@link request}, no overall read budget applies (streams are
|
|
532
|
+
* long-lived) — only `connectMs` bounds time-to-headers, and the consumer
|
|
533
|
+
* breaking the iterator aborts the fetch. Like {@link requestRaw}, it does
|
|
534
|
+
* NOT retry or re-auth on 401; a non-2xx maps to a typed error before the
|
|
535
|
+
* stream begins.
|
|
536
|
+
*/
|
|
537
|
+
async *requestStream(o) {
|
|
538
|
+
const log = this.opts.logger.child({ requestId: `req-${++requestSeq}` });
|
|
539
|
+
const url = new URL(this.opts.host + o.path);
|
|
540
|
+
for (const [k, v] of Object.entries(o.query ?? {})) {
|
|
541
|
+
if (v !== void 0) url.searchParams.set(k, String(v));
|
|
542
|
+
}
|
|
543
|
+
const token = await resolveToken(o.auth, this.opts.provider);
|
|
544
|
+
const controller = new AbortController();
|
|
545
|
+
const connectTimer = setTimeout(() => controller.abort(), this.opts.timeouts.connectMs);
|
|
546
|
+
const headers = this.buildHeaders(o, token, false);
|
|
547
|
+
headers["Accept"] = "text/event-stream";
|
|
548
|
+
let res;
|
|
549
|
+
try {
|
|
550
|
+
res = await fetch(url, {
|
|
551
|
+
method: o.method,
|
|
552
|
+
headers,
|
|
553
|
+
signal: controller.signal,
|
|
554
|
+
...o.body !== void 0 ? { body: JSON.stringify(o.body) } : {}
|
|
555
|
+
});
|
|
556
|
+
} catch (err) {
|
|
557
|
+
clearTimeout(connectTimer);
|
|
558
|
+
if (err.name === "AbortError") {
|
|
559
|
+
throw new EmporixTimeoutError(`${o.method} ${o.path} timed out opening stream`);
|
|
560
|
+
}
|
|
561
|
+
throw new EmporixNetworkError(
|
|
562
|
+
`${o.method} ${o.path} network failure: ${err.message}`
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
clearTimeout(connectTimer);
|
|
566
|
+
if (!res.ok) {
|
|
567
|
+
const text = await res.text().catch(() => "");
|
|
568
|
+
throw errorFromResponse(
|
|
569
|
+
res.status,
|
|
570
|
+
`${o.method} ${o.path} \u2192 ${res.status}`,
|
|
571
|
+
text ? safeJson(text) : void 0
|
|
572
|
+
);
|
|
573
|
+
}
|
|
574
|
+
log.debug("http stream open", { status: res.status });
|
|
575
|
+
if (!res.body) return;
|
|
576
|
+
const reader = res.body.getReader();
|
|
577
|
+
const decoder = new TextDecoder();
|
|
578
|
+
async function* readChunks() {
|
|
579
|
+
try {
|
|
580
|
+
for (; ; ) {
|
|
581
|
+
const { done, value } = await reader.read();
|
|
582
|
+
if (done) break;
|
|
583
|
+
yield decoder.decode(value, { stream: true });
|
|
584
|
+
}
|
|
585
|
+
} finally {
|
|
586
|
+
controller.abort();
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
yield* parseSseStream(readChunks());
|
|
590
|
+
}
|
|
488
591
|
};
|
|
489
592
|
|
|
490
593
|
// package.json
|
|
491
|
-
var version = "2.
|
|
594
|
+
var version = "2.20.1";
|
|
492
595
|
|
|
493
596
|
// src/version.ts
|
|
494
597
|
var SDK_VERSION = version;
|
|
@@ -1507,6 +1610,20 @@ var SchemaService = class {
|
|
|
1507
1610
|
body: patch
|
|
1508
1611
|
});
|
|
1509
1612
|
}
|
|
1613
|
+
/**
|
|
1614
|
+
* Patch up to 200 custom instances of `type` in one call
|
|
1615
|
+
* (`PATCH /custom-entities/{type}/instances/bulk`). Returns a 207 envelope:
|
|
1616
|
+
* a per-item result array — a 207 is success, individual failures live in
|
|
1617
|
+
* each item's `code`/`status`.
|
|
1618
|
+
*/
|
|
1619
|
+
async bulkPatchInstances(type, items, auth2 = SERVICE7) {
|
|
1620
|
+
return this.ctx.http.request({
|
|
1621
|
+
method: "PATCH",
|
|
1622
|
+
path: `${this.instancesBase(type)}/bulk`,
|
|
1623
|
+
auth: auth2,
|
|
1624
|
+
body: items
|
|
1625
|
+
});
|
|
1626
|
+
}
|
|
1510
1627
|
/** Delete an instance by id. */
|
|
1511
1628
|
async deleteInstance(type, id, auth2 = SERVICE7) {
|
|
1512
1629
|
await this.ctx.http.request({
|
|
@@ -1642,6 +1759,39 @@ var AiService = class {
|
|
|
1642
1759
|
body: input
|
|
1643
1760
|
});
|
|
1644
1761
|
}
|
|
1762
|
+
/**
|
|
1763
|
+
* Streaming agent chat (`POST /agentic/chat-stream`, `text/event-stream`).
|
|
1764
|
+
* Yields each SSE `data` payload verbatim — the upstream contract types the
|
|
1765
|
+
* stream body as an opaque string, so chunks are raw strings, not parsed
|
|
1766
|
+
* objects. Consume with `for await`.
|
|
1767
|
+
*/
|
|
1768
|
+
async *chatStream(input, opts = {}, auth2 = SERVICE8) {
|
|
1769
|
+
const events = this.ctx.http.requestStream({
|
|
1770
|
+
method: "POST",
|
|
1771
|
+
path: `${this.base()}/agentic/chat-stream`,
|
|
1772
|
+
auth: auth2,
|
|
1773
|
+
body: input,
|
|
1774
|
+
...opts.sessionId ? { headers: { "session-id": opts.sessionId } } : {}
|
|
1775
|
+
});
|
|
1776
|
+
for await (const ev of events) yield ev.data;
|
|
1777
|
+
}
|
|
1778
|
+
/** List stored agentic conversations (`GET /agentic/conversations`). */
|
|
1779
|
+
async listConversations(auth2 = SERVICE8) {
|
|
1780
|
+
return this.ctx.http.request({
|
|
1781
|
+
method: "GET",
|
|
1782
|
+
path: `${this.base()}/agentic/conversations`,
|
|
1783
|
+
auth: auth2
|
|
1784
|
+
});
|
|
1785
|
+
}
|
|
1786
|
+
/** Server-side conversation search (`POST /agentic/conversations/search`). */
|
|
1787
|
+
async searchConversations(query, auth2 = SERVICE8) {
|
|
1788
|
+
return this.ctx.http.request({
|
|
1789
|
+
method: "POST",
|
|
1790
|
+
path: `${this.base()}/agentic/conversations/search`,
|
|
1791
|
+
auth: auth2,
|
|
1792
|
+
body: query
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1645
1795
|
};
|
|
1646
1796
|
|
|
1647
1797
|
// src/services/tax.ts
|