@viu/emporix-sdk 2.23.0 → 2.26.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 (43) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +16 -6
  3. package/dist/availability.d.cts +1 -1
  4. package/dist/availability.d.ts +1 -1
  5. package/dist/cart.d.cts +1 -1
  6. package/dist/cart.d.ts +1 -1
  7. package/dist/category.d.cts +1 -1
  8. package/dist/category.d.ts +1 -1
  9. package/dist/checkout.d.cts +1 -1
  10. package/dist/checkout.d.ts +1 -1
  11. package/dist/companies.d.cts +1 -1
  12. package/dist/companies.d.ts +1 -1
  13. package/dist/contacts.d.cts +1 -1
  14. package/dist/contacts.d.ts +1 -1
  15. package/dist/{context-CfXJcYKP.d.cts → context-DC5gSgKK.d.cts} +18 -0
  16. package/dist/{context-CfXJcYKP.d.ts → context-DC5gSgKK.d.ts} +18 -0
  17. package/dist/{customer-groups-BxSNFHq1.d.cts → customer-groups-BqYsPCA6.d.cts} +1 -1
  18. package/dist/{customer-groups-GlzWhDsi.d.ts → customer-groups-CLm6Gu9U.d.ts} +1 -1
  19. package/dist/customer-groups.d.cts +2 -2
  20. package/dist/customer-groups.d.ts +2 -2
  21. package/dist/customer.d.cts +1 -1
  22. package/dist/customer.d.ts +1 -1
  23. package/dist/index.cjs +12 -5
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +5 -5
  26. package/dist/index.d.ts +5 -5
  27. package/dist/index.js +12 -5
  28. package/dist/index.js.map +1 -1
  29. package/dist/locations.d.cts +1 -1
  30. package/dist/locations.d.ts +1 -1
  31. package/dist/media.d.cts +1 -1
  32. package/dist/media.d.ts +1 -1
  33. package/dist/orders.d.cts +1 -1
  34. package/dist/orders.d.ts +1 -1
  35. package/dist/payment.d.cts +1 -1
  36. package/dist/payment.d.ts +1 -1
  37. package/dist/price.d.cts +1 -1
  38. package/dist/price.d.ts +1 -1
  39. package/dist/product.d.cts +1 -1
  40. package/dist/product.d.ts +1 -1
  41. package/dist/segment.d.cts +1 -1
  42. package/dist/segment.d.ts +1 -1
  43. package/package.json +1 -1
package/dist/index.d.cts 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-CfXJcYKP.cjs';
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-CfXJcYKP.cjs';
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-DC5gSgKK.cjs';
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-DC5gSgKK.cjs';
3
3
  import { CustomerService } from './customer.cjs';
4
4
  export { Address, AddressCreateInput, AddressUpdateInput, ChangeEmailInput, ConfirmEmailChangeInput, Customer, CustomerSession, CustomerSignupInput, CustomerUpdateInput, PasswordChangeInput, PasswordResetConfirmInput, PasswordResetRequestInput, ResendActivationInput } from './customer.cjs';
5
5
  import { ProductService } from './product.cjs';
@@ -21,7 +21,7 @@ export { Segment, SegmentAssignmentBulkResult, SegmentBulkItem, SegmentBulkResul
21
21
  import { CompaniesService } from './companies.cjs';
22
22
  import { ContactsService } from './contacts.cjs';
23
23
  import { LocationsService } from './locations.cjs';
24
- import { m as UserResponse, U as UserCreateRequest, l as UserIdResponse, k as UserExtendedResponse, o as UserUpdateRequest, j as GroupsQueryDocument, n as UserScopesResponse, a as AccessControlQueryDocument, G as GroupCreateRequest, h as GroupIdResponse, i as GroupUpdateRequest, c as AssignmentCreateRequest, d as AssignmentIdResponse, b as AccessControlUpsertRequest, A as AccessControlIdResponse, e as CustomScopeQueryDocument, f as CustomScopeUpsertRequest, C as CustomScopeIdResponse, g as CustomerGroupsService } from './customer-groups-BxSNFHq1.cjs';
24
+ import { m as UserResponse, U as UserCreateRequest, l as UserIdResponse, k as UserExtendedResponse, o as UserUpdateRequest, j as GroupsQueryDocument, n as UserScopesResponse, a as AccessControlQueryDocument, G as GroupCreateRequest, h as GroupIdResponse, i as GroupUpdateRequest, c as AssignmentCreateRequest, d as AssignmentIdResponse, b as AccessControlUpsertRequest, A as AccessControlIdResponse, e as CustomScopeQueryDocument, f as CustomScopeUpsertRequest, C as CustomScopeIdResponse, g as CustomerGroupsService } from './customer-groups-BqYsPCA6.cjs';
25
25
  import { OrdersService, SalesOrdersService } from './orders.cjs';
26
26
  export { GetOrderOptions, ListLegalEntityOrdersOptions, ListMyOrdersOptions, ListSalesOrdersOptions, Order, OrderEntry, OrderStatus, OrderTransitionOptions, SalesOrder, SalesOrderCalculationInput, SalesOrderCreateInput, SalesOrderCreated, SalesOrderEntriesInput, SalesOrderHistoricalTransitions, SalesOrderPatch, SalesOrderReplaceInput, SalesOrderSearchInput, SalesOrderSplitInput, SalesOrderSplitResult, Transition, UpdateSalesOrderOptions } from './orders.cjs';
27
27
  import { AvailabilityService } from './availability.cjs';
@@ -2481,7 +2481,7 @@ type RagEmporixNativeToolConfig = {
2481
2481
  */
2482
2482
  prompt: string;
2483
2483
  /**
2484
- * Type of the entity which is stored in the given collection. Supported predefined types: [PRODUCT] and custom entity types.
2484
+ * Type of the entity which is stored in the given collection. Supported predefined types: [ORDER, PRODUCT] and custom entity types.
2485
2485
  */
2486
2486
  entityType: string;
2487
2487
  /**
@@ -7781,7 +7781,7 @@ type Metadata$3 = {
7781
7781
  modifiedAt?: string;
7782
7782
  };
7783
7783
  /**
7784
- * Entity type which should be reindexed. For now, it supports only `PRODUCT` and custom schema types.
7784
+ * Entity type which should be reindexed. It supports `ORDER`, `PRODUCT` and custom schema types.
7785
7785
  */
7786
7786
  type ReindexEntityType$1 = string;
7787
7787
  type ReindexJob$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-CfXJcYKP.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-CfXJcYKP.js';
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-DC5gSgKK.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-DC5gSgKK.js';
3
3
  import { CustomerService } from './customer.js';
4
4
  export { Address, AddressCreateInput, AddressUpdateInput, ChangeEmailInput, ConfirmEmailChangeInput, Customer, CustomerSession, CustomerSignupInput, CustomerUpdateInput, PasswordChangeInput, PasswordResetConfirmInput, PasswordResetRequestInput, ResendActivationInput } from './customer.js';
5
5
  import { ProductService } from './product.js';
@@ -21,7 +21,7 @@ export { Segment, SegmentAssignmentBulkResult, SegmentBulkItem, SegmentBulkResul
21
21
  import { CompaniesService } from './companies.js';
22
22
  import { ContactsService } from './contacts.js';
23
23
  import { LocationsService } from './locations.js';
24
- import { m as UserResponse, U as UserCreateRequest, l as UserIdResponse, k as UserExtendedResponse, o as UserUpdateRequest, j as GroupsQueryDocument, n as UserScopesResponse, a as AccessControlQueryDocument, G as GroupCreateRequest, h as GroupIdResponse, i as GroupUpdateRequest, c as AssignmentCreateRequest, d as AssignmentIdResponse, b as AccessControlUpsertRequest, A as AccessControlIdResponse, e as CustomScopeQueryDocument, f as CustomScopeUpsertRequest, C as CustomScopeIdResponse, g as CustomerGroupsService } from './customer-groups-GlzWhDsi.js';
24
+ import { m as UserResponse, U as UserCreateRequest, l as UserIdResponse, k as UserExtendedResponse, o as UserUpdateRequest, j as GroupsQueryDocument, n as UserScopesResponse, a as AccessControlQueryDocument, G as GroupCreateRequest, h as GroupIdResponse, i as GroupUpdateRequest, c as AssignmentCreateRequest, d as AssignmentIdResponse, b as AccessControlUpsertRequest, A as AccessControlIdResponse, e as CustomScopeQueryDocument, f as CustomScopeUpsertRequest, C as CustomScopeIdResponse, g as CustomerGroupsService } from './customer-groups-CLm6Gu9U.js';
25
25
  import { OrdersService, SalesOrdersService } from './orders.js';
26
26
  export { GetOrderOptions, ListLegalEntityOrdersOptions, ListMyOrdersOptions, ListSalesOrdersOptions, Order, OrderEntry, OrderStatus, OrderTransitionOptions, SalesOrder, SalesOrderCalculationInput, SalesOrderCreateInput, SalesOrderCreated, SalesOrderEntriesInput, SalesOrderHistoricalTransitions, SalesOrderPatch, SalesOrderReplaceInput, SalesOrderSearchInput, SalesOrderSplitInput, SalesOrderSplitResult, Transition, UpdateSalesOrderOptions } from './orders.js';
27
27
  import { AvailabilityService } from './availability.js';
@@ -2481,7 +2481,7 @@ type RagEmporixNativeToolConfig = {
2481
2481
  */
2482
2482
  prompt: string;
2483
2483
  /**
2484
- * Type of the entity which is stored in the given collection. Supported predefined types: [PRODUCT] and custom entity types.
2484
+ * Type of the entity which is stored in the given collection. Supported predefined types: [ORDER, PRODUCT] and custom entity types.
2485
2485
  */
2486
2486
  entityType: string;
2487
2487
  /**
@@ -7781,7 +7781,7 @@ type Metadata$3 = {
7781
7781
  modifiedAt?: string;
7782
7782
  };
7783
7783
  /**
7784
- * Entity type which should be reindexed. For now, it supports only `PRODUCT` and custom schema types.
7784
+ * Entity type which should be reindexed. It supports `ORDER`, `PRODUCT` and custom schema types.
7785
7785
  */
7786
7786
  type ReindexEntityType$1 = string;
7787
7787
  type ReindexJob$1 = {
package/dist/index.js CHANGED
@@ -61,7 +61,8 @@ function validateConfig(input) {
61
61
  expirationBufferSeconds: input.cache?.expirationBufferSeconds ?? 60,
62
62
  maxLifetimeSeconds: input.cache?.maxLifetimeSeconds ?? 3600
63
63
  },
64
- logger: input.logger
64
+ logger: input.logger,
65
+ fetch: input.fetch
65
66
  };
66
67
  }
67
68
 
@@ -350,9 +351,12 @@ var HttpClient = class {
350
351
  constructor(opts) {
351
352
  this.opts = opts;
352
353
  this.sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
354
+ this.doFetch = opts.fetch ?? ((...args) => globalThis.fetch(...args));
353
355
  }
354
356
  opts;
355
357
  sleep;
358
+ /** Resolved request fetch. The arrow keeps `globalThis.fetch` correctly bound. */
359
+ doFetch;
356
360
  buildHeaders(o, token, isFormData) {
357
361
  return {
358
362
  ...this.opts.requestContext?.language ? { "Accept-Language": this.opts.requestContext.language } : {},
@@ -408,7 +412,7 @@ var HttpClient = class {
408
412
  let res;
409
413
  let text;
410
414
  try {
411
- res = await Promise.race([fetch(url, init), overallBudget]);
415
+ res = await Promise.race([this.doFetch(url, init), overallBudget]);
412
416
  clearTimeout(connectTimer);
413
417
  connectTimer = void 0;
414
418
  const body = res.text();
@@ -512,7 +516,7 @@ var HttpClient = class {
512
516
  init.body = isFormData ? o.body : JSON.stringify(o.body);
513
517
  }
514
518
  try {
515
- return await fetch(url, init);
519
+ return await this.doFetch(url, init);
516
520
  } catch (err) {
517
521
  if (err.name === "AbortError") {
518
522
  throw new EmporixTimeoutError(
@@ -591,7 +595,7 @@ var HttpClient = class {
591
595
  };
592
596
 
593
597
  // package.json
594
- var version = "2.23.0";
598
+ var version = "2.26.0";
595
599
 
596
600
  // src/version.ts
597
601
  var SDK_VERSION = version;
@@ -630,7 +634,10 @@ function createCore(config) {
630
634
  retry: cfg.retry,
631
635
  timeouts: cfg.timeouts,
632
636
  customerRefresh,
633
- requestContext
637
+ requestContext,
638
+ // exactOptionalPropertyTypes: `{ fetch: undefined }` is a type error
639
+ // against `fetch?: typeof globalThis.fetch`, so spread conditionally.
640
+ ...cfg.fetch !== void 0 ? { fetch: cfg.fetch } : {}
634
641
  })
635
642
  });
636
643
  return {