@viu/emporix-sdk 2.1.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 +20 -0
- package/dist/availability.d.cts +1 -1
- package/dist/availability.d.ts +1 -1
- package/dist/cart.d.cts +1 -1
- package/dist/cart.d.ts +1 -1
- package/dist/category.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-JTJV7WUW.js → chunk-5JHTZBOC.js} +42 -2
- package/dist/chunk-5JHTZBOC.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-CGuxSb56.d.cts → context-Bs5ZSwds.d.cts} +1 -1
- package/dist/{context-CGuxSb56.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 +170 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +121 -3
- package/dist/index.d.ts +121 -3
- package/dist/index.js +131 -9
- 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.cjs +40 -0
- package/dist/product.cjs.map +1 -1
- package/dist/product.d.cts +14 -1
- package/dist/product.d.ts +14 -1
- package/dist/product.js +1 -1
- package/dist/segment.d.cts +1 -1
- package/dist/segment.d.ts +1 -1
- package/package.json +1 -1
- 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-
|
|
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';
|
|
@@ -172,6 +172,122 @@ 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<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
|
+
|
|
175
291
|
/** The Emporix SDK entry point. One instance safely serves many concurrent shoppers. */
|
|
176
292
|
declare class EmporixClient {
|
|
177
293
|
readonly customers: CustomerService;
|
|
@@ -192,6 +308,8 @@ declare class EmporixClient {
|
|
|
192
308
|
readonly orders: OrdersService;
|
|
193
309
|
readonly salesOrders: SalesOrdersService;
|
|
194
310
|
readonly availability: AvailabilityService;
|
|
311
|
+
readonly tenantConfig: TenantConfigService;
|
|
312
|
+
readonly clientConfig: ClientConfigService;
|
|
195
313
|
/** The validated tenant this client is bound to. */
|
|
196
314
|
readonly tenant: string;
|
|
197
315
|
/**
|
|
@@ -218,4 +336,4 @@ declare class EmporixClient {
|
|
|
218
336
|
getLogLevel(service: ServiceName): LogLevel;
|
|
219
337
|
}
|
|
220
338
|
|
|
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 };
|
|
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';
|
|
@@ -172,6 +172,122 @@ 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<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
|
+
|
|
175
291
|
/** The Emporix SDK entry point. One instance safely serves many concurrent shoppers. */
|
|
176
292
|
declare class EmporixClient {
|
|
177
293
|
readonly customers: CustomerService;
|
|
@@ -192,6 +308,8 @@ declare class EmporixClient {
|
|
|
192
308
|
readonly orders: OrdersService;
|
|
193
309
|
readonly salesOrders: SalesOrdersService;
|
|
194
310
|
readonly availability: AvailabilityService;
|
|
311
|
+
readonly tenantConfig: TenantConfigService;
|
|
312
|
+
readonly clientConfig: ClientConfigService;
|
|
195
313
|
/** The validated tenant this client is bound to. */
|
|
196
314
|
readonly tenant: string;
|
|
197
315
|
/**
|
|
@@ -218,4 +336,4 @@ declare class EmporixClient {
|
|
|
218
336
|
getLogLevel(service: ServiceName): LogLevel;
|
|
219
337
|
}
|
|
220
338
|
|
|
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 };
|
|
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
|
@@ -8,8 +8,8 @@ import { PaymentGatewayService } from './chunk-HKPZI7Y5.js';
|
|
|
8
8
|
export { PaymentGatewayService } from './chunk-HKPZI7Y5.js';
|
|
9
9
|
import { PriceService } from './chunk-SCI7D74B.js';
|
|
10
10
|
export { PriceService } from './chunk-SCI7D74B.js';
|
|
11
|
-
import { ProductService } from './chunk-
|
|
12
|
-
export { ProductService } from './chunk-
|
|
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
15
|
import { AvailabilityService } from './chunk-XMEP74BU.js';
|
|
@@ -707,12 +707,12 @@ var SessionContextService = class {
|
|
|
707
707
|
* update). Non-404 errors propagate.
|
|
708
708
|
*/
|
|
709
709
|
async patch(input, authCtx = ANON2) {
|
|
710
|
-
let
|
|
711
|
-
if (
|
|
710
|
+
let version2 = input.version;
|
|
711
|
+
if (version2 === void 0) {
|
|
712
712
|
const current = await this.get(authCtx);
|
|
713
713
|
if (current === null) return false;
|
|
714
|
-
|
|
715
|
-
if (
|
|
714
|
+
version2 = current.metadata?.version;
|
|
715
|
+
if (version2 === void 0) {
|
|
716
716
|
throw new Error(
|
|
717
717
|
"SessionContextService.patch: no metadata.version in server response"
|
|
718
718
|
);
|
|
@@ -724,7 +724,7 @@ var SessionContextService = class {
|
|
|
724
724
|
path: `/session-context/${this.ctx.tenant}/me/context`,
|
|
725
725
|
body: {
|
|
726
726
|
...fields,
|
|
727
|
-
metadata: { version }
|
|
727
|
+
metadata: { version: version2 }
|
|
728
728
|
},
|
|
729
729
|
auth: authCtx
|
|
730
730
|
});
|
|
@@ -739,8 +739,126 @@ function isNotFound(err) {
|
|
|
739
739
|
return false;
|
|
740
740
|
}
|
|
741
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
|
+
|
|
742
861
|
// src/client.ts
|
|
743
|
-
var SDK_VERSION = "0.0.0";
|
|
744
862
|
var EmporixClient = class {
|
|
745
863
|
customers;
|
|
746
864
|
products;
|
|
@@ -760,6 +878,8 @@ var EmporixClient = class {
|
|
|
760
878
|
orders;
|
|
761
879
|
salesOrders;
|
|
762
880
|
availability;
|
|
881
|
+
tenantConfig;
|
|
882
|
+
clientConfig;
|
|
763
883
|
/** The validated tenant this client is bound to. */
|
|
764
884
|
tenant;
|
|
765
885
|
/**
|
|
@@ -830,6 +950,8 @@ var EmporixClient = class {
|
|
|
830
950
|
this.orders = new OrdersService(mk("orders"));
|
|
831
951
|
this.salesOrders = new SalesOrdersService(mk("sales-orders"));
|
|
832
952
|
this.availability = new AvailabilityService(mk("availability"));
|
|
953
|
+
this.tenantConfig = new TenantConfigService(mk("configuration"));
|
|
954
|
+
this.clientConfig = new ClientConfigService(mk("configuration"));
|
|
833
955
|
}
|
|
834
956
|
/** Sets the runtime log level globally or for one service. */
|
|
835
957
|
setLogLevel(level, opts = {}) {
|
|
@@ -841,6 +963,6 @@ var EmporixClient = class {
|
|
|
841
963
|
}
|
|
842
964
|
};
|
|
843
965
|
|
|
844
|
-
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 };
|
|
845
967
|
//# sourceMappingURL=index.js.map
|
|
846
968
|
//# sourceMappingURL=index.js.map
|