@viu/emporix-sdk 2.23.0 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +16 -6
- package/dist/availability.d.cts +1 -1
- package/dist/availability.d.ts +1 -1
- package/dist/cart.d.cts +1 -1
- package/dist/cart.d.ts +1 -1
- package/dist/category.d.cts +1 -1
- package/dist/category.d.ts +1 -1
- package/dist/checkout.d.cts +1 -1
- package/dist/checkout.d.ts +1 -1
- package/dist/companies.d.cts +1 -1
- package/dist/companies.d.ts +1 -1
- package/dist/contacts.d.cts +1 -1
- package/dist/contacts.d.ts +1 -1
- package/dist/{context-CfXJcYKP.d.cts → context-DC5gSgKK.d.cts} +18 -0
- package/dist/{context-CfXJcYKP.d.ts → context-DC5gSgKK.d.ts} +18 -0
- package/dist/{customer-groups-BxSNFHq1.d.cts → customer-groups-BqYsPCA6.d.cts} +1 -1
- package/dist/{customer-groups-GlzWhDsi.d.ts → customer-groups-CLm6Gu9U.d.ts} +1 -1
- package/dist/customer-groups.d.cts +2 -2
- package/dist/customer-groups.d.ts +2 -2
- package/dist/customer.d.cts +1 -1
- package/dist/customer.d.ts +1 -1
- package/dist/index.cjs +12 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/dist/locations.d.cts +1 -1
- package/dist/locations.d.ts +1 -1
- package/dist/media.d.cts +1 -1
- package/dist/media.d.ts +1 -1
- package/dist/orders.d.cts +1 -1
- package/dist/orders.d.ts +1 -1
- package/dist/payment.d.cts +1 -1
- package/dist/payment.d.ts +1 -1
- package/dist/price.d.cts +1 -1
- package/dist/price.d.ts +1 -1
- package/dist/product.d.cts +1 -1
- package/dist/product.d.ts +1 -1
- package/dist/segment.d.cts +1 -1
- package/dist/segment.d.ts +1 -1
- 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-
|
|
2
|
-
export { A as AnonymousSession, a as AnonymousSessionStore, c as AuthKind, d as CustomerRefreshRegistry, D as DEFAULT_HOST, f as DefaultTokenProvider, H as HttpClient, g as HttpClientOptions, L as LEVEL, h as LevelResolver, i as LogFields, k as Logger, l as LoggerConfig, m as LoggerObjectConfig, R as RequestOptions, S as ServiceCredentials, p as StorefrontCredentials, q as auth, r as createConsoleLogger, s as createNoopLogger, t as iterateAll, u as redact, v as resolveToken, w as validateConfig } from './context-
|
|
1
|
+
import { C as ClientContext, b as AuthContext, P as PaginatedItems, T as TokenProvider, n as ResolvedConfig, E as EmporixConfig, j as LogLevel, o as ServiceName, e as CustomerTokenRefresher } from './context-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-
|
|
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';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ClientContext, b as AuthContext, P as PaginatedItems, T as TokenProvider, n as ResolvedConfig, E as EmporixConfig, j as LogLevel, o as ServiceName, e as CustomerTokenRefresher } from './context-
|
|
2
|
-
export { A as AnonymousSession, a as AnonymousSessionStore, c as AuthKind, d as CustomerRefreshRegistry, D as DEFAULT_HOST, f as DefaultTokenProvider, H as HttpClient, g as HttpClientOptions, L as LEVEL, h as LevelResolver, i as LogFields, k as Logger, l as LoggerConfig, m as LoggerObjectConfig, R as RequestOptions, S as ServiceCredentials, p as StorefrontCredentials, q as auth, r as createConsoleLogger, s as createNoopLogger, t as iterateAll, u as redact, v as resolveToken, w as validateConfig } from './context-
|
|
1
|
+
import { C as ClientContext, b as AuthContext, P as PaginatedItems, T as TokenProvider, n as ResolvedConfig, E as EmporixConfig, j as LogLevel, o as ServiceName, e as CustomerTokenRefresher } from './context-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-
|
|
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';
|
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([
|
|
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
|
|
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.
|
|
598
|
+
var version = "2.25.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 {
|