@viu/emporix-sdk 2.1.0 → 2.3.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/dist/availability.d.cts +1 -1
  3. package/dist/availability.d.ts +1 -1
  4. package/dist/cart.d.cts +1 -1
  5. package/dist/cart.d.ts +1 -1
  6. package/dist/category.d.cts +1 -1
  7. package/dist/category.d.ts +1 -1
  8. package/dist/checkout.d.cts +1 -1
  9. package/dist/checkout.d.ts +1 -1
  10. package/dist/{chunk-JTJV7WUW.js → chunk-5JHTZBOC.js} +42 -2
  11. package/dist/chunk-5JHTZBOC.js.map +1 -0
  12. package/dist/companies.d.cts +1 -1
  13. package/dist/companies.d.ts +1 -1
  14. package/dist/contacts.d.cts +1 -1
  15. package/dist/contacts.d.ts +1 -1
  16. package/dist/{context-CGuxSb56.d.cts → context-CQFcPZnt.d.cts} +1 -1
  17. package/dist/{context-CGuxSb56.d.ts → context-CQFcPZnt.d.ts} +1 -1
  18. package/dist/customer-groups.d.cts +1 -1
  19. package/dist/customer-groups.d.ts +1 -1
  20. package/dist/customer.d.cts +1 -1
  21. package/dist/customer.d.ts +1 -1
  22. package/dist/index.cjs +1028 -6
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +2014 -3
  25. package/dist/index.d.ts +2014 -3
  26. package/dist/index.js +983 -10
  27. package/dist/index.js.map +1 -1
  28. package/dist/locations.d.cts +1 -1
  29. package/dist/locations.d.ts +1 -1
  30. package/dist/media.d.cts +1 -1
  31. package/dist/media.d.ts +1 -1
  32. package/dist/orders.d.cts +1 -1
  33. package/dist/orders.d.ts +1 -1
  34. package/dist/payment.d.cts +1 -1
  35. package/dist/payment.d.ts +1 -1
  36. package/dist/price.d.cts +1 -1
  37. package/dist/price.d.ts +1 -1
  38. package/dist/product.cjs +40 -0
  39. package/dist/product.cjs.map +1 -1
  40. package/dist/product.d.cts +14 -1
  41. package/dist/product.d.ts +14 -1
  42. package/dist/product.js +1 -1
  43. package/dist/segment.d.cts +1 -1
  44. package/dist/segment.d.ts +1 -1
  45. package/package.json +1 -1
  46. package/dist/chunk-JTJV7WUW.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ClientContext, b as AuthContext, T as TokenProvider, l as ResolvedConfig, E as EmporixConfig, h as LogLevel, m as ServiceName } from './context-CGuxSb56.cjs';
2
- export { A as AnonymousSession, a as AnonymousSessionStore, c as AuthKind, D as DEFAULT_HOST, d as DefaultTokenProvider, H as HttpClient, e as HttpClientOptions, L as LEVEL, f as LevelResolver, g as LogFields, i as Logger, j as LoggerConfig, k as LoggerObjectConfig, P as PaginatedItems, R as RequestOptions, S as ServiceCredentials, n as StorefrontCredentials, o as auth, p as createConsoleLogger, q as createNoopLogger, r as iterateAll, s as redact, t as resolveToken, v as validateConfig } from './context-CGuxSb56.cjs';
1
+ import { C as ClientContext, b as AuthContext, P as PaginatedItems, T as TokenProvider, l as ResolvedConfig, E as EmporixConfig, h as LogLevel, m as ServiceName } from './context-CQFcPZnt.cjs';
2
+ export { A as AnonymousSession, a as AnonymousSessionStore, c as AuthKind, D as DEFAULT_HOST, d as DefaultTokenProvider, H as HttpClient, e as HttpClientOptions, L as LEVEL, f as LevelResolver, g as LogFields, i as Logger, j as LoggerConfig, k as LoggerObjectConfig, R as RequestOptions, S as ServiceCredentials, n as StorefrontCredentials, o as auth, p as createConsoleLogger, q as createNoopLogger, r as iterateAll, s as redact, t as resolveToken, v as validateConfig } from './context-CQFcPZnt.cjs';
3
3
  import { CustomerService } from './customer.cjs';
4
4
  export { Address, AddressCreateInput, AddressUpdateInput, Customer, CustomerSession, CustomerSignupInput, CustomerUpdateInput, PasswordChangeInput, PasswordResetConfirmInput, PasswordResetRequestInput } from './customer.cjs';
5
5
  import { ProductService } from './product.cjs';
@@ -172,6 +172,2008 @@ declare class SessionContextService {
172
172
  patch(input: SessionContextPatch, authCtx?: AuthContext): Promise<boolean>;
173
173
  }
174
174
 
175
+ type BaseConfiguration = {
176
+ /**
177
+ * Configuration key.
178
+ */
179
+ key: string;
180
+ /**
181
+ * Configuration value. It can be any valid JSON object.
182
+ */
183
+ value: {
184
+ [key: string]: unknown;
185
+ } | string | Array<{
186
+ [key: string]: unknown;
187
+ }> | boolean;
188
+ /**
189
+ * Configuration version.
190
+ */
191
+ version?: number;
192
+ /**
193
+ * Describes purpose of the configuration.
194
+ */
195
+ description?: string;
196
+ /**
197
+ * Flag indicating whether the configuration should be encrypted. It works only if `value` field is of `string` type.
198
+ */
199
+ secured?: boolean;
200
+ /**
201
+ * Flag indicating whether the configuration should be restricted. When configuration is rectricted then it cannot be deleted. When this property is set to `true` then it cannot be unset.
202
+ */
203
+ restricted?: boolean;
204
+ /**
205
+ * Flag indicating whether the configuration should be readOnly. When configuration is readOnly then it cannot be updated.
206
+ */
207
+ readOnly?: boolean;
208
+ /**
209
+ * URL of Json Schema for validation purpose. When configuration is created this value can be provided and then each update operation will be validated against this schema. This property cannot be updated so once set it cannot be unset. The Json Schema should contain one root property named `value` in order to work correctly. An example of a valid schema: `{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": ["value"], "properties": { "value": { "type": "boolean" } } }`
210
+ */
211
+ schemaUrl?: string;
212
+ };
213
+
214
+ /**
215
+ * A tenant configuration entry. The wire `value` is "any JSON"; the SDK
216
+ * lets callers pin it with a generic (defaults to `unknown`). All other
217
+ * fields mirror the upstream `BaseConfiguration` schema.
218
+ */
219
+ type Configuration$1<T = unknown> = Omit<BaseConfiguration, "value"> & {
220
+ value: T;
221
+ };
222
+ /** A per-client configuration entry; adds the server-assigned `_id` and `client`. */
223
+ type ClientConfiguration<T = unknown> = Configuration$1<T> & {
224
+ _id: string;
225
+ client: string;
226
+ };
227
+ /** Input for create/update. Omits server-managed fields (`version`, `_id`). */
228
+ interface ConfigurationDraft<T = unknown> {
229
+ key: string;
230
+ value: T;
231
+ description?: string;
232
+ /** Encrypts a string `value` at rest. */
233
+ secured?: boolean;
234
+ /** When true, the entry cannot be deleted. Cannot be unset once true. */
235
+ restricted?: boolean;
236
+ /** When true, the entry cannot be updated. */
237
+ readOnly?: boolean;
238
+ /** URL of a JSON Schema used to validate `value`. Immutable once set. */
239
+ schemaUrl?: string;
240
+ }
241
+ /** Options for the list endpoints. `keys` is serialized to a CSV query param. */
242
+ interface ListConfigOptions {
243
+ keys?: string[];
244
+ }
245
+
246
+ /**
247
+ * Tenant-wide configuration (`/configuration/{tenant}/configurations`).
248
+ * Requires the backend-only `configuration.configuration_view` /
249
+ * `configuration.configuration_manage` scopes — default auth: service.
250
+ * Server-side use only; the service token must never reach a browser.
251
+ */
252
+ declare class TenantConfigService {
253
+ private readonly ctx;
254
+ constructor(ctx: ClientContext);
255
+ private base;
256
+ /** List tenant configurations, optionally filtered by `keys`. */
257
+ list(opts?: ListConfigOptions, auth?: AuthContext): Promise<Configuration$1[]>;
258
+ /** Retrieve one tenant configuration by key. */
259
+ get<T = unknown>(key: string, auth?: AuthContext): Promise<Configuration$1<T>>;
260
+ /** Create one or more tenant configurations (array in, array out). */
261
+ create(drafts: ConfigurationDraft[], auth?: AuthContext): Promise<Configuration$1[]>;
262
+ /** Update one tenant configuration by key. */
263
+ update<T = unknown>(key: string, draft: ConfigurationDraft<T>, auth?: AuthContext): Promise<Configuration$1<T>>;
264
+ /** Delete one tenant configuration by key. */
265
+ delete(key: string, auth?: AuthContext): Promise<void>;
266
+ }
267
+
268
+ /**
269
+ * Per-client configuration (`/configuration/{tenant}/clients/{client}/configurations`).
270
+ * Requires the backend-only `configuration.configuration_view` /
271
+ * `configuration.configuration_manage` scopes — default auth: service.
272
+ * Server-side use only; the service token must never reach a browser.
273
+ * The `client` arg is injected into each write body so callers don't repeat it.
274
+ */
275
+ declare class ClientConfigService {
276
+ private readonly ctx;
277
+ constructor(ctx: ClientContext);
278
+ private base;
279
+ /** List a client's configurations, optionally filtered by `keys`. */
280
+ list(client: string, opts?: ListConfigOptions, auth?: AuthContext): Promise<ClientConfiguration[]>;
281
+ /** Retrieve one client configuration by key. */
282
+ get<T = unknown>(client: string, key: string, auth?: AuthContext): Promise<ClientConfiguration<T>>;
283
+ /** Create one or more client configurations. Injects `client` into each item. */
284
+ create(client: string, drafts: ConfigurationDraft[], auth?: AuthContext): Promise<ClientConfiguration[]>;
285
+ /** Update one client configuration by key. Injects `client` into the body. */
286
+ update<T = unknown>(client: string, key: string, draft: ConfigurationDraft<T>, auth?: AuthContext): Promise<ClientConfiguration<T>>;
287
+ /** Delete one client configuration by key. */
288
+ delete(client: string, key: string, auth?: AuthContext): Promise<void>;
289
+ }
290
+
291
+ /** A single shopping-list line item. */
292
+ interface ShoppingListItem {
293
+ id?: number;
294
+ productId: string;
295
+ quantity: number;
296
+ cuttingOption?: string;
297
+ servicePackagingOption?: string;
298
+ comment?: string;
299
+ mixins?: Record<string, unknown>;
300
+ }
301
+ /** A shopping list, normalized from the per-customer wire envelope. */
302
+ interface ShoppingList {
303
+ key: string;
304
+ name: string;
305
+ items: ShoppingListItem[];
306
+ mixins?: Record<string, unknown>;
307
+ metadata?: Record<string, unknown>;
308
+ }
309
+ /** Input for create / replace. */
310
+ interface ShoppingListDraft {
311
+ name: string;
312
+ items?: ShoppingListItem[];
313
+ mixins?: Record<string, unknown>;
314
+ }
315
+ /**
316
+ * Per-customer shopping lists (`/shoppinglist/{tenant}/shopping-lists`).
317
+ * `auth` is required: a customer token manages the caller's own lists;
318
+ * a service token (employee scope) can act on any `customerId`. The Emporix
319
+ * API has no item-level CRUD, so `addItem`/`removeItem`/`setItemQuantity`
320
+ * read the list and `PUT` the full body — **last-write-wins**.
321
+ */
322
+ declare class ShoppingListService {
323
+ private readonly ctx;
324
+ constructor(ctx: ClientContext);
325
+ private base;
326
+ /** The caller's lists (or, with employee scope, all), normalized to an array. */
327
+ list(auth: AuthContext, opts?: {
328
+ name?: string;
329
+ }): Promise<ShoppingList[]>;
330
+ /** Create a list; returns the new list id. */
331
+ create(draft: ShoppingListDraft, auth: AuthContext): Promise<{
332
+ id: string;
333
+ }>;
334
+ /** Replace the named list (low-level PUT). */
335
+ replace(customerId: string, draft: ShoppingListDraft, auth: AuthContext): Promise<void>;
336
+ /** Delete the named list, or all the customer's lists when `name` is omitted. */
337
+ delete(customerId: string, auth: AuthContext, opts?: {
338
+ name?: string;
339
+ }): Promise<void>;
340
+ private loadList;
341
+ private put;
342
+ /** Add/replace an item by `productId` (read-modify-write, last-write-wins). */
343
+ addItem(customerId: string, listName: string, item: ShoppingListItem, auth: AuthContext): Promise<void>;
344
+ /** Remove an item by `productId` (no-op if absent). */
345
+ removeItem(customerId: string, listName: string, productId: string, auth: AuthContext): Promise<void>;
346
+ /** Set an item's quantity; `quantity <= 0` removes it. Adds the item if absent. */
347
+ setItemQuantity(customerId: string, listName: string, productId: string, quantity: number, auth: AuthContext): Promise<void>;
348
+ }
349
+
350
+ type MetadataFilter$1 = {
351
+ /**
352
+ * Unique identifier of the fields. It contains full field path.
353
+ */
354
+ key?: string;
355
+ /**
356
+ * Name of the field.
357
+ * @deprecated
358
+ */
359
+ name?: string;
360
+ /**
361
+ * Description of the field.
362
+ * @deprecated
363
+ */
364
+ description?: string;
365
+ /**
366
+ * Type of the field.
367
+ */
368
+ type?: 'string' | 'integer' | 'float' | 'boolean' | 'datetime' | 'date' | 'time' | 'dictionary' | 'list' | 'object';
369
+ };
370
+
371
+ /**
372
+ * A filterable metadata field exposed by the RAG index. `key` is the field
373
+ * name and `type` its scalar/structured kind. `name` and `description` are
374
+ * **deprecated** upstream — present for wire compatibility, do not rely on them.
375
+ */
376
+ type MetadataFilter = MetadataFilter$1;
377
+ /**
378
+ * Indexable resource type. Only `"PRODUCT"` exists today; modelled as a string
379
+ * union so future types can extend it without a breaking change. Every
380
+ * {@link RagIndexerService} method defaults its `type` argument to `"PRODUCT"`.
381
+ */
382
+ type RagType = "PRODUCT";
383
+
384
+ /**
385
+ * AI RAG Indexer (`/ai-rag-indexer/{tenant}/{type}`). Read which fields the RAG
386
+ * index embeds / can filter on, and trigger a full asynchronous rebuild.
387
+ *
388
+ * Requires the backend-only `ai.agent_read` (reads) / `ai.agent_manage`
389
+ * (`reindex`) scopes — default auth: service. **Server-side use only**; the
390
+ * service token must never reach a browser.
391
+ *
392
+ * Quirks: only `PRODUCT` exists today (the `type` arg defaults to it);
393
+ * `reindex` is a **full** rebuild (no delta), runs **asynchronously**, returns
394
+ * `204` once *scheduled* (not on completion), has **no status endpoint** to
395
+ * poll, and is costly — call it sparingly. The set of embedded fields is
396
+ * configured in the AI Service, not here.
397
+ */
398
+ declare class RagIndexerService {
399
+ private readonly ctx;
400
+ constructor(ctx: ClientContext);
401
+ private base;
402
+ /** The indexable embedding field names for `type` (default `"PRODUCT"`). */
403
+ ragMetadata(type?: RagType, auth?: AuthContext): Promise<string[]>;
404
+ /** The filterable metadata fields for `type` (default `"PRODUCT"`). */
405
+ filterMetadata(type?: RagType, auth?: AuthContext): Promise<MetadataFilter[]>;
406
+ /**
407
+ * Schedule a full asynchronous re-index for `type` (default `"PRODUCT"`).
408
+ * Resolves once the rebuild is *scheduled* (HTTP 204); there is no progress
409
+ * to await or poll. Costly — avoid calling on a hot path.
410
+ */
411
+ reindex(type?: RagType, auth?: AuthContext): Promise<void>;
412
+ }
413
+
414
+ type SequenceSchema$1 = SequenceSchemaCreate$1 & {
415
+ /**
416
+ * Flag indicating whether the schema is active.
417
+ */
418
+ active?: boolean;
419
+ /**
420
+ * ID of the sequence schema.
421
+ */
422
+ id?: string;
423
+ /**
424
+ * Number of created IDs based on the selected schema.
425
+ */
426
+ counter?: number;
427
+ metadata?: {
428
+ /**
429
+ * Date of creation.
430
+ */
431
+ createdAt?: string;
432
+ /**
433
+ * Date of last modification.
434
+ */
435
+ modifiedAt?: string;
436
+ /**
437
+ * The version number.
438
+ */
439
+ version?: number;
440
+ };
441
+ };
442
+ /**
443
+ * The filler text for values based on certain properties or settings in the system.
444
+ */
445
+ type Placeholders = {
446
+ [key: string]: {
447
+ required?: boolean;
448
+ default?: string;
449
+ };
450
+ };
451
+ type SequenceSchemaCreate$1 = {
452
+ /**
453
+ * The name of the sequence schema.
454
+ */
455
+ name: string;
456
+ /**
457
+ * The schema type corresponding to the entity it is used for. Possible values are:
458
+ * - `orderNoSequence`
459
+ * - `invoiceNoSequence`
460
+ * - `quoteNoSequence`
461
+ * - `pickPackNoSequence`
462
+ * - `orderHoldingAreaNoSequence`
463
+ *
464
+ */
465
+ schemaType?: string;
466
+ /**
467
+ * The prefix of the ID. It can contain placeholders, which are replaced with their values.
468
+ * Placeholders are defined in the `placeholders` property.
469
+ *
470
+ */
471
+ preText?: string;
472
+ /**
473
+ * The suffix of the ID. It can contain placeholders, which are replaced with their values.
474
+ * Placeholders are defined in the `placeholders` property.
475
+ *
476
+ */
477
+ postText?: string;
478
+ /**
479
+ * The starting value of the sequence. It is used to generate the first ID.
480
+ * The starting value is incremented for each subsequent ID.
481
+ *
482
+ */
483
+ startValue: number;
484
+ /**
485
+ * The maximum value of the sequence. It is used to limit the range of generated IDs.
486
+ * If the maximum value is reached, the sequence will not generate any more IDs.
487
+ *
488
+ */
489
+ maxValue: number;
490
+ /**
491
+ * The number of digits in the generated ID. It is used to format the ID.
492
+ * If the number of digits is less than the maximum value, leading zeros are added.
493
+ *
494
+ */
495
+ numberOfDigits: number;
496
+ placeholders?: Placeholders;
497
+ };
498
+ type NextIdCommandRequest$1 = {
499
+ /**
500
+ * The pattern to follow for the nextID.
501
+ */
502
+ sequenceKey?: string;
503
+ /**
504
+ * The filler text for values based on certain properties or settings in the system.
505
+ */
506
+ placeholders?: unknown;
507
+ };
508
+
509
+ /**
510
+ * A sequence schema as returned by the service — a counter template plus the
511
+ * server-managed `id`, `active` flag, `counter`, and `metadata`.
512
+ */
513
+ type SequenceSchema = SequenceSchema$1;
514
+ /**
515
+ * Body for {@link SequentialIdService.createSchema}. Schemas are immutable
516
+ * (no PATCH/PUT upstream) — to change one, delete it and create a new one.
517
+ */
518
+ type SequenceSchemaCreate = SequenceSchemaCreate$1;
519
+ /**
520
+ * Body for a single next-id request: optional sub-pool key + placeholder values.
521
+ * The generated spec widens `placeholders` to `unknown`; the SDK types it as the
522
+ * documented `key → value` string map.
523
+ */
524
+ type NextIdCommandRequest = Omit<NextIdCommandRequest$1, "placeholders"> & {
525
+ placeholders?: Record<string, string>;
526
+ };
527
+ /** The generated id returned by `nextId` (always present on a successful call). */
528
+ interface NextIdResponse {
529
+ id: string;
530
+ }
531
+ /** Per-call options for {@link SequentialIdService.nextId}. */
532
+ interface NextIdOptions {
533
+ /**
534
+ * A site code. When set, the service derives time/country placeholders from
535
+ * that site's settings. Serialized to the `?siteCode=` query param.
536
+ */
537
+ siteCode?: string;
538
+ }
539
+ /** One entry in a batch next-ids request, keyed by schema type. */
540
+ interface BatchNextIdEntry {
541
+ /** How many ids to allocate for this schema type. */
542
+ numberOfIds: number;
543
+ /** Optional independent sub-pool counter key. */
544
+ sequenceKey?: string;
545
+ /** Placeholder values substituted into the generated ids. */
546
+ placeholders?: Record<string, string>;
547
+ }
548
+ /** Batch next-ids request: a map of `schemaType` → allocation request. */
549
+ type NextIdsBatchRequest = Record<string, BatchNextIdEntry>;
550
+ /** Batch next-ids response: a map of `schemaType` → the generated ids. */
551
+ type NextIdsBatchResponse = Record<string, {
552
+ ids: string[];
553
+ }>;
554
+
555
+ /**
556
+ * Sequential ID Service (`/sequential-id/{tenant}/…`): server-managed,
557
+ * gap-free sequential identifiers (order/invoice numbers, etc.) driven by
558
+ * tenant-defined sequence schemas.
559
+ *
560
+ * Requires the backend-only `sequentialid.schema_view` (read + next-id) /
561
+ * `sequentialid.schema_manage` (CRUD + set-active) scopes — default auth:
562
+ * service. Server-side use only; the service token must never reach a browser.
563
+ *
564
+ * Schemas are immutable upstream (no PATCH/PUT): to change one, `deleteSchema`
565
+ * then `createSchema`. The `maxValue` is a hard cap with no auto-reset, and
566
+ * only one schema may be active per type.
567
+ */
568
+ declare class SequentialIdService {
569
+ private readonly ctx;
570
+ constructor(ctx: ClientContext);
571
+ private base;
572
+ /** List all sequence schemas for the tenant. */
573
+ listSchemas(auth?: AuthContext): Promise<SequenceSchema[]>;
574
+ /** Retrieve one sequence schema by id. */
575
+ getSchema(schemaId: string, auth?: AuthContext): Promise<SequenceSchema>;
576
+ /** Create a sequence schema. Schemas are immutable — there is no update. */
577
+ createSchema(schema: SequenceSchemaCreate, auth?: AuthContext): Promise<SequenceSchema>;
578
+ /** Delete a sequence schema by id. */
579
+ deleteSchema(schemaId: string, auth?: AuthContext): Promise<void>;
580
+ /** Mark a schema active for its type (only one schema may be active per type). */
581
+ setActiveSchema(schemaId: string, auth?: AuthContext): Promise<void>;
582
+ /** Get the active schema for a given schema type. */
583
+ listSchemasByType(schemaType: string, auth?: AuthContext): Promise<SequenceSchema>;
584
+ /**
585
+ * Generate the next id for a schema type. `body` carries an optional
586
+ * `sequenceKey` (independent sub-pool counter) and `placeholders`.
587
+ * `opts.siteCode` derives time/country placeholders from the site's settings.
588
+ */
589
+ nextId(schemaType: string, body?: NextIdCommandRequest, opts?: NextIdOptions, auth?: AuthContext): Promise<NextIdResponse>;
590
+ /**
591
+ * Generate next ids for multiple schema types in one call. NOTE: the batch
592
+ * endpoint path omits the `{tenant}` segment — the service derives the
593
+ * tenant from the token.
594
+ */
595
+ nextIdsBatch(req: NextIdsBatchRequest, auth?: AuthContext): Promise<NextIdsBatchResponse>;
596
+ }
597
+
598
+ /**
599
+ * The localized value in the form of map (language, value) or string.
600
+ */
601
+ type Localized$1 = string | {
602
+ [key: string]: string;
603
+ };
604
+ type Fee$1 = {
605
+ /**
606
+ * Unique identifier of the fee.
607
+ */
608
+ id?: string;
609
+ name: Localized$1;
610
+ description?: Localized$1;
611
+ /**
612
+ * The code-name, unique for the tenant.
613
+ */
614
+ code: string;
615
+ /**
616
+ * 'PERCENT' for relative values, 'ABSOLUTE' for float values or 'ABSOLUTE_MULTIPLY_ITEMQUANTITY' for float values to be multiplied by the quantity of the item.
617
+ */
618
+ feeType: 'PERCENT' | 'ABSOLUTE' | 'ABSOLUTE_MULTIPLY_ITEMQUANTITY';
619
+ /**
620
+ * The fee rate in percentage. Required if feeType is 'PERCENT'.
621
+ */
622
+ feePercentage?: number;
623
+ feeAbsolute?: MonetaryAmount;
624
+ /**
625
+ * The itemtype the fee can belong to. It could be a product or
626
+ * paymenttype.
627
+ */
628
+ itemType?: 'PRODUCT' | 'PAYMENTTYPE';
629
+ /**
630
+ * The SiteCode the fee belongs to.
631
+ */
632
+ siteCode: string;
633
+ /**
634
+ * Flag indicating whether the fee is currently active or not.
635
+ */
636
+ active: boolean;
637
+ /**
638
+ * Flag indicating whether the fee is taxable or not.
639
+ */
640
+ taxable?: boolean;
641
+ /**
642
+ * The tax code. When 'taxable' is set to true, the taxCode is mandatory
643
+ */
644
+ taxCode?: string;
645
+ activeTimespan?: Timespan;
646
+ yrn?: Yrn;
647
+ };
648
+ /**
649
+ * Schema defining monetary amount in given currency.
650
+ */
651
+ type MonetaryAmount = {
652
+ /**
653
+ * The amount in the specified currency
654
+ */
655
+ amount: number;
656
+ /**
657
+ * ISO 4217 currency code, e.g.: USD, EUR, CHF
658
+ */
659
+ currency: string;
660
+ };
661
+ /**
662
+ * Restricts the active fees to be only applied in the specified
663
+ * timespan.
664
+ */
665
+ type Timespan = {
666
+ startDate: string;
667
+ endDate: string;
668
+ };
669
+ type ItemFee$1 = {
670
+ /**
671
+ * Unique identifier of the item fee.
672
+ */
673
+ id?: string;
674
+ /**
675
+ * The SiteCode this fee belongs to.
676
+ */
677
+ siteCode: string;
678
+ /**
679
+ * YRN of the item to assign fees to.
680
+ */
681
+ itemYrn: string;
682
+ /**
683
+ * List of unique identifiers of fees to assign to the item.
684
+ */
685
+ feeIds: Array<string>;
686
+ };
687
+ /**
688
+ * A unique identifier of a global resource, which stores information about the resource, such as its type, ID or name of the tenant.
689
+ */
690
+ type Yrn = string;
691
+
692
+ /** A fee definition as returned by the API (`id`/`yrn` server-assigned). */
693
+ type Fee = Fee$1;
694
+ /** An item-fee (or product-fee) mapping as returned by the API. */
695
+ type ItemFee = ItemFee$1;
696
+ /**
697
+ * Body for create/update of a fee definition — {@link Fee} minus the
698
+ * server-assigned `id`/`yrn`. (The upstream spec reuses the `Fee` schema as the
699
+ * request body; the SDK exposes this narrower draft type.)
700
+ */
701
+ type FeeDraft = Omit<Fee, "id" | "yrn">;
702
+ /** Body for `POST /itemFees` — {@link ItemFee} minus the server `id`. */
703
+ type ItemFeeDraft = Omit<ItemFee, "id">;
704
+ /** Body of `POST /itemFees/search`. */
705
+ interface ItemFeeSearch {
706
+ itemYrns: string[];
707
+ siteCode: string;
708
+ }
709
+ /**
710
+ * Query for the paginated `GET /fees` list. Explicit fields are typed for
711
+ * autocomplete; the index signature stays open so Emporix `q`-syntax filters
712
+ * pass through verbatim (mirrors `ListAssetsQuery` in `media`).
713
+ */
714
+ interface ListFeesQuery {
715
+ pageNumber?: number;
716
+ pageSize?: number;
717
+ /** Emporix sort syntax, e.g. `"code:asc"`. */
718
+ sort?: string;
719
+ /** Emporix `q`-syntax filter, e.g. `"siteCode:main"`. */
720
+ q?: string;
721
+ [key: string]: string | number | undefined;
722
+ }
723
+ /** Options for {@link FeeService.setItemFees} / {@link FeeService.setProductFees}. */
724
+ interface SetItemFeesOptions {
725
+ /** When true, merges instead of replacing (serialized to `?partial=true`). */
726
+ partial?: boolean;
727
+ }
728
+
729
+ /**
730
+ * Emporix Fee Service (`/fee/{tenant}/…`): fee definitions plus the
731
+ * item/product mappings that attach them. Writes require a backend-only scope
732
+ * (`fee.fee_*` / `fee.item_*`); GETs need a token but no scope. Default auth:
733
+ * service. Server-side use only — the service token must never reach a browser.
734
+ *
735
+ * Quirks (server behavior, not handled here): a payment-type fee's `code` must
736
+ * equal the payment-mode code or the fee is silently ignored; a wrong/missing
737
+ * `siteCode` filters to an empty array rather than erroring; an expired
738
+ * `activeTimespan` silently disables the fee; `setItemFees`/`setProductFees`
739
+ * replace the whole mapping unless `partial` is set.
740
+ */
741
+ declare class FeeService {
742
+ private readonly ctx;
743
+ constructor(ctx: ClientContext);
744
+ private feesBase;
745
+ private itemFeesBase;
746
+ private productFeesBase;
747
+ /**
748
+ * List fee definitions, wrapped in the shared {@link PaginatedItems}
749
+ * envelope (same heuristic as `media.list`: `hasNextPage` is true when the
750
+ * returned page is full). Defaults match Emporix server defaults
751
+ * (`pageNumber: 1`, `pageSize: 60`).
752
+ */
753
+ list(query?: ListFeesQuery, auth?: AuthContext): Promise<PaginatedItems<Fee>>;
754
+ /** Retrieve one fee definition by id. */
755
+ get(id: string, auth?: AuthContext): Promise<Fee>;
756
+ /** Create a fee definition. */
757
+ create(draft: FeeDraft, auth?: AuthContext): Promise<Fee>;
758
+ /** Update a fee definition by id. */
759
+ update(id: string, draft: FeeDraft, auth?: AuthContext): Promise<Fee>;
760
+ /** Delete a fee definition by id. */
761
+ delete(id: string, auth?: AuthContext): Promise<void>;
762
+ /** List all item-fee mappings. */
763
+ listItemFees(auth?: AuthContext): Promise<ItemFee[]>;
764
+ /** Fee mappings for one item YRN. */
765
+ getItemFees(itemYrn: string, auth?: AuthContext): Promise<ItemFee[]>;
766
+ /** Create an item-fee mapping. */
767
+ createItemFee(draft: ItemFeeDraft, auth?: AuthContext): Promise<ItemFee>;
768
+ /**
769
+ * Set the fee list for an item YRN. Destructive replace by default; pass
770
+ * `{ partial: true }` to merge (`?partial=true`).
771
+ */
772
+ setItemFees(itemYrn: string, feeIds: string[], opts?: SetItemFeesOptions, auth?: AuthContext): Promise<ItemFee>;
773
+ /**
774
+ * Delete item-fee mappings for a YRN. Without `feeId`, removes all mappings
775
+ * for the YRN; with `feeId`, removes that single fee from the mapping.
776
+ */
777
+ deleteItemFees(itemYrn: string, feeId?: string, auth?: AuthContext): Promise<void>;
778
+ /** Search item-fee mappings by item YRNs + site. */
779
+ searchItemFees(search: ItemFeeSearch, auth?: AuthContext): Promise<ItemFee[]>;
780
+ /** Fee mappings for a product id. */
781
+ getProductFees(productId: string, auth?: AuthContext): Promise<ItemFee[]>;
782
+ /**
783
+ * Set the fee list for a product id. Destructive replace by default; pass
784
+ * `{ partial: true }` to merge (`?partial=true`).
785
+ */
786
+ setProductFees(productId: string, feeIds: string[], opts?: SetItemFeesOptions, auth?: AuthContext): Promise<ItemFee>;
787
+ /** Delete all fee mappings for a product id. */
788
+ deleteProductFees(productId: string, auth?: AuthContext): Promise<void>;
789
+ }
790
+
791
+ type AbstractWebhookConfig = {
792
+ /**
793
+ * Indicates whether a given configuration is active. Only one configuration can be active.
794
+ */
795
+ active?: boolean;
796
+ provider?: Provider;
797
+ };
798
+ /**
799
+ * SVIX_SHARED config
800
+ */
801
+ type EmptyConfiguration = {
802
+ [key: string]: unknown;
803
+ };
804
+ /**
805
+ * SVIX config
806
+ */
807
+ type SvixConfig = {
808
+ /**
809
+ * API Key for connecting to SVIX. This API Key will be then used in `Authorization` header while sending requests to SVIX, so the value should include `Bearer` prefix if necessary.
810
+ */
811
+ apiKey?: string;
812
+ };
813
+ type EventConfiguration = {
814
+ /**
815
+ * Unique identifier of the event.
816
+ */
817
+ eventType?: string;
818
+ /**
819
+ * Optional secret key which could be used to sign the message. This secret is used in `HMAC SHA 256` algorithm which encrypts the payload. Then this value is encoded to `BASE256` and included in `emporix-event-signature` header of HTTP request. It has higher priority than `secretKey` on root level. Each event can have defined a separated secret key.
820
+ */
821
+ secretKey?: string;
822
+ /**
823
+ * Destination URL where event should be sent. It has higher priority than `destinationUrl` on root level. Each event can have defined a separated destination url.
824
+ */
825
+ destinationUrl?: string;
826
+ /**
827
+ * List of key-value pairs which can decorate outgoing HTTP POST request as headers. The size limit for this list is `10`. It has higher priority than `headers` on root level. Each event can have defined a separated headers.
828
+ */
829
+ headers?: HttpHeadersConfig;
830
+ };
831
+ type EventsConfiguration = Array<EventConfiguration>;
832
+ type HttpHeaderConfigValue = {
833
+ value?: string;
834
+ };
835
+ type HttpHeadersConfig = {
836
+ [key: string]: HttpHeaderConfigValue;
837
+ };
838
+ /**
839
+ * HTTP config
840
+ */
841
+ type HttpConfig = {
842
+ /**
843
+ * Optional secret key which could be used to sign the message. This secret is used in `HMAC SHA 256` algorithm which encrypts the payload. Then this value is encoded to `BASE256` and included in `emporix-event-signature` header of HTTP request.
844
+ */
845
+ secretKey?: string;
846
+ /**
847
+ * Destination URL where event should be sent.
848
+ */
849
+ destinationUrl?: string;
850
+ /**
851
+ * List of key-value pairs which can decorate outgoing HTTP POST request as headers. The size limit for this list is `10`.
852
+ */
853
+ headers?: HttpHeadersConfig;
854
+ eventsConfiguration?: EventConfiguration;
855
+ };
856
+ type Configuration = EmptyConfiguration | SvixConfig | HttpConfig;
857
+ type WebhookConfigPartialUpdate = {
858
+ /**
859
+ * Kind of the update operation
860
+ */
861
+ op: 'REMOVE' | 'UPSERT';
862
+ /**
863
+ * Path for identyifing which properties should be updated
864
+ */
865
+ path: '/active' | '/configuration' | '/configuration/svix/apiKey' | '/configuration/http/headers' | '/configuration/http/destinationUrl' | '/configuration/http/secretKey' | '/configuration/http/eventsConfiguration' | '/configuration/http/eventsConfiguration/{eventType}' | '/configuration/http/eventsConfiguration/{eventType}/destinationUrl' | '/configuration/http/eventsConfiguration/{eventType}/secretKey' | '/configuration/http/eventsConfiguration/{eventType}/headers';
866
+ value?: SvixConfig | HttpConfig | string | boolean | EventsConfiguration | EventConfiguration;
867
+ };
868
+ type ConfigurationGet = {
869
+ /**
870
+ * Destination URL where event should be sent.
871
+ */
872
+ destinationUrl?: string;
873
+ /**
874
+ * Information if secret key for securing the messages has been provided.
875
+ */
876
+ secretKeyExists?: boolean;
877
+ /**
878
+ * List of key-value pairs which can decorate outgoing HTTP POST request as headers.
879
+ */
880
+ headers?: HttpHeadersConfig;
881
+ eventsConfiguration?: Array<{
882
+ /**
883
+ * Type of the event.
884
+ */
885
+ eventType?: string;
886
+ /**
887
+ * Destination URL where event should be sent.
888
+ */
889
+ destinationUrl?: string;
890
+ /**
891
+ * Information if secret key for securing the messages has been provided.
892
+ */
893
+ secretKeyExists?: boolean;
894
+ /**
895
+ * List of key-value pairs which can decorate outgoing HTTP POST request as headers.
896
+ */
897
+ headers?: HttpHeadersConfig;
898
+ }>;
899
+ };
900
+ /**
901
+ * Unique identifier of webhook configuration.
902
+ */
903
+ type ConfigCode = string;
904
+ type Provider = 'SVIX_SHARED' | 'SVIX' | 'HTTP';
905
+ type WebhookConfigUpdate = AbstractWebhookConfig & {
906
+ configuration?: Configuration;
907
+ };
908
+ type WebhookConfigCreation = WebhookConfigUpdate & {
909
+ code: ConfigCode;
910
+ };
911
+ /**
912
+ * Events that you can subscribe to.
913
+ */
914
+ type WebhookEvent = {
915
+ /**
916
+ * Unique identifier of the event.
917
+ */
918
+ type?: string;
919
+ /**
920
+ * Map of key-value pairs containing localized descriptions of the event, which includes information on when the event is emitted.
921
+ */
922
+ description?: {
923
+ [key: string]: string;
924
+ };
925
+ /**
926
+ * Schema of the event.
927
+ */
928
+ eventSchema?: {
929
+ [key: string]: unknown;
930
+ };
931
+ /**
932
+ * Map of key-value pairs containing localized names of the event.
933
+ */
934
+ name?: {
935
+ [key: string]: string;
936
+ };
937
+ /**
938
+ * Map of key-value pairs containing the localized name of a group the event belongs to.
939
+ */
940
+ group?: {
941
+ [key: string]: string;
942
+ };
943
+ };
944
+ /**
945
+ * Subscription per event.
946
+ */
947
+ type WebhookSubscription$1 = {
948
+ event?: WebhookEvent;
949
+ metadata?: Metadata;
950
+ /**
951
+ * Status of the subscription.
952
+ */
953
+ subscription?: 'SUBSCRIBED' | 'UNSUBSCRIBED' | 'NONE';
954
+ /**
955
+ * If `subscription` is of type `SUBSCRIBED`, `excludedFields` will contain the list of keys from the "event.eventSchema" that the user has previously unsubscribed from. Note: Only root level fields are supported.
956
+ */
957
+ excludedFields?: Array<string>;
958
+ };
959
+ /**
960
+ * Object used to subscribe to/unsubscribe from an event.
961
+ */
962
+ type WebhookSubscriptionUpdateItem$1 = {
963
+ /**
964
+ * Unique identifier of the event.
965
+ */
966
+ eventType: string;
967
+ /**
968
+ * Indicates whether the event should be subscribed to or unsubscribed from.
969
+ */
970
+ action?: 'SUBSCRIBE' | 'UNSUBSCRIBE';
971
+ metadata?: MetadataForUpdate;
972
+ /**
973
+ * Fields to exclude from notification.
974
+ */
975
+ fieldsToUnsubscribe?: Array<string>;
976
+ /**
977
+ * Fields to re-include in the notification. To be used when user wants to subscribe to previously unsubscribed fields.
978
+ */
979
+ fieldsToSubscribe?: Array<string>;
980
+ };
981
+ /**
982
+ * Auditing details.
983
+ */
984
+ type Metadata = {
985
+ /**
986
+ * Date and time when the document was created.
987
+ */
988
+ createdAt?: string;
989
+ /**
990
+ * Date and time when the document was last modified.
991
+ */
992
+ modifiedAt?: string;
993
+ /**
994
+ * Version of the document.
995
+ */
996
+ version?: number;
997
+ };
998
+ /**
999
+ * Auditing details.
1000
+ */
1001
+ type MetadataForUpdate = {
1002
+ /**
1003
+ * Version of the document.
1004
+ */
1005
+ version?: number;
1006
+ };
1007
+ /**
1008
+ * Object containing the result of event subscription.
1009
+ */
1010
+ type UpdateSubscriptionResponse = {
1011
+ eventType?: string;
1012
+ code?: number;
1013
+ status?: string;
1014
+ message?: string;
1015
+ };
1016
+ type DashboardAccess = {
1017
+ /**
1018
+ * Svix application dashboard access URL with embedded authentication.
1019
+ */
1020
+ url?: string;
1021
+ /**
1022
+ * Authentication token for accessing the Svix application dashboard.
1023
+ */
1024
+ token?: string;
1025
+ };
1026
+ type MonthStatistics = {
1027
+ /**
1028
+ * Month for which statistics should be retrieved, provided in the "YYYY-MM" format.
1029
+ */
1030
+ statisticsMonth?: string;
1031
+ /**
1032
+ * Number of events sent successfully to the customer's configured endpoints.
1033
+ */
1034
+ succesfullySentWebhooks?: number;
1035
+ };
1036
+ type WebhookStatistics$1 = {
1037
+ monthStatistics?: Array<MonthStatistics>;
1038
+ /**
1039
+ * Maximum number of events that the tenant is allowed to send in a specified month.
1040
+ */
1041
+ webhooksLimit?: number;
1042
+ };
1043
+
1044
+ /** A webhook event subscription (read model): the event metadata + on/off state. */
1045
+ type WebhookSubscription = WebhookSubscription$1;
1046
+ /** One item of the batch `PATCH /event-subscriptions` body. `eventType` is required. */
1047
+ type WebhookSubscriptionUpdateItem = WebhookSubscriptionUpdateItem$1;
1048
+ /**
1049
+ * One element of the **207** result returned by `updateEventSubscriptions`.
1050
+ * `code`/`status` reflect per-item success/failure — the batch can partially fail.
1051
+ */
1052
+ type WebhookSubscriptionUpdateResultItem = UpdateSubscriptionResponse;
1053
+ /**
1054
+ * A webhook delivery configuration as returned by `getConfig`/`listConfigs`:
1055
+ * `active`/`provider` plus the server-assigned `code` and read-only
1056
+ * `configuration` (the `secretKey` is never returned — only `secretKeyExists`).
1057
+ */
1058
+ type WebhookConfig = AbstractWebhookConfig & {
1059
+ code?: ConfigCode;
1060
+ configuration?: ConfigurationGet;
1061
+ };
1062
+ /** Body for `createConfig` / `replaceConfig` (carries `code`; `secretKey` is write-only). */
1063
+ type WebhookConfigDraft = WebhookConfigCreation;
1064
+ /**
1065
+ * One operation of the `patchConfig` body. The PATCH endpoint takes an **array**
1066
+ * of these `{ op, path, value }` operations (UPSERT / REMOVE).
1067
+ */
1068
+ type WebhookConfigPatch = WebhookConfigPartialUpdate;
1069
+ /** Response of `createConfig`. */
1070
+ interface WebhookConfigCreated {
1071
+ code: string;
1072
+ }
1073
+ /** Webhook delivery statistics (SVIX_SHARED-oriented). */
1074
+ type WebhookStatistics = WebhookStatistics$1;
1075
+ /** Svix dashboard access (URL / token) returned by `getDashboardAccess`. */
1076
+ type WebhookDashboardAccess = DashboardAccess;
1077
+ /** Query for `getStatistics`. Both bounds are `YYYY-MM`; omitted when absent. */
1078
+ interface WebhookStatisticsQuery {
1079
+ fromYearMonth?: string;
1080
+ toYearMonth?: string;
1081
+ }
1082
+ /** Options for `deleteConfig`. */
1083
+ interface DeleteConfigOptions {
1084
+ /** Required to delete the currently-active config. Serialized as `?force=true`. */
1085
+ force?: boolean;
1086
+ }
1087
+
1088
+ /**
1089
+ * Webhook administration (`/webhook/{tenant}/…`): the event-subscription
1090
+ * catalog and batch toggle, delivery-config CRUD, statistics, and Svix
1091
+ * dashboard access. Requires the backend-only `webhook.subscription_read` /
1092
+ * `webhook.subscription_manage` scopes — default auth: service. Server-side
1093
+ * use only; the service token must never reach a browser.
1094
+ */
1095
+ declare class WebhookService {
1096
+ private readonly ctx;
1097
+ constructor(ctx: ClientContext);
1098
+ private base;
1099
+ /** List the event-subscription catalog with each event's on/off state. */
1100
+ listEventSubscriptions(auth?: AuthContext): Promise<WebhookSubscription[]>;
1101
+ /**
1102
+ * Batch subscribe/unsubscribe events. Returns the **207** per-item result
1103
+ * array verbatim — the batch can partially fail, so inspect each element's
1104
+ * `code`/`status` (e.g. `results.filter(r => (r.code ?? 0) >= 400)`). Does
1105
+ * NOT throw on a 207 with failed items; only a non-2xx HTTP status throws.
1106
+ */
1107
+ updateEventSubscriptions(items: WebhookSubscriptionUpdateItem[], auth?: AuthContext): Promise<WebhookSubscriptionUpdateResultItem[]>;
1108
+ /** List delivery configurations. */
1109
+ listConfigs(auth?: AuthContext): Promise<WebhookConfig[]>;
1110
+ /** Retrieve one delivery configuration by code. */
1111
+ getConfig(code: string, auth?: AuthContext): Promise<WebhookConfig>;
1112
+ /** Create a delivery configuration. Returns the server-assigned `{ code }`. */
1113
+ createConfig(draft: WebhookConfigDraft, auth?: AuthContext): Promise<WebhookConfigCreated>;
1114
+ /** Replace a delivery configuration by code (204). */
1115
+ replaceConfig(code: string, draft: WebhookConfigDraft, auth?: AuthContext): Promise<void>;
1116
+ /**
1117
+ * Partially update a delivery configuration by code (204). The body is an
1118
+ * **array** of `{ op, path, value }` operations (UPSERT / REMOVE).
1119
+ */
1120
+ patchConfig(code: string, patches: WebhookConfigPatch[], auth?: AuthContext): Promise<void>;
1121
+ /**
1122
+ * Delete a delivery configuration by code. Pass `{ force: true }` to delete
1123
+ * the currently-active config (the server otherwise rejects it).
1124
+ */
1125
+ deleteConfig(code: string, opts?: DeleteConfigOptions, auth?: AuthContext): Promise<void>;
1126
+ /** Read delivery statistics over an optional `YYYY-MM` range. */
1127
+ getStatistics(query?: WebhookStatisticsQuery, auth?: AuthContext): Promise<WebhookStatistics>;
1128
+ /** Obtain Svix dashboard access (URL / token). */
1129
+ getDashboardAccess(auth?: AuthContext): Promise<WebhookDashboardAccess>;
1130
+ }
1131
+
1132
+ /**
1133
+ * Type which the schema should be assigned to. Can be one of the predefined values or any custom schema type id.
1134
+ */
1135
+ type SchemaType = 'CART' | 'CART_ITEM' | 'CATEGORY' | 'COMPANY' | 'COUPON' | 'CUSTOMER' | 'CUSTOMER_ADDRESS' | 'ORDER' | 'ORDER_ENTRY' | 'PRODUCT' | 'QUOTE' | 'RETURN' | 'PRICE_LIST' | 'SITE' | 'CUSTOM_ENTITY' | 'VENDOR';
1136
+ /**
1137
+ * Type of the attribute.
1138
+ *
1139
+ * **Note**: The `REFERENCE` type is only available for custom schema types.
1140
+ *
1141
+ */
1142
+ type SchemaAttributeType = 'TEXT' | 'NUMBER' | 'DECIMAL' | 'BOOLEAN' | 'DATE' | 'TIME' | 'DATE_TIME' | 'ENUM' | 'ARRAY' | 'OBJECT' | 'REFERENCE';
1143
+ /**
1144
+ * Whether the attribute is localized or not. Only attributes of 'TEXT' type can be localized.
1145
+ */
1146
+ type Localized = boolean;
1147
+ /**
1148
+ * Metadata of the schema attribute.
1149
+ */
1150
+ type SchemaAttributeMetadata = {
1151
+ /**
1152
+ * Whether the attribute is read-only or not.
1153
+ */
1154
+ readOnly?: boolean;
1155
+ localized?: Localized;
1156
+ /**
1157
+ * Whether the attribute is required or not. Attributes of 'BOOLEAN' type cannot be required.
1158
+ */
1159
+ required?: boolean;
1160
+ /**
1161
+ * Whether the attribute could accept null or not.
1162
+ */
1163
+ nullable?: boolean;
1164
+ };
1165
+ /**
1166
+ * Value of the attribute. Valid for `ENUM` and `REFERENCE` types.
1167
+ *
1168
+ * For `ENUM` type, the value represents one of the allowed enum values.
1169
+ *
1170
+ * For `REFERENCE` type, the value represents the reference type (e.g., `PRODUCT`, `ORDER`, `ORDER_ENTRY`, `CART`, `CART_ITEM`, `PRICE`, `CUSTOMER`, `COMPANY`, `MEDIA`, `PRICE_LIST`, `CUSTOMER_SEGMENT`, `CATEGORY`, or any custom schema type).
1171
+ *
1172
+ */
1173
+ type SchemaAttributeValue = {
1174
+ value: string;
1175
+ };
1176
+ /**
1177
+ * Schema attribute.
1178
+ */
1179
+ type SchemaAttribute$1 = {
1180
+ /**
1181
+ * Unique key of the attribute.
1182
+ */
1183
+ key: string;
1184
+ /**
1185
+ * Localized schema name in a form of a map of translations.
1186
+ */
1187
+ name: {
1188
+ [key: string]: unknown;
1189
+ };
1190
+ /**
1191
+ * Localized schema description in a form of a map of translations.
1192
+ */
1193
+ description?: {
1194
+ [key: string]: unknown;
1195
+ };
1196
+ type: SchemaAttributeType;
1197
+ metadata: SchemaAttributeMetadata;
1198
+ /**
1199
+ * List of available values for the attribute. Only valid for `ENUM` and `REFERENCE` type.
1200
+ */
1201
+ values?: Array<SchemaAttributeValue>;
1202
+ /**
1203
+ * Object's properties. It can only be provided for attribute of `OBJECT` type.
1204
+ */
1205
+ attributes?: Array<SchemaAttribute$1>;
1206
+ /**
1207
+ * Contains information about the type used inside an array. It can only be provided for attribute of `ARRAY` type.
1208
+ */
1209
+ arrayType?: {
1210
+ type: SchemaAttributeType;
1211
+ /**
1212
+ * List of available values for the attribute. Only valid for `ENUM` and `REFERENCE` type.
1213
+ */
1214
+ values?: Array<SchemaAttributeValue>;
1215
+ localized?: Localized;
1216
+ };
1217
+ };
1218
+ type SchemaMetadataUpdate = {
1219
+ /**
1220
+ * Version of the object. The value is required during update operation.
1221
+ */
1222
+ version?: number;
1223
+ };
1224
+ type SchemaMetadata = SchemaMetadataUpdate & {
1225
+ /**
1226
+ * Schema url of the attributes.
1227
+ */
1228
+ url?: string;
1229
+ /**
1230
+ * Date and time when the object was created, compliant with the ISO 8601 standard. For example: `2022-03-31T09:52:15.423Z`
1231
+ */
1232
+ createdAt?: string;
1233
+ /**
1234
+ * Date and time when the object was last modified, compliant with the ISO 8601 standard. For example: `2022-03-31T09:52:15.423Z`
1235
+ */
1236
+ modifiedAt?: string;
1237
+ };
1238
+ type AbstractSchemaResponse = {
1239
+ /**
1240
+ * Identifier of the schema.
1241
+ */
1242
+ id?: string;
1243
+ /**
1244
+ * Localized schema name in a form of a map of translations.
1245
+ */
1246
+ name?: {
1247
+ [key: string]: unknown;
1248
+ };
1249
+ /**
1250
+ * List of types to which schema should be assigned.
1251
+ */
1252
+ types?: Array<SchemaType>;
1253
+ metadata?: SchemaMetadata;
1254
+ };
1255
+ type SchemaResponse = AbstractSchemaResponse & {
1256
+ /**
1257
+ * List of attributes related to the schema.
1258
+ */
1259
+ attributes?: Array<SchemaAttribute$1>;
1260
+ };
1261
+ type CustomSchemaTypeResponse = {
1262
+ /**
1263
+ * Unique id of the custom schema type.
1264
+ */
1265
+ id?: string;
1266
+ /**
1267
+ * Localized custom type name in a form of a map of translations.
1268
+ */
1269
+ name?: {
1270
+ [key: string]: unknown;
1271
+ };
1272
+ /**
1273
+ * Information about associated schemas. This field is only included if `expandSchemas` is set to `true`
1274
+ */
1275
+ schemas?: {
1276
+ [key: string]: unknown;
1277
+ };
1278
+ metadata?: {
1279
+ /**
1280
+ * Date and time when the object was created, compliant with the ISO 8601 standard. For example: `2022-03-31T09:52:15.423Z`
1281
+ */
1282
+ createdAt?: string;
1283
+ /**
1284
+ * Date and time when the object was last modified, compliant with the ISO 8601 standard. For example: `2022-03-31T09:52:15.423Z`
1285
+ */
1286
+ modifiedAt?: string;
1287
+ version?: number;
1288
+ };
1289
+ };
1290
+ /**
1291
+ * Ownership of the custom instance. It can be assigned explicitly during creation by users with a `manage` scope, or populated automatically based on who created the custom instance. Once set, the owner is immutable and cannot be modified.
1292
+ *
1293
+ * The `legalEntityId` field is only present when `type` is `CUSTOMER`.
1294
+ *
1295
+ */
1296
+ type CustomInstanceOwner = {
1297
+ /**
1298
+ * Type of the owner.
1299
+ */
1300
+ type: 'EMPLOYEE' | 'CUSTOMER' | 'SERVICE';
1301
+ /**
1302
+ * Identifier of the employee, customer, or service principal associated with the owner.
1303
+ */
1304
+ userId: string;
1305
+ /**
1306
+ * Legal entity identifier. Only set when `type` is `CUSTOMER`.
1307
+ */
1308
+ legalEntityId?: string | null;
1309
+ };
1310
+ type CustomInstanceResponse = {
1311
+ /**
1312
+ * Unique identifier of the custom instance.
1313
+ */
1314
+ id?: string;
1315
+ /**
1316
+ * Localized custom type name in a form of a map of translations.
1317
+ */
1318
+ name?: {
1319
+ [key: string]: unknown;
1320
+ };
1321
+ /**
1322
+ * Custom schema type to which custom instance is related.
1323
+ */
1324
+ type?: string;
1325
+ owner?: CustomInstanceOwner;
1326
+ /**
1327
+ * A key-value map of additional attributes.
1328
+ */
1329
+ mixins?: string;
1330
+ /**
1331
+ * List of media IDs assigned to the custom instance.
1332
+ */
1333
+ media?: Array<string>;
1334
+ metadata?: CustomInstanceMetadata;
1335
+ };
1336
+ type CustomInstanceMetadata = {
1337
+ /**
1338
+ * Date and time when the object was created, compliant with the ISO 8601 standard. For example: `2022-03-31T09:52:15.423Z`
1339
+ */
1340
+ createdAt?: string;
1341
+ /**
1342
+ * Date and time when the object was last modified, compliant with the ISO 8601 standard. For example: `2022-03-31T09:52:15.423Z`
1343
+ */
1344
+ modifiedAt?: string;
1345
+ /**
1346
+ * Version of the custom instance.
1347
+ */
1348
+ version?: number;
1349
+ /**
1350
+ * A key-value map, where key is a mixin name and value is a link to the mixin schema.
1351
+ */
1352
+ mixins?: {
1353
+ [key: string]: unknown;
1354
+ };
1355
+ };
1356
+
1357
+ /** A schema definition (typed attributes attached to one or more entity types). */
1358
+ type Schema = SchemaResponse;
1359
+ /** A single typed attribute within a schema (recursive for `OBJECT`). */
1360
+ type SchemaAttribute = SchemaAttribute$1;
1361
+ /**
1362
+ * The set of native entity types a schema can attach to
1363
+ * (`PRODUCT`, `CART`, `ORDER`, `CUSTOM_ENTITY`, …).
1364
+ */
1365
+ type SchemaTypeName = SchemaType;
1366
+ /** A custom-entity definition (a tenant-defined resource type). */
1367
+ type CustomEntity = CustomSchemaTypeResponse;
1368
+ /**
1369
+ * A custom-entity data record. The wire `mixins` field is loosely typed
1370
+ * upstream; the SDK lets callers pin it with a generic (defaults to an open
1371
+ * record). All other fields mirror the upstream `CustomInstanceResponse`.
1372
+ */
1373
+ type CustomInstance<T = Record<string, unknown>> = Omit<CustomInstanceResponse, "mixins"> & {
1374
+ mixins: T;
1375
+ };
1376
+ /**
1377
+ * Input for creating a schema (server assigns `metadata.version`/`url`).
1378
+ * `name`, `types` and `attributes` are the caller-controlled fields.
1379
+ */
1380
+ interface SchemaDraft {
1381
+ name: Record<string, string>;
1382
+ types: SchemaTypeName[];
1383
+ attributes: SchemaAttribute[];
1384
+ }
1385
+ /**
1386
+ * Input for updating a schema. Identical to {@link SchemaDraft} but the
1387
+ * upstream API **requires** `metadata.version` for optimistic locking
1388
+ * (409 Conflict on a stale version).
1389
+ */
1390
+ interface SchemaUpdate extends SchemaDraft {
1391
+ metadata: {
1392
+ version: number;
1393
+ };
1394
+ }
1395
+ /** Input for creating/updating a custom-entity definition. */
1396
+ interface CustomEntityDraft {
1397
+ name: Record<string, string>;
1398
+ attributes: SchemaAttribute[];
1399
+ }
1400
+ /** Input for creating/replacing a custom instance. `mixins` carries the data. */
1401
+ interface CustomInstanceDraft<T = Record<string, unknown>> {
1402
+ name: Record<string, string>;
1403
+ mixins: T;
1404
+ }
1405
+ /** Filter / pagination options for {@link SchemaService.listSchemas}. */
1406
+ interface ListSchemasQuery {
1407
+ /** Emporix `q`-syntax filter (supports `compoundLogicalQuery`). */
1408
+ q?: string;
1409
+ /** Restrict to schemas attached to this entity type. */
1410
+ type?: SchemaTypeName;
1411
+ pageNumber?: number;
1412
+ pageSize?: number;
1413
+ }
1414
+ /**
1415
+ * Pagination options for {@link SchemaService.listInstances}. The index
1416
+ * signature stays open so additional Emporix query params pass through.
1417
+ */
1418
+ interface ListInstancesQuery {
1419
+ pageNumber?: number;
1420
+ pageSize?: number;
1421
+ [key: string]: string | number | undefined;
1422
+ }
1423
+ /** Options for {@link SchemaService.listCustomEntities}. */
1424
+ interface ListCustomEntitiesOptions {
1425
+ /** Inline each entity's schema body in the response. */
1426
+ expandSchemas?: boolean;
1427
+ }
1428
+ /** Structured search filter body for {@link SchemaService.searchInstances}. */
1429
+ type InstanceSearchBody = Record<string, unknown>;
1430
+
1431
+ /**
1432
+ * Schema Service (`/schema/{tenant}/…`): schemas, entity types, custom
1433
+ * entities and their instances. Requires the backend-only `schema.schema_*`
1434
+ * / `schema.custominstance_*` scopes — default auth: service. Server-side use
1435
+ * only; the service token must never reach a browser.
1436
+ */
1437
+ declare class SchemaService {
1438
+ private readonly ctx;
1439
+ constructor(ctx: ClientContext);
1440
+ private schemasBase;
1441
+ private entitiesBase;
1442
+ private instancesBase;
1443
+ /**
1444
+ * List schemas, wrapped in the shared {@link PaginatedItems} envelope.
1445
+ * `hasNextPage` is the standard SDK heuristic (`items.length === pageSize`).
1446
+ * Pagination defaults match the rest of the SDK (`pageNumber: 1`,
1447
+ * `pageSize: 60`).
1448
+ */
1449
+ listSchemas(query?: ListSchemasQuery, auth?: AuthContext): Promise<PaginatedItems<Schema>>;
1450
+ /** Retrieve one schema by id. */
1451
+ getSchema(id: string, auth?: AuthContext): Promise<Schema>;
1452
+ /** Create a schema. */
1453
+ createSchema(draft: SchemaDraft, auth?: AuthContext): Promise<Schema>;
1454
+ /**
1455
+ * Update a schema. The upstream API requires `draft.metadata.version`; a
1456
+ * stale version yields 409 Conflict (propagated as the standard conflict
1457
+ * error).
1458
+ */
1459
+ updateSchema(id: string, draft: SchemaUpdate, auth?: AuthContext): Promise<Schema>;
1460
+ /** Delete a schema by id. */
1461
+ deleteSchema(id: string, auth?: AuthContext): Promise<void>;
1462
+ /**
1463
+ * Validate a schema document without persisting it (`POST /schemas/file`).
1464
+ * Returns the server's validation result verbatim.
1465
+ */
1466
+ validateSchemaFile<R = unknown>(body: SchemaDraft, auth?: AuthContext): Promise<R>;
1467
+ /** List entity types that currently have at least one schema. */
1468
+ listTypes(auth?: AuthContext): Promise<SchemaTypeName[]>;
1469
+ /** Set the entity types a schema applies to (`PUT /schemas/{id}/types`). */
1470
+ setSchemaTypes(id: string, types: SchemaTypeName[], auth?: AuthContext): Promise<Schema>;
1471
+ /** List custom-entity definitions. `expandSchemas` inlines each schema body. */
1472
+ listCustomEntities(opts?: ListCustomEntitiesOptions, auth?: AuthContext): Promise<CustomEntity[]>;
1473
+ /** Retrieve one custom-entity definition by id. */
1474
+ getCustomEntity(id: string, auth?: AuthContext): Promise<CustomEntity>;
1475
+ /** Create a custom-entity definition. */
1476
+ createCustomEntity(draft: CustomEntityDraft, auth?: AuthContext): Promise<CustomEntity>;
1477
+ /** Update a custom-entity definition. */
1478
+ updateCustomEntity(id: string, draft: CustomEntityDraft, auth?: AuthContext): Promise<CustomEntity>;
1479
+ /**
1480
+ * Delete a custom-entity definition. The server rejects with 409 if
1481
+ * instances or schemas still reference it (propagated as the standard
1482
+ * conflict error).
1483
+ */
1484
+ deleteCustomEntity(id: string, auth?: AuthContext): Promise<void>;
1485
+ /**
1486
+ * List a custom entity's instances, wrapped in {@link PaginatedItems}.
1487
+ * `type` is the custom-entity type and is always the first argument.
1488
+ */
1489
+ listInstances<T = Record<string, unknown>>(type: string, query?: ListInstancesQuery, auth?: AuthContext): Promise<PaginatedItems<CustomInstance<T>>>;
1490
+ /** Retrieve one instance by id. */
1491
+ getInstance<T = Record<string, unknown>>(type: string, id: string, auth?: AuthContext): Promise<CustomInstance<T>>;
1492
+ /** Create an instance of a custom entity. */
1493
+ createInstance<T = Record<string, unknown>>(type: string, draft: CustomInstanceDraft<T>, auth?: AuthContext): Promise<CustomInstance<T>>;
1494
+ /** Replace an instance (full `PUT`). */
1495
+ replaceInstance<T = Record<string, unknown>>(type: string, id: string, draft: CustomInstanceDraft<T>, auth?: AuthContext): Promise<CustomInstance<T>>;
1496
+ /** Partially update an instance (`PATCH`). */
1497
+ patchInstance<T = Record<string, unknown>>(type: string, id: string, patch: Partial<CustomInstanceDraft<T>>, auth?: AuthContext): Promise<CustomInstance<T>>;
1498
+ /** Delete an instance by id. */
1499
+ deleteInstance(type: string, id: string, auth?: AuthContext): Promise<void>;
1500
+ /**
1501
+ * Structured search over a custom entity's instances
1502
+ * (`POST /instances/search`), wrapped in {@link PaginatedItems}.
1503
+ */
1504
+ searchInstances<T = Record<string, unknown>>(type: string, body: InstanceSearchBody, auth?: AuthContext): Promise<PaginatedItems<CustomInstance<T>>>;
1505
+ }
1506
+
1507
+ type AgenticRequest = {
1508
+ /**
1509
+ * Unique identifier of the agent.
1510
+ */
1511
+ agentId: string;
1512
+ /**
1513
+ * The user message to the agent.
1514
+ */
1515
+ message: string;
1516
+ };
1517
+ /**
1518
+ * Type of the agent handling the request.
1519
+ */
1520
+ type AgentType = 'support' | 'generic' | 'complaint' | 'anti_fraud';
1521
+ /**
1522
+ * Represents a request body for a text generation operation.
1523
+ */
1524
+ type TextGenerationRequest = {
1525
+ /**
1526
+ * Identifier of the request. The value is not mandatory - if provided, the ID is returned in the text generation response.
1527
+ */
1528
+ id?: string;
1529
+ /**
1530
+ * A prompt to AI engine. A desired text content is generated based on the prompt.
1531
+ */
1532
+ prompt: string;
1533
+ /**
1534
+ * Maximum number of tokens that should be used during text generation. If not provided, then 4097 is used.
1535
+ */
1536
+ maxTokens?: number;
1537
+ };
1538
+ type InnerTokenRequest = {
1539
+ /**
1540
+ * ID of the token.
1541
+ */
1542
+ id: string;
1543
+ };
1544
+ type InnerTokenResponse = {
1545
+ /**
1546
+ * ID of the token.
1547
+ */
1548
+ id?: string;
1549
+ };
1550
+ type ExpandedTokenResponse = InnerTokenResponse & {
1551
+ /**
1552
+ * Name of the token.
1553
+ */
1554
+ name?: string;
1555
+ metadata?: MetadataResponse;
1556
+ };
1557
+ /**
1558
+ * The full response representing token. If the `expand=token` is **not** used, then only `id` field is returned, otherwise all fields are returned.
1559
+ */
1560
+ type ExpandableTokenResponse = InnerTokenResponse | ExpandedTokenResponse;
1561
+ /**
1562
+ * Type of the native tool.
1563
+ */
1564
+ type NativeToolType = 'slack' | 'rag_custom' | 'rag_emporix';
1565
+ type BaseNativeTool = {
1566
+ type: NativeToolType;
1567
+ /**
1568
+ * Name of the tool.
1569
+ */
1570
+ name: string;
1571
+ /**
1572
+ * An indicator whether the tool is enabled.
1573
+ */
1574
+ enabled?: boolean;
1575
+ };
1576
+ type RagCustomEmbeddingNativeToolConfig = {
1577
+ /**
1578
+ * Name of the OpenAI LLM model which should be used to create embedding of user's input in order to perform search operation.
1579
+ */
1580
+ model: string;
1581
+ };
1582
+ type RagCustomEmbeddingNativeToolConfigResponse = RagCustomEmbeddingNativeToolConfig & {
1583
+ token?: ExpandableTokenResponse;
1584
+ };
1585
+ /**
1586
+ * Type of the database.
1587
+ */
1588
+ type RagCustomDatabaseType = 'qdrant';
1589
+ /**
1590
+ * Type of the entity which is stored in the given collection.
1591
+ */
1592
+ type RagEntityType = 'product';
1593
+ type RagCustomDatabaseNativeToolConfig = {
1594
+ /**
1595
+ * URL of the database.
1596
+ */
1597
+ url: string;
1598
+ type: RagCustomDatabaseType;
1599
+ entityType: RagEntityType;
1600
+ /**
1601
+ * Name of the database collection.
1602
+ */
1603
+ collectionName: string;
1604
+ };
1605
+ type RagCustomDatabaseNativeToolConfigResponse = RagCustomDatabaseNativeToolConfig & {
1606
+ token?: ExpandableTokenResponse;
1607
+ };
1608
+ type RagCustomNativeToolConfig = {
1609
+ /**
1610
+ * The prompt for an agent. It should define when and why this tool is to be called.
1611
+ */
1612
+ prompt: string;
1613
+ /**
1614
+ * The maximum number of results found in the Vector Database.
1615
+ */
1616
+ maxResults?: number;
1617
+ };
1618
+ type RagCustomNativeToolConfigResponse = RagCustomNativeToolConfig & {
1619
+ databaseConfig?: RagCustomDatabaseNativeToolConfigResponse;
1620
+ embeddingConfig?: RagCustomEmbeddingNativeToolConfigResponse;
1621
+ };
1622
+ type RagLlmProvider = 'emporix_openai' | 'openai' | 'self_hosted_ollama';
1623
+ type EmporixOpenAiRagEmporixEmbeddingNativeToolConfig = {
1624
+ /**
1625
+ * For this type, it should be set to 'emporix_openai'.
1626
+ */
1627
+ provider: RagLlmProvider;
1628
+ };
1629
+ type OpenAiRagEmporixEmbeddingNativeToolConfig = {
1630
+ /**
1631
+ * For this type, it should be set to 'emporix_openai'.
1632
+ */
1633
+ provider: RagLlmProvider;
1634
+ /**
1635
+ * OpenAI LLM model to be used for generating embeddings for indexed products and user's input query.
1636
+ */
1637
+ model: string;
1638
+ /**
1639
+ * Number of dimensions of embedding.
1640
+ */
1641
+ dimensions: number;
1642
+ };
1643
+ type OpenAiRagEmporixEmbeddingNativeToolConfigResponse = OpenAiRagEmporixEmbeddingNativeToolConfig & {
1644
+ token?: ExpandableTokenResponse;
1645
+ };
1646
+ type SelfHostedOllamaRagEmporixEmbeddingNativeToolConfig = {
1647
+ /**
1648
+ * For this type, it should be set to 'self_hosted_ollama'.
1649
+ */
1650
+ provider: RagLlmProvider;
1651
+ /**
1652
+ * Ollama LLM model to be used for generating embeddings for indexed products and user's input query.
1653
+ */
1654
+ model: string;
1655
+ /**
1656
+ * Number of dimensions of embedding.
1657
+ */
1658
+ dimensions: number;
1659
+ /**
1660
+ * Base URL where Ollama is hosted.
1661
+ */
1662
+ url: string;
1663
+ };
1664
+ type SelfHostedOllamaRagEmporixEmbeddingNativeToolConfigResponse = SelfHostedOllamaRagEmporixEmbeddingNativeToolConfig & {
1665
+ token?: ExpandableTokenResponse;
1666
+ };
1667
+ type RagEmporixNativeToolConfig = {
1668
+ /**
1669
+ * The prompt for an agent. It should define when and why this tool is to be called.
1670
+ */
1671
+ prompt: string;
1672
+ /**
1673
+ * Type of the entity which is stored in the given collection. Supported predefined types: [PRODUCT] and custom entity types.
1674
+ */
1675
+ entityType: string;
1676
+ /**
1677
+ * This field specifies the fields of the given entityType that are used for generating embeddings. The provided values are then concatenated and converted to embeddings.
1678
+ */
1679
+ indexedFields: Array<{
1680
+ /**
1681
+ * It can act as an alias for the field key. For example, if the 'name.en' key is provided then its alias could be 'English Name' and that value is used in embedding input.
1682
+ */
1683
+ name?: string;
1684
+ /**
1685
+ * Unique value representing the entityType key.
1686
+ */
1687
+ key: string;
1688
+ }>;
1689
+ /**
1690
+ * This field specifies the fields of the given entityType that are used for filtering the data before performing actual search.
1691
+ */
1692
+ filterFields: Array<{
1693
+ /**
1694
+ * It should contain the description of the field, so LLM is able to know when to use this field in order to filter the data. For enums, possible values should be specified here.
1695
+ */
1696
+ description?: string;
1697
+ /**
1698
+ * It can act as an alias for the field key.
1699
+ */
1700
+ name?: string;
1701
+ /**
1702
+ * Unique value representing the entityType key.
1703
+ */
1704
+ key: string;
1705
+ }>;
1706
+ };
1707
+ type RagEmporixNativeToolConfigResponse = RagEmporixNativeToolConfig & {
1708
+ embeddingConfig?: EmporixOpenAiRagEmporixEmbeddingNativeToolConfig | OpenAiRagEmporixEmbeddingNativeToolConfigResponse | SelfHostedOllamaRagEmporixEmbeddingNativeToolConfigResponse;
1709
+ };
1710
+ type SlackNativeToolConfigResponse = {
1711
+ /**
1712
+ * Unique identifier of the Slack workspace (team) associated with the request. Used to distinguish the source Slack environment when handling events or API calls.
1713
+ */
1714
+ teamId: string;
1715
+ };
1716
+ type SlackNativeToolResponse = BaseNativeTool & {
1717
+ /**
1718
+ * Unique identifier of the tool.
1719
+ */
1720
+ id?: string;
1721
+ /**
1722
+ * For SlackNativeTool it has to be set to `slack`.
1723
+ */
1724
+ type?: unknown;
1725
+ config?: SlackNativeToolConfigResponse;
1726
+ metadata?: MetadataResponse;
1727
+ };
1728
+ type RagCustomNativeToolResponse = BaseNativeTool & {
1729
+ /**
1730
+ * Unique identifier of the tool.
1731
+ */
1732
+ id?: string;
1733
+ /**
1734
+ * For `RagCustomNativeTool`, it has to be set to `rag_custom`.
1735
+ */
1736
+ type?: unknown;
1737
+ config?: RagCustomNativeToolConfigResponse;
1738
+ metadata?: MetadataResponse;
1739
+ };
1740
+ type RagEmporixNativeToolResponse = BaseNativeTool & {
1741
+ /**
1742
+ * Unique identifier of the tool.
1743
+ */
1744
+ id?: string;
1745
+ /**
1746
+ * For `RagEmporixNativeTool`, it has to be set to `rag_emporix`.
1747
+ */
1748
+ type?: unknown;
1749
+ config?: RagEmporixNativeToolConfigResponse;
1750
+ metadata?: MetadataResponse;
1751
+ };
1752
+ /**
1753
+ * List of native tools which agents should have access to.
1754
+ */
1755
+ type NativeToolsResponse = Array<SlackNativeToolResponse | RagCustomNativeToolResponse | RagEmporixNativeToolResponse>;
1756
+ type McpServerConfig = {
1757
+ /**
1758
+ * URL of the MCP server.
1759
+ */
1760
+ url: string;
1761
+ /**
1762
+ * Name of the header required for authorization, e.g. `Authorization`.
1763
+ */
1764
+ authorizationHeaderName?: string;
1765
+ };
1766
+ type McpServerConfigResponse = McpServerConfig & {
1767
+ authorizationHeaderToken?: ExpandableTokenResponse;
1768
+ };
1769
+ /**
1770
+ * An object representing customer's own implementation of the MCP server.
1771
+ */
1772
+ type BaseMcpServer = {
1773
+ /**
1774
+ * Name of the MCP server.
1775
+ */
1776
+ name?: string;
1777
+ /**
1778
+ * An indicator whether the MCP server is enabled.
1779
+ */
1780
+ enabled?: boolean;
1781
+ transport?: CustomMcpServerTransportType;
1782
+ };
1783
+ type McpServerResponse = BaseMcpServer & {
1784
+ config?: McpServerConfigResponse;
1785
+ metadata?: MetadataResponse;
1786
+ };
1787
+ /**
1788
+ * Type of the MCP server. The `custom` type allows you to integrate with your own MCP server instance, while the `predefined` type allows you to integrate with one of the instances provided by Emporix.
1789
+ */
1790
+ type McpServerType = 'custom' | 'predefined';
1791
+ /**
1792
+ * Type of the communication between the agent and the MCP server. The `streamable_http` protocol is recommended, since the `sse` protocol is deprecated.
1793
+ */
1794
+ type CustomMcpServerTransportType = 'streamable_http' | 'sse';
1795
+ type BaseAgentMcpServer = {
1796
+ type: McpServerType;
1797
+ };
1798
+ type PredefinedAgentMcpServer = BaseAgentMcpServer & {
1799
+ /**
1800
+ * For the `PredefinedMcpServer` it has to be set to `predefined`.
1801
+ */
1802
+ type?: unknown;
1803
+ domain?: 'customer' | 'extensibility' | 'order' | 'product' | 'frontend';
1804
+ /**
1805
+ * List of the tools which should be used by the agent from this particular MCP server.
1806
+ */
1807
+ tools?: Array<string>;
1808
+ };
1809
+ type CustomAgentMcpServerRequest = BaseAgentMcpServer & {
1810
+ /**
1811
+ * For `CustomMcpServer` it has to be set to `custom`.
1812
+ */
1813
+ type?: unknown;
1814
+ mcpServer: {
1815
+ /**
1816
+ * ID of the MCP server.
1817
+ */
1818
+ id: string;
1819
+ };
1820
+ };
1821
+ type CustomAgentMcpServerResponse = CustomAgentMcpServerRequest & {
1822
+ mcpServer?: McpServerResponse & unknown;
1823
+ };
1824
+ /**
1825
+ * List of MCP servers which agents should have access to.
1826
+ */
1827
+ type AgentMcpServersRequest = Array<CustomAgentMcpServerRequest | PredefinedAgentMcpServer>;
1828
+ /**
1829
+ * List of MCP servers which agents should have access to.
1830
+ */
1831
+ type AgentMcpServersResponse = Array<CustomAgentMcpServerResponse | PredefinedAgentMcpServer>;
1832
+ type BaseLlm = {
1833
+ /**
1834
+ * The exact name of the model.
1835
+ */
1836
+ model: string;
1837
+ /**
1838
+ * 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.
1839
+ */
1840
+ temperature: 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1;
1841
+ /**
1842
+ * The limit of tokens which agent can burn during one request session.
1843
+ */
1844
+ maxTokens: number;
1845
+ };
1846
+ type EmporixLlm = BaseLlm & {
1847
+ /**
1848
+ * Type of the LLM Provider. The `emporix_openai` allows using the OpenAI token provided by Emporix. The token usage is limited. When using this provider `apiKey` property can be omitted.
1849
+ */
1850
+ provider: 'emporix_openai';
1851
+ };
1852
+ type SelfHostedParams = {
1853
+ /**
1854
+ * Url of the self-hosted LLM.
1855
+ */
1856
+ url: string;
1857
+ /**
1858
+ * Name of the header required for authorization e.g. `Authorization`.
1859
+ */
1860
+ authorizationHeaderName?: string;
1861
+ };
1862
+ type SelfHostedParamsRequest = SelfHostedParams & {
1863
+ [key: string]: unknown;
1864
+ } & {
1865
+ authorizationHeaderToken?: InnerTokenRequest;
1866
+ };
1867
+ type SelfHostedParamsResponse = SelfHostedParams & {
1868
+ authorizationHeaderToken?: ExpandableTokenResponse;
1869
+ };
1870
+ type SelfHostedLlm = BaseLlm & {
1871
+ /**
1872
+ * Type of the LLM Provider. The self-hosted LLM allows you to provide your own LLMs. When using this providers, the `selfHostedParams.url` property cannot be omitted.
1873
+ */
1874
+ provider: 'self_hosted_ollama' | 'self_hosted_vllm';
1875
+ };
1876
+ type SelfHostedLlmRequest = SelfHostedLlm & {
1877
+ selfHostedParams: SelfHostedParamsRequest;
1878
+ };
1879
+ type SelfHostedLlmResponse = SelfHostedLlm & {
1880
+ selfHostedParams?: SelfHostedParamsResponse;
1881
+ };
1882
+ /**
1883
+ * Type of the LLM Provider. The supported providers allows you to provide your own API key. When using this providers, the `apiKey` property cannot be omitted.
1884
+ */
1885
+ type ApiKeyLlmProvider = 'openai' | 'google' | 'anthropic';
1886
+ type ApiKeyLlm = BaseLlm & {
1887
+ provider: ApiKeyLlmProvider;
1888
+ };
1889
+ type ApiKeyLlmRequest = ApiKeyLlm & {
1890
+ token: InnerTokenRequest;
1891
+ };
1892
+ type ApiKeyLlmResponse = ApiKeyLlm & {
1893
+ token?: ExpandableTokenResponse;
1894
+ };
1895
+ type IdWrapper = {
1896
+ id: string;
1897
+ };
1898
+ /**
1899
+ * List of agent collaborations which allows an agent to hand off its task to other agents.
1900
+ */
1901
+ type AgentCollaborations = Array<{
1902
+ /**
1903
+ * Identifier of the agent.
1904
+ */
1905
+ agentId?: string;
1906
+ /**
1907
+ * Description of the agent collaboration.
1908
+ */
1909
+ description?: string;
1910
+ }>;
1911
+ /**
1912
+ * Type of the trigger. The `slack` trigger type can be used only for `support` agent type.
1913
+ */
1914
+ type TriggerType = 'endpoint' | 'slack';
1915
+ /**
1916
+ * Type of the trigger.
1917
+ */
1918
+ type CommerceEventsTriggerType = 'commerce_events';
1919
+ type AgentTrigger = {
1920
+ type: TriggerType;
1921
+ } | {
1922
+ type: CommerceEventsTriggerType;
1923
+ /**
1924
+ * Additional configuration for the trigger.
1925
+ */
1926
+ config: {
1927
+ /**
1928
+ * List of events that trigger the agent.
1929
+ */
1930
+ events: string;
1931
+ };
1932
+ };
1933
+ /**
1934
+ * Indicates whether the agent is handOff or not. HandOff agents are special types of agents which can be called by other agents through `agentCollaborations` property and their configuration is hidden.
1935
+ */
1936
+ type HandOff = boolean;
1937
+ type BaseForAgentAndTemplateAndHandOff = {
1938
+ /**
1939
+ * Localized name of the agent.
1940
+ */
1941
+ name?: {
1942
+ [key: string]: string;
1943
+ };
1944
+ /**
1945
+ * Description of the agent.
1946
+ */
1947
+ description?: {
1948
+ [key: string]: string;
1949
+ };
1950
+ };
1951
+ type BaseForAgentAndTemplate = BaseForAgentAndTemplateAndHandOff & {
1952
+ /**
1953
+ * Defines which caller types are allowed to execute the agent.
1954
+ * Authorization is evaluated with OR semantics: access is granted if the caller
1955
+ * matches at least one configured value.
1956
+ * If this field is missing or empty, no scope-based restriction is applied.
1957
+ *
1958
+ * Matching rules:
1959
+ * - anonymous: always grants access.
1960
+ * - customer: requires scope `ai.agentexecution_manage_own`.
1961
+ * - employee: requires scope `ai.agentexecution_manage`.
1962
+ * - integration: requires scope `ai.agentexecution_manage`.
1963
+ *
1964
+ * If no configured value matches, request is rejected with 403 Forbidden.
1965
+ *
1966
+ */
1967
+ requiredScopes?: Array<'anonymous' | 'customer' | 'employee' | 'integration'>;
1968
+ /**
1969
+ * LLM Prompt which describes how agent should work in a detailed way, which tools it could use to solve problems etc; it can contain examples and step by step guidance.
1970
+ */
1971
+ userPrompt?: string;
1972
+ /**
1973
+ * The fa class of react icon.
1974
+ */
1975
+ icon?: string;
1976
+ tags?: Array<string>;
1977
+ /**
1978
+ * Indicates whether the agent is enabled.
1979
+ */
1980
+ enabled?: boolean;
1981
+ };
1982
+ type BaseForAgentRequestAndResponse = BaseForAgentAndTemplate & {
1983
+ triggers: Array<AgentTrigger>;
1984
+ agentCollaborations?: AgentCollaborations;
1985
+ /**
1986
+ * Defines the maximum number of reasoning steps or internal calls an AI agent is allowed to perform during a single task. Helps prevent infinite loops or excessive resource usage.
1987
+ */
1988
+ maxRecursionLimit?: number;
1989
+ /**
1990
+ * Defines whether the session memory should be stored between different agent calls.
1991
+ */
1992
+ enabledMemory?: boolean;
1993
+ };
1994
+ type AgentRequest = BaseForAgentRequestAndResponse & {
1995
+ /**
1996
+ * ID of the native tools.
1997
+ */
1998
+ nativeTools?: Array<IdWrapper>;
1999
+ llmConfig: EmporixLlm | ApiKeyLlmRequest | SelfHostedLlmRequest;
2000
+ mcpServers: AgentMcpServersRequest;
2001
+ metadata?: MetadataRequest;
2002
+ };
2003
+ type AgentResponse = BaseForAgentRequestAndResponse & {
2004
+ /**
2005
+ * Identifier of the agent.
2006
+ */
2007
+ id?: string;
2008
+ nativeTools?: NativeToolsResponse;
2009
+ llmConfig?: EmporixLlm | ApiKeyLlmResponse | SelfHostedLlmResponse;
2010
+ mcpServers?: AgentMcpServersResponse;
2011
+ handOff?: HandOff;
2012
+ type?: AgentType;
2013
+ /**
2014
+ * Prompt which is inherited from the template (if agent is created based on the template). The prompt provided by the user is then concatenated with this prompt.
2015
+ */
2016
+ templatePrompt?: string;
2017
+ metadata?: MetadataResponse;
2018
+ };
2019
+ type MetadataRequest = {
2020
+ /**
2021
+ * Version of the object. The version is required during the update operation because of the optimistic locking mechanism.
2022
+ */
2023
+ version: number;
2024
+ };
2025
+ type MetadataResponse = MetadataRequest & {
2026
+ /**
2027
+ * Date and time when the object was created. The value is approved as an ISO-8601 representation of an Instant. For example: `2022-04-31T13:18:02.379Z`
2028
+ */
2029
+ createdAt: string;
2030
+ /**
2031
+ * Date and time when the object was last modified. The value is approved as an ISO-8601 representation of an Instant. For example: `2022-04-31T13:18:02.379Z`
2032
+ */
2033
+ modifiedAt: string;
2034
+ };
2035
+ type CompletionRequest$1 = {
2036
+ /**
2037
+ * Identifier of the request. The value is not mandatory - if provided, then the ID is returned in the text generation response.
2038
+ */
2039
+ id?: string;
2040
+ messages: Array<{
2041
+ /**
2042
+ * Specifies the role of the message. `SYSTEM` - Provides instructions or context to the AI about the conversation. `USER` - Represents a message sent by the user. `ASSISTANT` - Represents a message generated by the AI.
2043
+ */
2044
+ role: 'USER' | 'SYSTEM' | 'ASSISTANT';
2045
+ /**
2046
+ * Content of the message. Depending on the role parameter, it can be a background instruction, user instruction, or AI response.
2047
+ */
2048
+ content: string;
2049
+ }>;
2050
+ };
2051
+ type QParamSearchBody = {
2052
+ /**
2053
+ * A standard query parameter is used to search for specific values.
2054
+ *
2055
+ * See: [Standard Practices - Query parameter](https://developer.emporix.io/api-references/standard-practices/q-param)
2056
+ *
2057
+ */
2058
+ q?: string;
2059
+ };
2060
+ /**
2061
+ * Partial update operation list.
2062
+ */
2063
+ type PatchRequest = Array<{
2064
+ op: 'ADD' | 'REMOVE' | 'REPLACE';
2065
+ path: string;
2066
+ value?: string | {
2067
+ [key: string]: unknown;
2068
+ };
2069
+ }>;
2070
+
2071
+ /** Single-shot text generation request (`POST /texts`). Has `maxTokens`. */
2072
+ type TextRequest = TextGenerationRequest;
2073
+ /**
2074
+ * Text generation response — `{ id?, result }`. The upstream schema marks
2075
+ * `result` optional, but a 2xx text generation always returns it; the public
2076
+ * contract guarantees `result` so callers need not null-check.
2077
+ */
2078
+ interface TextResponse {
2079
+ id?: string;
2080
+ result: string;
2081
+ }
2082
+ /** One message in a completion request. `role` ∈ `USER | SYSTEM | ASSISTANT`. */
2083
+ type CompletionMessage = CompletionRequest$1["messages"][number];
2084
+ /** Chat completion request (`POST /completions`). No `maxTokens` (server-fixed model). */
2085
+ type CompletionRequest = CompletionRequest$1;
2086
+ /** Chat completion response — `{ id?, result }` (shares the text generation shape). */
2087
+ interface CompletionResponse {
2088
+ id?: string;
2089
+ result: string;
2090
+ }
2091
+ /** An agentic agent definition (the read/response shape, returned by every agent method). */
2092
+ type Agent = AgentResponse;
2093
+ /** The write shape for {@link AiService.upsertAgent} (`PUT /agentic/agents/{id}`). */
2094
+ type AgentInput = AgentRequest;
2095
+ /**
2096
+ * One PATCH operation for `patchAgent`. `op` is the upstream UPPERCASE enum
2097
+ * (`ADD | REMOVE | REPLACE`) — NOT RFC-6902 lowercase. Passed verbatim.
2098
+ */
2099
+ type AgentPatchOp = PatchRequest[number];
2100
+ /** Request body for `POST /agentic/agents/search` (`{ q? }`). */
2101
+ type AgentSearchQuery = QParamSearchBody;
2102
+ /** Request body for `chat` / `chatAsync` — `{ agentId, message }`. */
2103
+ type ChatRequest = AgenticRequest;
2104
+ /**
2105
+ * One synchronous chat result — `{ agentId, agentType, sessionId, message }`.
2106
+ * The upstream schema marks every field optional and types `agentType` as an
2107
+ * enum; the public contract surfaces the fields a successful chat always
2108
+ * returns as required strings.
2109
+ */
2110
+ interface ChatResponse {
2111
+ agentId: string;
2112
+ agentType: string;
2113
+ sessionId: string;
2114
+ message: string;
2115
+ }
2116
+ /** One async job acknowledgement — `{ jobId }`. */
2117
+ interface JobIdResponse {
2118
+ jobId: string;
2119
+ }
2120
+ /** Options for {@link AiService.deleteAgent}. */
2121
+ interface DeleteAgentOptions {
2122
+ /** Force deletion even if the agent is referenced elsewhere (`?force=true`). */
2123
+ force?: boolean;
2124
+ }
2125
+
2126
+ /**
2127
+ * Emporix AI Service (`/ai-service/{tenant}/…`): text generation, chat
2128
+ * completions, and the agentic layer (agent CRUD + synchronous/asynchronous
2129
+ * chat). Every endpoint requires a backend-only `ai.*` scope and the
2130
+ * **service (clientCredentials) token** — default auth: service.
2131
+ *
2132
+ * Server-side use only; the service token must never reach a browser. A
2133
+ * storefront chat (scope `ai.agentexecution_manage_own`) would require a
2134
+ * BFF / token-proxy — out of scope for this SDK.
2135
+ *
2136
+ * The model is server-fixed per tenant; there is no `model` parameter.
2137
+ */
2138
+ declare class AiService {
2139
+ private readonly ctx;
2140
+ constructor(ctx: ClientContext);
2141
+ private base;
2142
+ /** Generate text from a single prompt (`POST /texts`). Honors `maxTokens`. */
2143
+ generateText(input: TextRequest, auth?: AuthContext): Promise<TextResponse>;
2144
+ /** Run a chat completion over a message list (`POST /completions`). No `maxTokens`. */
2145
+ complete(input: CompletionRequest, auth?: AuthContext): Promise<CompletionResponse>;
2146
+ /** List all agentic agents. */
2147
+ listAgents(auth?: AuthContext): Promise<Agent[]>;
2148
+ /** Retrieve one agent by id. */
2149
+ getAgent(id: string, auth?: AuthContext): Promise<Agent>;
2150
+ /** Create-or-replace an agent by id (`PUT`). Takes the agent write shape. */
2151
+ upsertAgent(id: string, agent: AgentInput, auth?: AuthContext): Promise<Agent>;
2152
+ /**
2153
+ * Patch an agent with an op array (`PATCH`). `ops` use the upstream
2154
+ * UPPERCASE enum (`ADD | REMOVE | REPLACE`) and are sent verbatim — this is
2155
+ * NOT RFC-6902 JSON-Patch.
2156
+ */
2157
+ patchAgent(id: string, ops: AgentPatchOp[], auth?: AuthContext): Promise<Agent>;
2158
+ /**
2159
+ * Delete an agent by id. Pass `{ force: true }` to delete an agent that is
2160
+ * still referenced elsewhere (`?force=true`).
2161
+ */
2162
+ deleteAgent(id: string, auth?: AuthContext, opts?: DeleteAgentOptions): Promise<void>;
2163
+ /** Server-side agent search (`POST /agentic/agents/search`). */
2164
+ searchAgents(query: AgentSearchQuery, auth?: AuthContext): Promise<Agent[]>;
2165
+ /**
2166
+ * Synchronous agent chat (`POST /agentic/chat`). Returns the response
2167
+ * ARRAY verbatim (the upstream contract is an array, not a single object).
2168
+ */
2169
+ chat(input: ChatRequest, auth?: AuthContext): Promise<ChatResponse[]>;
2170
+ /**
2171
+ * Fire-and-forget agent chat (`POST /agentic/chat-async`, HTTP 201).
2172
+ * Returns the job-id ARRAY verbatim.
2173
+ */
2174
+ chatAsync(input: ChatRequest, auth?: AuthContext): Promise<JobIdResponse[]>;
2175
+ }
2176
+
175
2177
  /** The Emporix SDK entry point. One instance safely serves many concurrent shoppers. */
176
2178
  declare class EmporixClient {
177
2179
  readonly customers: CustomerService;
@@ -192,6 +2194,15 @@ declare class EmporixClient {
192
2194
  readonly orders: OrdersService;
193
2195
  readonly salesOrders: SalesOrdersService;
194
2196
  readonly availability: AvailabilityService;
2197
+ readonly tenantConfig: TenantConfigService;
2198
+ readonly clientConfig: ClientConfigService;
2199
+ readonly shoppingLists: ShoppingListService;
2200
+ readonly ragIndexer: RagIndexerService;
2201
+ readonly sequentialIds: SequentialIdService;
2202
+ readonly fees: FeeService;
2203
+ readonly webhooks: WebhookService;
2204
+ readonly schemas: SchemaService;
2205
+ readonly ai: AiService;
195
2206
  /** The validated tenant this client is bound to. */
196
2207
  readonly tenant: string;
197
2208
  /**
@@ -218,4 +2229,4 @@ declare class EmporixClient {
218
2229
  getLogLevel(service: ServiceName): LogLevel;
219
2230
  }
220
2231
 
221
- export { AuthContext, AvailabilityService, CartService, CategoryService, CheckoutService, ClientContext, CompaniesService, ContactsService, CustomerGroupsService, CustomerService, EmporixAuthError, EmporixClient, EmporixConfig, EmporixError, EmporixForbiddenError, EmporixInsufficientScopeError, EmporixNotFoundError, EmporixServerError, EmporixValidationError, LocationsService, LogLevel, MediaService, OrdersService, PaymentGatewayService, PriceService, ProductService, ResolvedConfig, SalesOrdersService, SegmentService, ServiceName, type SessionContext, type SessionContextPatch, SessionContextService, type Site, SiteService, TokenProvider, errorFromResponse };
2232
+ export { type Agent, type AgentInput, type AgentPatchOp, type AgentSearchQuery, AiService, AuthContext, AvailabilityService, type BatchNextIdEntry, CartService, CategoryService, type ChatRequest, type ChatResponse, CheckoutService, ClientConfigService, type ClientConfiguration, ClientContext, CompaniesService, type CompletionMessage, type CompletionRequest, type CompletionResponse, type Configuration$1 as Configuration, type ConfigurationDraft, ContactsService, type CustomEntity, type CustomEntityDraft, type CustomInstance, type CustomInstanceDraft, CustomerGroupsService, CustomerService, type DeleteAgentOptions, type DeleteConfigOptions, EmporixAuthError, EmporixClient, EmporixConfig, EmporixError, EmporixForbiddenError, EmporixInsufficientScopeError, EmporixNotFoundError, EmporixServerError, EmporixValidationError, type Fee, type FeeDraft, FeeService, type InstanceSearchBody, type ItemFee, type ItemFeeDraft, type ItemFeeSearch, type JobIdResponse, type ListConfigOptions, type ListCustomEntitiesOptions, type ListFeesQuery, type ListInstancesQuery, type ListSchemasQuery, LocationsService, LogLevel, MediaService, type MetadataFilter, type NextIdCommandRequest, type NextIdOptions, type NextIdResponse, type NextIdsBatchRequest, type NextIdsBatchResponse, OrdersService, PaginatedItems, PaymentGatewayService, PriceService, ProductService, RagIndexerService, type RagType, ResolvedConfig, SalesOrdersService, type Schema, type SchemaAttribute, type SchemaDraft, SchemaService, type SchemaTypeName, type SchemaUpdate, SegmentService, type SequenceSchema, type SequenceSchemaCreate, SequentialIdService, ServiceName, type SessionContext, type SessionContextPatch, SessionContextService, type SetItemFeesOptions, type ShoppingList, type ShoppingListDraft, type ShoppingListItem, ShoppingListService, type Site, SiteService, TenantConfigService, type TextRequest, type TextResponse, TokenProvider, type WebhookConfig, type WebhookConfigCreated, type WebhookConfigDraft, type WebhookConfigPatch, type WebhookDashboardAccess, WebhookService, type WebhookStatistics, type WebhookStatisticsQuery, type WebhookSubscription, type WebhookSubscriptionUpdateItem, type WebhookSubscriptionUpdateResultItem, errorFromResponse };