@viu/emporix-sdk 4.1.0 → 4.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 +29 -0
- package/README.md +1 -0
- package/dist/cart.cjs +85 -0
- package/dist/cart.cjs.map +1 -1
- package/dist/cart.d.cts +352 -1
- package/dist/cart.d.ts +352 -1
- package/dist/cart.js +1 -1
- package/dist/{chunk-YVZ6GOLE.js → chunk-S2ERKGYL.js} +48 -3
- package/dist/chunk-S2ERKGYL.js.map +1 -0
- package/dist/index.cjs +46 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +78 -7
- package/dist/index.d.ts +78 -7
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-YVZ6GOLE.js.map +0 -1
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/services/cart.ts"],"names":[],"mappings":";;;AAsEA,SAAS,gBAAgB,IAAA,EAA4C;AACnE,EAAA,IAAI,SAAS,IAAA,CAAK,IAAA,KAAS,cAAc,IAAA,CAAK,IAAA,KAAS,cAAc,OAAO,IAAA;AAC5E,EAAA,MAAM,IAAI,sBAAA;AAAA,IACR;AAAA,GACF;AACF;AAEA,SAAS,oBAAoB,IAAA,EAA4C;AACvE,EAAA,IAAI,IAAA,IAAQ,IAAA,CAAK,IAAA,KAAS,UAAA,EAAY,OAAO,IAAA;AAC7C,EAAA,MAAM,IAAI,uBAAuB,wDAAwD,CAAA;AAC3F;AAGO,IAAM,cAAN,MAAkB;AAAA,EAEvB,YAA6B,GAAA,EAAoB;AAApB,IAAA,IAAA,CAAA,GAAA,GAAA,GAAA;AAAA,EAAqB;AAAA,EAArB,GAAA;AAAA,EAD7B,OAAgB,OAAA,GAAU,MAAA;AAAA,EAGlB,IAAA,GAAe;AACrB,IAAA,OAAO,CAAA,MAAA,EAAS,IAAA,CAAK,GAAA,CAAI,MAA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;AACD,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,MAAA,EAAQ,QAAQ,CAAA;AAAA,EAClC;AAAA;AAAA,EAGA,MAAM,uBAAA,CAAwB,MAAA,EAAgB,IAAA,EAAsD;AAClG,IAAA,OAAO,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAkC;AAAA,MACrD,MAAA,EAAQ,KAAA;AAAA,MACR,MAAM,CAAA,EAAG,IAAA,CAAK,IAAA,EAAM,IAAI,MAAM,CAAA,eAAA,CAAA;AAAA,MAC9B,IAAA,EAAM,gBAAgB,IAAI;AAAA,KAC3B,CAAA;AAAA,EACH;AACF","file":"chunk-YVZ6GOLE.js","sourcesContent":["import type { ClientContext } from \"../core/context\";\nimport type { AuthContext } from \"../core/auth\";\nimport { EmporixNotFoundError, EmporixValidationError } from \"../core/errors\";\nimport type {\n Cart as GeneratedCart,\n CreateCart,\n CreatedCart,\n CartItemRequest,\n UpdateCartItem,\n AddressRequest,\n AppliedDiscount,\n BatchResponse as GeneratedBatchResponse,\n SingleBatchResponse as GeneratedSingleBatchResponse,\n CartValidationResult as GeneratedCartValidationResult,\n CartItemResponse,\n CartItemsBatchUpdateRequest,\n CartItemsBatchUpdateResponse,\n Search,\n CartGetAll,\n UpdateCart,\n DiscountResponse,\n CartDtRestrictions,\n} from \"../generated/cart\";\n\n/** A cart as returned by the Cart service (all generated fields). */\nexport type Cart = GeneratedCart;\n\n/** The cart-create response (`{ cartId, yrn }`, generated). */\nexport type CartCreated = CreatedCart;\n\n/** Generated request bodies (caller sends the exact wire shape). */\nexport type CreateCartInput = CreateCart;\nexport type CartItemInput = CartItemRequest;\nexport type CartItemUpdate = UpdateCartItem;\n\n/** Per-entry result of `addItemsBatch`. `status` is HTTP-style per entry (e.g. 201 = added, 4xx = failed). */\nexport type CartItemBatchEntry = GeneratedSingleBatchResponse;\n/** Response shape of `addItemsBatch` — one entry per input item, matching by `index`. */\nexport type CartItemsBatchResponse = GeneratedBatchResponse;\n\n/** An address payload for cart shipping/billing (generated). */\nexport type CartAddress = AddressRequest;\n\n/** Result of validating a cart's items (generated). */\nexport type CartValidationResult = GeneratedCartValidationResult;\n\n/** A single cart item as returned by the Cart service (generated). */\nexport type CartItem = CartItemResponse;\n\n/** Request body for updating multiple cart items (generated). */\nexport type CartItemsBatchUpdateInput = CartItemsBatchUpdateRequest;\n\n/** Per-entry response for a multi-item update (generated). */\nexport type CartItemsBatchUpdateResult = CartItemsBatchUpdateResponse;\n\n/** Body for searching carts (`POST /carts/search`) — a `q` filter. */\nexport type CartSearchInput = Search;\n\n/** A cart summary as returned by `POST /carts/search`. */\nexport type CartSummary = CartGetAll;\n\n/** Body for a full cart update (`PUT /carts/{id}`). */\nexport type CartUpdateInput = UpdateCart;\n\n/** A discount entry as returned by `GET /carts/{id}/discounts`. */\nexport type CartDiscount = DiscountResponse;\n\n/** Lead-time and non-delivery-time restrictions for a cart (`GET …/dtRestrictions`). */\nexport type CartDeliveryRestrictions = CartDtRestrictions;\n\nfunction requireCartAuth(auth: AuthContext | undefined): AuthContext {\n if (auth && (auth.kind === \"customer\" || auth.kind === \"anonymous\")) return auth;\n throw new EmporixValidationError(\n \"CartService requires an explicit { kind: 'customer' } or { kind: 'anonymous' } AuthContext\",\n );\n}\n\nfunction requireCustomerAuth(auth: AuthContext | undefined): AuthContext {\n if (auth && auth.kind === \"customer\") return auth;\n throw new EmporixValidationError(\"cart.merge requires a { kind: 'customer' } AuthContext\");\n}\n\n/** Cart operations. Every method requires an explicit customer/anonymous context. */\nexport class CartService {\n static readonly channel = \"cart\" as const;\n constructor(private readonly ctx: ClientContext) {}\n\n private base(): string {\n return `/cart/${this.ctx.tenant}/carts`;\n }\n\n /** Creates a cart. */\n async create(\n input: CreateCartInput | undefined,\n auth: AuthContext,\n ): Promise<CartCreated> {\n return this.ctx.http.request<CartCreated>({\n method: \"POST\",\n path: this.base(),\n auth: requireCartAuth(auth),\n body: input ?? {},\n });\n }\n\n /** Fetches a cart by id. */\n async get(cartId: string, auth: AuthContext): Promise<Cart> {\n return this.ctx.http.request<Cart>({\n method: \"GET\",\n path: `${this.base()}/${cartId}`,\n auth: requireCartAuth(auth),\n });\n }\n\n /** Returns the current cart for the session, or null if none. */\n /**\n * Get the customer / anonymous cart matching the given criteria. Per Emporix:\n * uniqueness is defined by `siteCode` + `type` + `legalEntityId` +\n * (`customerId` derived from a customer token, or `sessionId` derived from an\n * anonymous token). With `create: true`, Emporix creates a new cart if none\n * matches.\n *\n * Returns `null` on 404 (no cart found and `create` was not set). All other\n * errors are propagated.\n */\n async getCurrent(\n auth: AuthContext,\n opts: { siteCode: string; type?: string; legalEntityId?: string; create?: boolean },\n ): Promise<Cart | null> {\n const query: Record<string, string | number> = { siteCode: opts.siteCode };\n if (opts.type !== undefined) query.type = opts.type;\n if (opts.legalEntityId !== undefined) query.legalEntityId = opts.legalEntityId;\n if (opts.create) query.create = \"true\";\n try {\n return await this.ctx.http.request<Cart>({\n method: \"GET\",\n path: this.base(),\n query,\n auth: requireCartAuth(auth),\n });\n } catch (e) {\n if (e instanceof EmporixNotFoundError) return null;\n throw e;\n }\n }\n\n /** Adds an item. */\n async addItem(\n cartId: string,\n item: CartItemInput,\n auth: AuthContext,\n ): Promise<Cart> {\n return this.ctx.http.request<Cart>({\n method: \"POST\",\n path: `${this.base()}/${cartId}/items`,\n auth: requireCartAuth(auth),\n body: item,\n });\n }\n\n /**\n * Adds multiple items in a single request via `POST /carts/{id}/itemsBatch`.\n * Server-side limit is 200 entries per call — callers handling larger sets\n * must chunk. The response carries a per-entry `status` (HTTP-style: 201\n * for added, 4xx/5xx for failed) and `index` matching the input position;\n * partial failures do **not** throw — inspect `status` per entry.\n */\n async addItemsBatch(\n cartId: string,\n items: CartItemInput[],\n auth: AuthContext,\n ): Promise<CartItemsBatchResponse> {\n return this.ctx.http.request<CartItemsBatchResponse>({\n method: \"POST\",\n path: `${this.base()}/${cartId}/itemsBatch`,\n auth: requireCartAuth(auth),\n body: items,\n });\n }\n\n /**\n * Updates an item. By default this is a **full replace** — the server expects\n * the complete item (e.g. `itemYrn` + the `price` row). Pass\n * `{ partial: true }` to send a **partial update** (`?partial=true`), e.g. a\n * quantity-only change with just `{ quantity }`.\n */\n async updateItem(\n cartId: string,\n itemId: string,\n patch: CartItemUpdate,\n auth: AuthContext,\n opts: { partial?: boolean } = {},\n ): Promise<Cart> {\n return this.ctx.http.request<Cart>({\n method: \"PUT\",\n path: `${this.base()}/${cartId}/items/${itemId}`,\n auth: requireCartAuth(auth),\n body: patch,\n ...(opts.partial ? { query: { partial: \"true\" } } : {}),\n });\n }\n\n /** Removes an item. */\n async removeItem(cartId: string, itemId: string, auth: AuthContext): Promise<Cart> {\n return this.ctx.http.request<Cart>({\n method: \"DELETE\",\n path: `${this.base()}/${cartId}/items/${itemId}`,\n auth: requireCartAuth(auth),\n });\n }\n\n /** Empties the cart. */\n async clear(cartId: string, auth: AuthContext): Promise<Cart> {\n return this.ctx.http.request<Cart>({\n method: \"DELETE\",\n path: `${this.base()}/${cartId}/items`,\n auth: requireCartAuth(auth),\n });\n }\n\n /**\n * Applies a coupon by code. Coupon application goes through the cart's\n * `discounts` endpoint (`POST …/discounts` with a coupon-code-only payload) —\n * the live API has no `…/coupons` path. The apply response only carries the\n * applied-discount reference (`{ discountId, discountIndex }`), so the updated\n * cart is re-fetched and returned to preserve the `Cart` contract.\n */\n async applyCoupon(cartId: string, code: string, auth: AuthContext): Promise<Cart> {\n const cartAuth = requireCartAuth(auth);\n await this.ctx.http.request<AppliedDiscount>({\n method: \"POST\",\n path: `${this.base()}/${cartId}/discounts`,\n auth: cartAuth,\n body: { code },\n });\n return this.get(cartId, cartAuth);\n }\n\n /**\n * Removes a coupon by code via `DELETE …/discounts?codes=<code>` — the live\n * API has no `…/coupons/<code>` path. The delete responds 204 No Content, so\n * the updated cart is re-fetched and returned.\n */\n async removeCoupon(cartId: string, code: string, auth: AuthContext): Promise<Cart> {\n const cartAuth = requireCartAuth(auth);\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/${cartId}/discounts`,\n query: { codes: code },\n auth: cartAuth,\n });\n return this.get(cartId, cartAuth);\n }\n\n /** Validates the cart's items (pricing/consistency checks). */\n async validate(cartId: string, auth: AuthContext): Promise<CartValidationResult> {\n return this.ctx.http.request<CartValidationResult>({\n method: \"GET\",\n path: `${this.base()}/${cartId}/validate`,\n auth: requireCartAuth(auth),\n });\n }\n\n /** Lists the items in a cart with calculated prices. */\n async listItems(cartId: string, auth: AuthContext): Promise<CartItem[]> {\n return this.ctx.http.request<CartItem[]>({\n method: \"GET\",\n path: `${this.base()}/${cartId}/items`,\n auth: requireCartAuth(auth),\n });\n }\n\n /** Refreshes a cart and its items (re-prices), then returns the updated cart. */\n async refresh(cartId: string, auth: AuthContext): Promise<Cart> {\n const cartAuth = requireCartAuth(auth);\n await this.ctx.http.request<void>({\n method: \"PUT\",\n path: `${this.base()}/${cartId}/refresh`,\n auth: cartAuth,\n });\n return this.get(cartId, cartAuth);\n }\n\n /** Changes the cart's site (re-prices to the new site's currency), then returns the updated cart. */\n async changeSite(cartId: string, siteCode: string, auth: AuthContext): Promise<Cart> {\n const cartAuth = requireCartAuth(auth);\n await this.ctx.http.request<void>({\n method: \"POST\",\n path: `${this.base()}/${cartId}/changeSite`,\n auth: cartAuth,\n body: { siteCode },\n });\n return this.get(cartId, cartAuth);\n }\n\n /** Changes the cart's currency (re-prices), then returns the updated cart. */\n async changeCurrency(cartId: string, currency: string, auth: AuthContext): Promise<Cart> {\n const cartAuth = requireCartAuth(auth);\n await this.ctx.http.request<void>({\n method: \"POST\",\n path: `${this.base()}/${cartId}/changeCurrency`,\n auth: cartAuth,\n body: { currency },\n });\n return this.get(cartId, cartAuth);\n }\n\n /**\n * Updates multiple cart items in one request (`PUT …/itemsBatch`). Like\n * `addItemsBatch`, the response carries a per-entry `status`; partial failures\n * do not throw — inspect each entry.\n */\n async updateItemsBatch(\n cartId: string,\n items: CartItemsBatchUpdateInput,\n auth: AuthContext,\n ): Promise<CartItemsBatchUpdateResult> {\n return this.ctx.http.request<CartItemsBatchUpdateResult>({\n method: \"PUT\",\n path: `${this.base()}/${cartId}/itemsBatch`,\n auth: requireCartAuth(auth),\n body: items,\n });\n }\n\n /**\n * Sets the cart's shipping address, preserving the billing address.\n *\n * The API has no per-type address endpoint: addresses live in the cart's\n * `addresses` array, written via `PUT /carts/{cartId}`. That array is a **full\n * replace** — sending only one type leaves the other as an empty stub — so\n * this method reads the cart, merges, writes, and re-fetches. Use\n * {@link setAddresses} to set both in a single request.\n */\n async setShippingAddress(\n cartId: string,\n address: CartAddress,\n auth: AuthContext,\n ): Promise<Cart> {\n return this.mergeAddress(cartId, address, \"SHIPPING\", requireCartAuth(auth));\n }\n\n /**\n * Sets the cart's billing address, preserving the shipping address. See\n * {@link setShippingAddress} for why this reads before writing.\n */\n async setBillingAddress(\n cartId: string,\n address: CartAddress,\n auth: AuthContext,\n ): Promise<Cart> {\n return this.mergeAddress(cartId, address, \"BILLING\", requireCartAuth(auth));\n }\n\n /**\n * Sets both cart addresses in one request (`PUT /carts/{cartId}`), skipping\n * the read that {@link setShippingAddress} needs.\n *\n * **This replaces the cart's address set**: a type you omit is cleared, and\n * `{}` clears both. Use it when you already hold both addresses (a checkout\n * form submitting them together); use the per-type setters to change one and\n * keep the other.\n */\n async setAddresses(\n cartId: string,\n addresses: { shipping?: CartAddress; billing?: CartAddress },\n auth: AuthContext,\n ): Promise<Cart> {\n const cartAuth = requireCartAuth(auth);\n const next: CartAddress[] = [];\n if (addresses.shipping) next.push({ ...addresses.shipping, type: \"SHIPPING\" });\n if (addresses.billing) next.push({ ...addresses.billing, type: \"BILLING\" });\n await this.ctx.http.request<void>({\n method: \"PUT\",\n path: `${this.base()}/${cartId}`,\n auth: cartAuth,\n body: { addresses: next },\n });\n return this.get(cartId, cartAuth);\n }\n\n /**\n * Reads the cart, replaces the entry of `type` with `address` (keeping every\n * other type verbatim — resending it unchanged is what stops the server from\n * wiping it), writes, and returns the re-fetched cart.\n */\n private async mergeAddress(\n cartId: string,\n address: CartAddress,\n type: \"SHIPPING\" | \"BILLING\",\n cartAuth: AuthContext,\n ): Promise<Cart> {\n const current = await this.get(cartId, cartAuth);\n const others = (current.addresses ?? []).filter((a) => a.type !== type);\n await this.ctx.http.request<void>({\n method: \"PUT\",\n path: `${this.base()}/${cartId}`,\n auth: cartAuth,\n body: { addresses: [...others, { ...address, type }] },\n });\n return this.get(cartId, cartAuth);\n }\n\n /**\n * Merges one or more anonymous carts into the specified customer cart.\n * Per Emporix: the target cart in the path **must belong to the logged-in\n * customer**, and each id in `anonymousCartIds` must belong to an anonymous\n * customer. Anonymous carts go `CLOSED` on success.\n *\n * Requires a customer `AuthContext`.\n */\n async merge(\n customerCartId: string,\n anonymousCartIds: string[],\n auth: AuthContext,\n ): Promise<Cart> {\n return this.ctx.http.request<Cart>({\n method: \"POST\",\n path: `${this.base()}/${customerCartId}/merge`,\n auth: requireCustomerAuth(auth),\n body: { carts: anonymousCartIds },\n });\n }\n\n /**\n * Searches carts tenant-wide (`POST /carts/search`, body `{ q }`). This is a\n * backend/admin operation — a customer token cannot scan other customers'\n * carts, so `auth` is forwarded unguarded (pass a service token for admin\n * use). The server enforces scope (403 on insufficient).\n */\n async search(\n query: CartSearchInput,\n auth: AuthContext,\n params: { pageNumber?: number; pageSize?: number; sort?: string; fields?: string } = {},\n ): Promise<CartSummary[]> {\n return this.ctx.http.request<CartSummary[]>({\n method: \"POST\",\n path: `${this.base()}/search`,\n query: {\n ...(params.pageNumber === undefined ? {} : { pageNumber: params.pageNumber }),\n ...(params.pageSize === undefined ? {} : { pageSize: params.pageSize }),\n ...(params.sort === undefined ? {} : { sort: params.sort }),\n ...(params.fields === undefined ? {} : { fields: params.fields }),\n },\n body: query,\n idempotent: true, // pure read over POST — safe to replay on 5xx/429\n auth,\n });\n }\n\n /**\n * Deletes a cart (`DELETE /carts/{cartId}`). Backend/admin or owner\n * operation — `auth` is forwarded unguarded (service or customer). Returns\n * nothing; the cart no longer exists.\n */\n async delete(cartId: string, auth: AuthContext): Promise<void> {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/${cartId}`,\n auth,\n });\n }\n\n /**\n * Full-updates a cart (`PUT /carts/{cartId}`, body `UpdateCart`). Backend or\n * owner operation — `auth` is forwarded unguarded. The endpoint returns 204,\n * so the cart is re-fetched with the same `auth` (via a direct GET, not\n * `get()`, so a service token is not rejected by the cart-auth guard) and\n * returned.\n */\n async update(cartId: string, input: CartUpdateInput, auth: AuthContext): Promise<Cart> {\n await this.ctx.http.request<void>({\n method: \"PUT\",\n path: `${this.base()}/${cartId}`,\n auth,\n body: input,\n });\n return this.ctx.http.request<Cart>({\n method: \"GET\",\n path: `${this.base()}/${cartId}`,\n auth,\n });\n }\n\n /** Fetches a single cart item's details (`GET /carts/{cartId}/items/{itemId}`). */\n async getItem(cartId: string, itemId: string, auth: AuthContext): Promise<CartItem> {\n return this.ctx.http.request<CartItem>({\n method: \"GET\",\n path: `${this.base()}/${cartId}/items/${itemId}`,\n auth: requireCartAuth(auth),\n });\n }\n\n /** Lists the discounts applied to a cart (`GET /carts/{cartId}/discounts`). */\n async listDiscounts(cartId: string, auth: AuthContext): Promise<CartDiscount[]> {\n return this.ctx.http.request<CartDiscount[]>({\n method: \"GET\",\n path: `${this.base()}/${cartId}/discounts`,\n auth: requireCartAuth(auth),\n });\n }\n\n /**\n * Removes all discounts from a cart (`DELETE /carts/{cartId}/discounts` with\n * no `codes` filter), then re-fetches and returns the updated cart. Use\n * `removeCoupon(code)` to remove a specific coupon by code.\n */\n async removeAllDiscounts(cartId: string, auth: AuthContext): Promise<Cart> {\n const cartAuth = requireCartAuth(auth);\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/${cartId}/discounts`,\n auth: cartAuth,\n });\n return this.get(cartId, cartAuth);\n }\n\n /**\n * Removes a single discount by its index (`DELETE\n * /carts/{cartId}/discounts/{discountIndex}`), then re-fetches and returns\n * the updated cart.\n */\n async removeDiscountByIndex(cartId: string, discountIndex: string, auth: AuthContext): Promise<Cart> {\n const cartAuth = requireCartAuth(auth);\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `${this.base()}/${cartId}/discounts/${discountIndex}`,\n auth: cartAuth,\n });\n return this.get(cartId, cartAuth);\n }\n\n /** Retrieves the cart's lead-time and non-delivery-time restrictions (`GET /carts/{cartId}/dtRestrictions`). */\n async getDeliveryRestrictions(cartId: string, auth: AuthContext): Promise<CartDeliveryRestrictions> {\n return this.ctx.http.request<CartDeliveryRestrictions>({\n method: \"GET\",\n path: `${this.base()}/${cartId}/dtRestrictions`,\n auth: requireCartAuth(auth),\n });\n }\n}\n"]}
|