@viu/emporix-sdk 2.0.0 → 2.2.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 +38 -0
- package/README.md +13 -1
- package/dist/availability.cjs +101 -0
- package/dist/availability.cjs.map +1 -0
- package/dist/availability.d.cts +87 -0
- package/dist/availability.d.ts +87 -0
- package/dist/availability.js +4 -0
- package/dist/availability.js.map +1 -0
- 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/{chunk-QDABAMVN.js → chunk-5JHTZBOC.js} +65 -2
- package/dist/chunk-5JHTZBOC.js.map +1 -0
- package/dist/chunk-SCI7D74B.js +91 -0
- package/dist/chunk-SCI7D74B.js.map +1 -0
- package/dist/chunk-XMEP74BU.js +60 -0
- package/dist/chunk-XMEP74BU.js.map +1 -0
- package/dist/companies.d.cts +1 -1
- package/dist/companies.d.ts +1 -1
- package/dist/contacts.d.cts +1 -1
- package/dist/contacts.d.ts +1 -1
- package/dist/{context-mMTqsW1Z.d.cts → context-Bs5ZSwds.d.cts} +1 -1
- package/dist/{context-mMTqsW1Z.d.ts → context-Bs5ZSwds.d.ts} +1 -1
- package/dist/customer-groups.d.cts +1 -1
- package/dist/customer-groups.d.ts +1 -1
- package/dist/customer.d.cts +1 -1
- package/dist/customer.d.ts +1 -1
- package/dist/index.cjs +295 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -4
- package/dist/index.d.ts +125 -4
- package/dist/index.js +137 -11
- 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.cjs +44 -0
- package/dist/price.cjs.map +1 -1
- package/dist/price.d.cts +27 -2
- package/dist/price.d.ts +27 -2
- package/dist/price.js +1 -1
- package/dist/product.cjs +63 -0
- package/dist/product.cjs.map +1 -1
- package/dist/product.d.cts +31 -1
- package/dist/product.d.ts +31 -1
- package/dist/product.js +1 -1
- package/dist/segment.d.cts +1 -1
- package/dist/segment.d.ts +1 -1
- package/package.json +6 -1
- package/dist/chunk-HEO34WLO.js +0 -47
- package/dist/chunk-HEO34WLO.js.map +0 -1
- package/dist/chunk-QDABAMVN.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-
|
|
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-
|
|
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-Bs5ZSwds.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-Bs5ZSwds.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';
|
|
@@ -13,7 +13,7 @@ export { CheckoutInput, CheckoutOptions, CheckoutResult, QuoteCheckoutInput } fr
|
|
|
13
13
|
import { PaymentGatewayService } from './payment.cjs';
|
|
14
14
|
export { AuthorizePaymentInput, AuthorizePaymentResult, PaymentMode } from './payment.cjs';
|
|
15
15
|
import { PriceService } from './price.cjs';
|
|
16
|
-
export { PriceMatch, PriceMatchByContextInput, PriceMatchInput } from './price.cjs';
|
|
16
|
+
export { MatchByContextChunkedOptions, PriceMatch, PriceMatchByContextInput, PriceMatchInput } from './price.cjs';
|
|
17
17
|
import { MediaService } from './media.cjs';
|
|
18
18
|
export { Asset, AssetCreateBlobInput, AssetCreateLinkInput, AssetRefId, AssetUpdateBlobInput, AssetUpdateInput, AssetUpdateLinkInput, DownloadResult, ListAssetsQuery } from './media.cjs';
|
|
19
19
|
import { SegmentService } from './segment.cjs';
|
|
@@ -25,6 +25,8 @@ import { CustomerGroupsService } from './customer-groups.cjs';
|
|
|
25
25
|
export { IamGroup, IamGroupB2B } from './customer-groups.cjs';
|
|
26
26
|
import { OrdersService, SalesOrdersService } from './orders.cjs';
|
|
27
27
|
export { GetOrderOptions, ListMyOrdersOptions, Order, OrderAddress, OrderCustomer, OrderDelivery, OrderItem, OrderMetadata, OrderMoney, OrderPayment, OrderStatus, OrderTaxLine, OrderTransition, OrderTransitionOptions, SalesOrderPatch, UpdateSalesOrderOptions } from './orders.cjs';
|
|
28
|
+
import { AvailabilityService } from './availability.cjs';
|
|
29
|
+
export { Availability, AvailabilityOptions } from './availability.cjs';
|
|
28
30
|
export { A as AccountLimit, C as ContactAssignment, a as ContactAssignmentCreate, b as ContactAssignmentType, c as ContactAssignmentUpdate, d as ContactDetails, e as CustomerGroupRef, L as LegalEntity, f as LegalEntityCreate, g as LegalEntityType, h as LegalEntityUpdate, i as LegalInfo, j as Location, k as LocationCreate, l as LocationType, m as LocationUpdate } from './types.gen-D1QuqPLs.cjs';
|
|
29
31
|
|
|
30
32
|
/** Base class for every error thrown by the SDK. */
|
|
@@ -170,6 +172,122 @@ declare class SessionContextService {
|
|
|
170
172
|
patch(input: SessionContextPatch, authCtx?: AuthContext): Promise<boolean>;
|
|
171
173
|
}
|
|
172
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<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<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[]>;
|
|
258
|
+
/** Retrieve one tenant configuration by key. */
|
|
259
|
+
get<T = unknown>(key: string, auth?: AuthContext): Promise<Configuration<T>>;
|
|
260
|
+
/** Create one or more tenant configurations (array in, array out). */
|
|
261
|
+
create(drafts: ConfigurationDraft[], auth?: AuthContext): Promise<Configuration[]>;
|
|
262
|
+
/** Update one tenant configuration by key. */
|
|
263
|
+
update<T = unknown>(key: string, draft: ConfigurationDraft<T>, auth?: AuthContext): Promise<Configuration<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
|
+
|
|
173
291
|
/** The Emporix SDK entry point. One instance safely serves many concurrent shoppers. */
|
|
174
292
|
declare class EmporixClient {
|
|
175
293
|
readonly customers: CustomerService;
|
|
@@ -189,6 +307,9 @@ declare class EmporixClient {
|
|
|
189
307
|
readonly customerGroups: CustomerGroupsService;
|
|
190
308
|
readonly orders: OrdersService;
|
|
191
309
|
readonly salesOrders: SalesOrdersService;
|
|
310
|
+
readonly availability: AvailabilityService;
|
|
311
|
+
readonly tenantConfig: TenantConfigService;
|
|
312
|
+
readonly clientConfig: ClientConfigService;
|
|
192
313
|
/** The validated tenant this client is bound to. */
|
|
193
314
|
readonly tenant: string;
|
|
194
315
|
/**
|
|
@@ -215,4 +336,4 @@ declare class EmporixClient {
|
|
|
215
336
|
getLogLevel(service: ServiceName): LogLevel;
|
|
216
337
|
}
|
|
217
338
|
|
|
218
|
-
export { AuthContext, 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 };
|
|
339
|
+
export { AuthContext, AvailabilityService, CartService, CategoryService, CheckoutService, ClientConfigService, type ClientConfiguration, ClientContext, CompaniesService, type Configuration, type ConfigurationDraft, ContactsService, CustomerGroupsService, CustomerService, EmporixAuthError, EmporixClient, EmporixConfig, EmporixError, EmporixForbiddenError, EmporixInsufficientScopeError, EmporixNotFoundError, EmporixServerError, EmporixValidationError, type ListConfigOptions, LocationsService, LogLevel, MediaService, OrdersService, PaymentGatewayService, PriceService, ProductService, ResolvedConfig, SalesOrdersService, SegmentService, ServiceName, type SessionContext, type SessionContextPatch, SessionContextService, type Site, SiteService, TenantConfigService, TokenProvider, errorFromResponse };
|
package/dist/index.d.ts
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-
|
|
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-
|
|
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-Bs5ZSwds.js';
|
|
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-Bs5ZSwds.js';
|
|
3
3
|
import { CustomerService } from './customer.js';
|
|
4
4
|
export { Address, AddressCreateInput, AddressUpdateInput, Customer, CustomerSession, CustomerSignupInput, CustomerUpdateInput, PasswordChangeInput, PasswordResetConfirmInput, PasswordResetRequestInput } from './customer.js';
|
|
5
5
|
import { ProductService } from './product.js';
|
|
@@ -13,7 +13,7 @@ export { CheckoutInput, CheckoutOptions, CheckoutResult, QuoteCheckoutInput } fr
|
|
|
13
13
|
import { PaymentGatewayService } from './payment.js';
|
|
14
14
|
export { AuthorizePaymentInput, AuthorizePaymentResult, PaymentMode } from './payment.js';
|
|
15
15
|
import { PriceService } from './price.js';
|
|
16
|
-
export { PriceMatch, PriceMatchByContextInput, PriceMatchInput } from './price.js';
|
|
16
|
+
export { MatchByContextChunkedOptions, PriceMatch, PriceMatchByContextInput, PriceMatchInput } from './price.js';
|
|
17
17
|
import { MediaService } from './media.js';
|
|
18
18
|
export { Asset, AssetCreateBlobInput, AssetCreateLinkInput, AssetRefId, AssetUpdateBlobInput, AssetUpdateInput, AssetUpdateLinkInput, DownloadResult, ListAssetsQuery } from './media.js';
|
|
19
19
|
import { SegmentService } from './segment.js';
|
|
@@ -25,6 +25,8 @@ import { CustomerGroupsService } from './customer-groups.js';
|
|
|
25
25
|
export { IamGroup, IamGroupB2B } from './customer-groups.js';
|
|
26
26
|
import { OrdersService, SalesOrdersService } from './orders.js';
|
|
27
27
|
export { GetOrderOptions, ListMyOrdersOptions, Order, OrderAddress, OrderCustomer, OrderDelivery, OrderItem, OrderMetadata, OrderMoney, OrderPayment, OrderStatus, OrderTaxLine, OrderTransition, OrderTransitionOptions, SalesOrderPatch, UpdateSalesOrderOptions } from './orders.js';
|
|
28
|
+
import { AvailabilityService } from './availability.js';
|
|
29
|
+
export { Availability, AvailabilityOptions } from './availability.js';
|
|
28
30
|
export { A as AccountLimit, C as ContactAssignment, a as ContactAssignmentCreate, b as ContactAssignmentType, c as ContactAssignmentUpdate, d as ContactDetails, e as CustomerGroupRef, L as LegalEntity, f as LegalEntityCreate, g as LegalEntityType, h as LegalEntityUpdate, i as LegalInfo, j as Location, k as LocationCreate, l as LocationType, m as LocationUpdate } from './types.gen-D1QuqPLs.js';
|
|
29
31
|
|
|
30
32
|
/** Base class for every error thrown by the SDK. */
|
|
@@ -170,6 +172,122 @@ declare class SessionContextService {
|
|
|
170
172
|
patch(input: SessionContextPatch, authCtx?: AuthContext): Promise<boolean>;
|
|
171
173
|
}
|
|
172
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<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<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[]>;
|
|
258
|
+
/** Retrieve one tenant configuration by key. */
|
|
259
|
+
get<T = unknown>(key: string, auth?: AuthContext): Promise<Configuration<T>>;
|
|
260
|
+
/** Create one or more tenant configurations (array in, array out). */
|
|
261
|
+
create(drafts: ConfigurationDraft[], auth?: AuthContext): Promise<Configuration[]>;
|
|
262
|
+
/** Update one tenant configuration by key. */
|
|
263
|
+
update<T = unknown>(key: string, draft: ConfigurationDraft<T>, auth?: AuthContext): Promise<Configuration<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
|
+
|
|
173
291
|
/** The Emporix SDK entry point. One instance safely serves many concurrent shoppers. */
|
|
174
292
|
declare class EmporixClient {
|
|
175
293
|
readonly customers: CustomerService;
|
|
@@ -189,6 +307,9 @@ declare class EmporixClient {
|
|
|
189
307
|
readonly customerGroups: CustomerGroupsService;
|
|
190
308
|
readonly orders: OrdersService;
|
|
191
309
|
readonly salesOrders: SalesOrdersService;
|
|
310
|
+
readonly availability: AvailabilityService;
|
|
311
|
+
readonly tenantConfig: TenantConfigService;
|
|
312
|
+
readonly clientConfig: ClientConfigService;
|
|
192
313
|
/** The validated tenant this client is bound to. */
|
|
193
314
|
readonly tenant: string;
|
|
194
315
|
/**
|
|
@@ -215,4 +336,4 @@ declare class EmporixClient {
|
|
|
215
336
|
getLogLevel(service: ServiceName): LogLevel;
|
|
216
337
|
}
|
|
217
338
|
|
|
218
|
-
export { AuthContext, 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 };
|
|
339
|
+
export { AuthContext, AvailabilityService, CartService, CategoryService, CheckoutService, ClientConfigService, type ClientConfiguration, ClientContext, CompaniesService, type Configuration, type ConfigurationDraft, ContactsService, CustomerGroupsService, CustomerService, EmporixAuthError, EmporixClient, EmporixConfig, EmporixError, EmporixForbiddenError, EmporixInsufficientScopeError, EmporixNotFoundError, EmporixServerError, EmporixValidationError, type ListConfigOptions, LocationsService, LogLevel, MediaService, OrdersService, PaymentGatewayService, PriceService, ProductService, ResolvedConfig, SalesOrdersService, SegmentService, ServiceName, type SessionContext, type SessionContextPatch, SessionContextService, type Site, SiteService, TenantConfigService, TokenProvider, errorFromResponse };
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,14 @@ import { OrdersService, SalesOrdersService } from './chunk-6UNFMCHZ.js';
|
|
|
6
6
|
export { OrdersService, SalesOrdersService } from './chunk-6UNFMCHZ.js';
|
|
7
7
|
import { PaymentGatewayService } from './chunk-HKPZI7Y5.js';
|
|
8
8
|
export { PaymentGatewayService } from './chunk-HKPZI7Y5.js';
|
|
9
|
-
import { PriceService } from './chunk-
|
|
10
|
-
export { PriceService } from './chunk-
|
|
11
|
-
import { ProductService } from './chunk-
|
|
12
|
-
export { ProductService } from './chunk-
|
|
9
|
+
import { PriceService } from './chunk-SCI7D74B.js';
|
|
10
|
+
export { PriceService } from './chunk-SCI7D74B.js';
|
|
11
|
+
import { ProductService } from './chunk-5JHTZBOC.js';
|
|
12
|
+
export { ProductService } from './chunk-5JHTZBOC.js';
|
|
13
13
|
import { SegmentService } from './chunk-Z6PNI5VT.js';
|
|
14
14
|
export { SegmentService } from './chunk-Z6PNI5VT.js';
|
|
15
|
+
import { AvailabilityService } from './chunk-XMEP74BU.js';
|
|
16
|
+
export { AvailabilityService } from './chunk-XMEP74BU.js';
|
|
15
17
|
import { CartService } from './chunk-IEZHGU7F.js';
|
|
16
18
|
export { CartService } from './chunk-IEZHGU7F.js';
|
|
17
19
|
import { CategoryService } from './chunk-4BJUCCKJ.js';
|
|
@@ -705,12 +707,12 @@ var SessionContextService = class {
|
|
|
705
707
|
* update). Non-404 errors propagate.
|
|
706
708
|
*/
|
|
707
709
|
async patch(input, authCtx = ANON2) {
|
|
708
|
-
let
|
|
709
|
-
if (
|
|
710
|
+
let version2 = input.version;
|
|
711
|
+
if (version2 === void 0) {
|
|
710
712
|
const current = await this.get(authCtx);
|
|
711
713
|
if (current === null) return false;
|
|
712
|
-
|
|
713
|
-
if (
|
|
714
|
+
version2 = current.metadata?.version;
|
|
715
|
+
if (version2 === void 0) {
|
|
714
716
|
throw new Error(
|
|
715
717
|
"SessionContextService.patch: no metadata.version in server response"
|
|
716
718
|
);
|
|
@@ -722,7 +724,7 @@ var SessionContextService = class {
|
|
|
722
724
|
path: `/session-context/${this.ctx.tenant}/me/context`,
|
|
723
725
|
body: {
|
|
724
726
|
...fields,
|
|
725
|
-
metadata: { version }
|
|
727
|
+
metadata: { version: version2 }
|
|
726
728
|
},
|
|
727
729
|
auth: authCtx
|
|
728
730
|
});
|
|
@@ -737,8 +739,126 @@ function isNotFound(err) {
|
|
|
737
739
|
return false;
|
|
738
740
|
}
|
|
739
741
|
|
|
742
|
+
// src/services/tenant-config.ts
|
|
743
|
+
var SERVICE = { kind: "service" };
|
|
744
|
+
var TenantConfigService = class {
|
|
745
|
+
constructor(ctx) {
|
|
746
|
+
this.ctx = ctx;
|
|
747
|
+
}
|
|
748
|
+
ctx;
|
|
749
|
+
base() {
|
|
750
|
+
return `/configuration/${this.ctx.tenant}/configurations`;
|
|
751
|
+
}
|
|
752
|
+
/** List tenant configurations, optionally filtered by `keys`. */
|
|
753
|
+
async list(opts = {}, auth2 = SERVICE) {
|
|
754
|
+
const query = opts.keys && opts.keys.length > 0 ? { keys: opts.keys.join(",") } : void 0;
|
|
755
|
+
return this.ctx.http.request({
|
|
756
|
+
method: "GET",
|
|
757
|
+
path: this.base(),
|
|
758
|
+
auth: auth2,
|
|
759
|
+
...query ? { query } : {}
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
/** Retrieve one tenant configuration by key. */
|
|
763
|
+
async get(key, auth2 = SERVICE) {
|
|
764
|
+
return this.ctx.http.request({
|
|
765
|
+
method: "GET",
|
|
766
|
+
path: `${this.base()}/${encodeURIComponent(key)}`,
|
|
767
|
+
auth: auth2
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
/** Create one or more tenant configurations (array in, array out). */
|
|
771
|
+
async create(drafts, auth2 = SERVICE) {
|
|
772
|
+
return this.ctx.http.request({
|
|
773
|
+
method: "POST",
|
|
774
|
+
path: this.base(),
|
|
775
|
+
auth: auth2,
|
|
776
|
+
body: drafts
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
/** Update one tenant configuration by key. */
|
|
780
|
+
async update(key, draft, auth2 = SERVICE) {
|
|
781
|
+
return this.ctx.http.request({
|
|
782
|
+
method: "PUT",
|
|
783
|
+
path: `${this.base()}/${encodeURIComponent(key)}`,
|
|
784
|
+
auth: auth2,
|
|
785
|
+
body: draft
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
/** Delete one tenant configuration by key. */
|
|
789
|
+
async delete(key, auth2 = SERVICE) {
|
|
790
|
+
await this.ctx.http.request({
|
|
791
|
+
method: "DELETE",
|
|
792
|
+
path: `${this.base()}/${encodeURIComponent(key)}`,
|
|
793
|
+
auth: auth2
|
|
794
|
+
});
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
// src/services/client-config.ts
|
|
799
|
+
var SERVICE2 = { kind: "service" };
|
|
800
|
+
var ClientConfigService = class {
|
|
801
|
+
constructor(ctx) {
|
|
802
|
+
this.ctx = ctx;
|
|
803
|
+
}
|
|
804
|
+
ctx;
|
|
805
|
+
base(client) {
|
|
806
|
+
return `/configuration/${this.ctx.tenant}/clients/${encodeURIComponent(client)}/configurations`;
|
|
807
|
+
}
|
|
808
|
+
/** List a client's configurations, optionally filtered by `keys`. */
|
|
809
|
+
async list(client, opts = {}, auth2 = SERVICE2) {
|
|
810
|
+
const query = opts.keys && opts.keys.length > 0 ? { keys: opts.keys.join(",") } : void 0;
|
|
811
|
+
return this.ctx.http.request({
|
|
812
|
+
method: "GET",
|
|
813
|
+
path: this.base(client),
|
|
814
|
+
auth: auth2,
|
|
815
|
+
...query ? { query } : {}
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
/** Retrieve one client configuration by key. */
|
|
819
|
+
async get(client, key, auth2 = SERVICE2) {
|
|
820
|
+
return this.ctx.http.request({
|
|
821
|
+
method: "GET",
|
|
822
|
+
path: `${this.base(client)}/${encodeURIComponent(key)}`,
|
|
823
|
+
auth: auth2
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
/** Create one or more client configurations. Injects `client` into each item. */
|
|
827
|
+
async create(client, drafts, auth2 = SERVICE2) {
|
|
828
|
+
const body = drafts.map((d) => ({ ...d, client }));
|
|
829
|
+
return this.ctx.http.request({
|
|
830
|
+
method: "POST",
|
|
831
|
+
path: this.base(client),
|
|
832
|
+
auth: auth2,
|
|
833
|
+
body
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
/** Update one client configuration by key. Injects `client` into the body. */
|
|
837
|
+
async update(client, key, draft, auth2 = SERVICE2) {
|
|
838
|
+
return this.ctx.http.request({
|
|
839
|
+
method: "PUT",
|
|
840
|
+
path: `${this.base(client)}/${encodeURIComponent(key)}`,
|
|
841
|
+
auth: auth2,
|
|
842
|
+
body: { ...draft, client }
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
/** Delete one client configuration by key. */
|
|
846
|
+
async delete(client, key, auth2 = SERVICE2) {
|
|
847
|
+
await this.ctx.http.request({
|
|
848
|
+
method: "DELETE",
|
|
849
|
+
path: `${this.base(client)}/${encodeURIComponent(key)}`,
|
|
850
|
+
auth: auth2
|
|
851
|
+
});
|
|
852
|
+
}
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
// package.json
|
|
856
|
+
var version = "2.2.0";
|
|
857
|
+
|
|
858
|
+
// src/version.ts
|
|
859
|
+
var SDK_VERSION = version;
|
|
860
|
+
|
|
740
861
|
// src/client.ts
|
|
741
|
-
var SDK_VERSION = "0.0.0";
|
|
742
862
|
var EmporixClient = class {
|
|
743
863
|
customers;
|
|
744
864
|
products;
|
|
@@ -757,6 +877,9 @@ var EmporixClient = class {
|
|
|
757
877
|
customerGroups;
|
|
758
878
|
orders;
|
|
759
879
|
salesOrders;
|
|
880
|
+
availability;
|
|
881
|
+
tenantConfig;
|
|
882
|
+
clientConfig;
|
|
760
883
|
/** The validated tenant this client is bound to. */
|
|
761
884
|
tenant;
|
|
762
885
|
/**
|
|
@@ -826,6 +949,9 @@ var EmporixClient = class {
|
|
|
826
949
|
this.customerGroups = new CustomerGroupsService(mk("iam"));
|
|
827
950
|
this.orders = new OrdersService(mk("orders"));
|
|
828
951
|
this.salesOrders = new SalesOrdersService(mk("sales-orders"));
|
|
952
|
+
this.availability = new AvailabilityService(mk("availability"));
|
|
953
|
+
this.tenantConfig = new TenantConfigService(mk("configuration"));
|
|
954
|
+
this.clientConfig = new ClientConfigService(mk("configuration"));
|
|
829
955
|
}
|
|
830
956
|
/** Sets the runtime log level globally or for one service. */
|
|
831
957
|
setLogLevel(level, opts = {}) {
|
|
@@ -837,6 +963,6 @@ var EmporixClient = class {
|
|
|
837
963
|
}
|
|
838
964
|
};
|
|
839
965
|
|
|
840
|
-
export { DEFAULT_HOST, DefaultTokenProvider, EmporixClient, HttpClient, LEVEL, LevelResolver, SessionContextService, SiteService, auth, createConsoleLogger, createNoopLogger, redact, resolveToken, validateConfig };
|
|
966
|
+
export { ClientConfigService, DEFAULT_HOST, DefaultTokenProvider, EmporixClient, HttpClient, LEVEL, LevelResolver, SessionContextService, SiteService, TenantConfigService, auth, createConsoleLogger, createNoopLogger, redact, resolveToken, validateConfig };
|
|
841
967
|
//# sourceMappingURL=index.js.map
|
|
842
968
|
//# sourceMappingURL=index.js.map
|