@viu/emporix-sdk 4.6.7 → 4.7.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/dist/availability.cjs.map +1 -1
- package/dist/availability.js +2 -2
- package/dist/cart.cjs +3 -0
- package/dist/cart.cjs.map +1 -1
- package/dist/cart.js +2 -2
- package/dist/checkout.cjs.map +1 -1
- package/dist/checkout.js +2 -2
- package/dist/{chunk-J2AN2FMK.js → chunk-3JO2O4BY.js} +25 -14
- package/dist/chunk-3JO2O4BY.js.map +1 -0
- package/dist/{chunk-UWGGF4MC.js → chunk-4Q76UV4J.js} +6 -3
- package/dist/chunk-4Q76UV4J.js.map +1 -0
- package/dist/{chunk-RYQVMR26.js → chunk-BHNYGUSD.js} +3 -3
- package/dist/{chunk-RYQVMR26.js.map → chunk-BHNYGUSD.js.map} +1 -1
- package/dist/{chunk-IYNT5BQW.js → chunk-CXTVY4SI.js} +8 -4
- package/dist/chunk-CXTVY4SI.js.map +1 -0
- package/dist/{chunk-K4KXT6NX.js → chunk-ENMMDGUB.js} +3 -3
- package/dist/{chunk-K4KXT6NX.js.map → chunk-ENMMDGUB.js.map} +1 -1
- package/dist/{chunk-UA4BM6OP.js → chunk-EQE5WGME.js} +4 -4
- package/dist/{chunk-UA4BM6OP.js.map → chunk-EQE5WGME.js.map} +1 -1
- package/dist/{chunk-4VRUMCS2.js → chunk-PK4DQHJO.js} +4 -4
- package/dist/{chunk-4VRUMCS2.js.map → chunk-PK4DQHJO.js.map} +1 -1
- package/dist/{chunk-NFSO7WUA.js → chunk-SIGXBN4F.js} +3 -3
- package/dist/{chunk-NFSO7WUA.js.map → chunk-SIGXBN4F.js.map} +1 -1
- package/dist/{chunk-N2CE3J4M.js → chunk-U3ZIJZYH.js} +3 -3
- package/dist/{chunk-N2CE3J4M.js.map → chunk-U3ZIJZYH.js.map} +1 -1
- package/dist/{chunk-S2ERKGYL.js → chunk-ZLGLI4KC.js} +3 -3
- package/dist/{chunk-S2ERKGYL.js.map → chunk-ZLGLI4KC.js.map} +1 -1
- package/dist/{chunk-3BDDYX3V.js → chunk-ZVIEFW3X.js} +3 -3
- package/dist/{chunk-3BDDYX3V.js.map → chunk-ZVIEFW3X.js.map} +1 -1
- package/dist/{chunk-XQAOHHXL.js → chunk-ZZ3X3DDL.js} +3 -3
- package/dist/{chunk-XQAOHHXL.js.map → chunk-ZZ3X3DDL.js.map} +1 -1
- package/dist/customer.cjs.map +1 -1
- package/dist/customer.js +3 -3
- package/dist/index.cjs +62 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +107 -34
- package/dist/index.d.ts +107 -34
- package/dist/index.js +52 -38
- package/dist/index.js.map +1 -1
- package/dist/media.cjs +3 -0
- package/dist/media.cjs.map +1 -1
- package/dist/media.js +2 -2
- package/dist/orders.cjs +6 -2
- package/dist/orders.cjs.map +1 -1
- package/dist/orders.d.cts +6 -2
- package/dist/orders.d.ts +6 -2
- package/dist/orders.js +1 -1
- package/dist/payment.cjs.map +1 -1
- package/dist/payment.js +3 -3
- package/dist/price.cjs.map +1 -1
- package/dist/price.js +2 -2
- package/dist/product.cjs +23 -12
- package/dist/product.cjs.map +1 -1
- package/dist/product.d.cts +193 -12
- package/dist/product.d.ts +193 -12
- package/dist/product.js +1 -1
- package/dist/segment.cjs.map +1 -1
- package/dist/segment.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-IYNT5BQW.js.map +0 -1
- package/dist/chunk-J2AN2FMK.js.map +0 -1
- package/dist/chunk-UWGGF4MC.js.map +0 -1
package/dist/product.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/context.ts","../src/core/paged.ts","../src/core/query.ts","../src/services/product.ts"],"names":[],"mappings":";;;AAmDA,gBAAuB,UAAA,CACrB,SAAA,EACA,KAAA,GAAQ,CAAA,EACU;AAClB,EAAA,IAAI,CAAA,GAAI,KAAA;AACR,EAAA,WAAS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,MAAA;AAAA,MACR,IAAA,EAAM,CAAA,SAAA,EAAY,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA,kBAAA,CAAA;AAAA,MACjC,IAAA,EAAM,KAAA;AAAA,MACN;AAAA,KACD,CAAA;AAAA;AAAA,IAGH,MAAA,EAAQ,OACN,UAAA,EACA,KAAA,EACA,OAAoB,OAAA,KACF;AAClB,MAAA,MAAM,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAc;AAAA,QAChC,MAAA,EAAQ,KAAA;AAAA,QACR,MAAM,CAAA,SAAA,EAAY,IAAA,CAAK,GAAA,CAAI,MAAM,sBAAsB,UAAU,CAAA,CAAA;AAAA,QACjE,IAAA,EAAM,KAAA;AAAA,QACN;AAAA,OACD,CAAA;AAAA,IACH,CAAA;AAAA;AAAA,IAGA,MAAA,EAAQ,OAAO,UAAA,EAAoB,IAAA,GAAoB,OAAA,KAA2B;AAChF,MAAA,MAAM,IAAA,CAAK,GAAA,CAAI,IAAA,CAAK,OAAA,CAAc;AAAA,QAChC,MAAA,EAAQ,QAAA;AAAA,QACR,MAAM,CAAA,SAAA,EAAY,IAAA,CAAK,GAAA,CAAI,MAAM,sBAAsB,UAAU,CAAA,CAAA;AAAA,QACjE;AAAA,OACD,CAAA;AAAA,IACH;AAAA,GACF;AACF","file":"product.cjs","sourcesContent":["import type { HttpClient } from \"./http\";\nimport type { TokenProvider, AuthContext } from \"./auth\";\nimport type { Logger } from \"./logger\";\n\n/** Shared dependencies every service facade receives. */\nexport interface ClientContext {\n tenant: string;\n http: HttpClient;\n tokenProvider: TokenProvider;\n logger: Logger;\n}\n\n/**\n * A cursor-paged collection — `pageNumber`/`pageSize` indexing with a\n * `hasNextPage` signal driven by the source page being full. Used by all\n * paginated services and hooks across the SDK.\n */\nexport interface PaginatedItems<T> {\n items: T[];\n pageNumber: number;\n pageSize: number;\n hasNextPage: boolean;\n /**\n * Absolute number of matches, when the caller asked for it and the endpoint\n * answered. Opt-in per call (`totalCount: true`), because Emporix computes it\n * with a second query — see `core/paged.ts`.\n *\n * Always `undefined` in cursor mode: the server ignores the request header\n * and omits the response header there.\n */\n totalCount?: number;\n /**\n * Opaque cursor for the next page, on the endpoints that offer one (today:\n * the schema service's custom instances). Pass it back as the `next` query\n * parameter. Absence means \"this endpoint said nothing\", NOT \"last page\".\n */\n nextCursor?: string;\n /** Opaque cursor for the previous page. Same caveat as {@link nextCursor}. */\n prevCursor?: string;\n}\n\n/** Default `AuthContext` applied by a service when the caller passes none. */\nexport type DefaultAuth = AuthContext | undefined;\n\n/**\n * Async-iterates every item across pages of a `PaginatedItems<T>` source.\n * Stops when the source reports `hasNextPage: false`.\n *\n * @param fetchPage - given a 1-based page number, returns the page.\n * @param start - first page to fetch (default `1`).\n */\nexport async function* iterateAll<T>(\n fetchPage: (pageNumber: number) => Promise<PaginatedItems<T>>,\n start = 1,\n): AsyncIterable<T> {\n let p = start;\n for (;;) {\n const page = await fetchPage(p);\n for (const it of page.items) yield it;\n if (!page.hasNextPage) return;\n p += 1;\n }\n}\n\n","import type { PaginatedItems } from \"./context\";\nimport type { HttpClient, RequestOptions } from \"./http\";\n\n/** Pagination inputs for {@link requestPage}. */\nexport interface PageParams {\n /** 1-based, as Emporix counts. */\n pageNumber: number;\n pageSize: number;\n /**\n * Ask Emporix for the absolute match count via the `X-Total-Count: true`\n * request header.\n *\n * Off by default and opt-in per call, not a client-wide setting: the count\n * costs the server a second query, and defaulting it on would put that cost\n * on every list every storefront issues.\n */\n totalCount?: boolean;\n}\n\n/**\n * Reads a non-negative integer header, or `undefined` when it is missing or is\n * not one. A malformed value must not reach the `hasNextPage` arithmetic —\n * `Number(\"lots\")` is `NaN`, and every comparison against `NaN` is `false`,\n * which would silently report \"last page\" on every page.\n */\nfunction intHeader(headers: Headers, name: string): number | undefined {\n const raw = headers.get(name);\n if (raw === null || raw.trim() === \"\") return undefined;\n const n = Number(raw);\n return Number.isInteger(n) && n >= 0 ? n : undefined;\n}\n\n/**\n * Issues one page of a list endpoint and assembles {@link PaginatedItems} from\n * the body plus Emporix's pagination response headers.\n *\n * Cursors travel in opposite directions: the caller sends one as the `next` or\n * `prev` **query parameter** (so it belongs in `o.query`), and the server\n * returns the following one as the `X-Next-Cursor` **response header**. This\n * helper only ever reads them.\n */\nexport async function requestPage<T>(\n http: HttpClient,\n o: RequestOptions,\n page: PageParams,\n): Promise<PaginatedItems<T>> {\n const { data, headers } = await http.requestWithMeta<T[]>(\n page.totalCount === true\n ? { ...o, headers: { ...(o.headers ?? {}), \"X-Total-Count\": \"true\" } }\n : o,\n );\n\n // A 204 or empty body parses to `undefined`. Facades used to index straight\n // into the result and would throw; an empty page is the honest answer.\n const items = data ?? [];\n const totalCount = intHeader(headers, \"X-Total-Count\");\n const nextCursor = headers.get(\"X-Next-Cursor\") ?? undefined;\n const prevCursor = headers.get(\"X-Prev-Cursor\") ?? undefined;\n\n // Three tiers, most precise first. Tier 1 is ONE-DIRECTIONAL on purpose: only\n // two endpoints in the whole API emit a cursor header, so its absence says\n // nothing at all and has to fall through to the other two.\n const hasNextPage =\n nextCursor !== undefined\n ? true\n : totalCount !== undefined\n ? page.pageNumber * page.pageSize < totalCount\n : items.length === page.pageSize;\n\n // Spread conditionally — `exactOptionalPropertyTypes` rejects an explicit\n // `undefined` for an optional property.\n return {\n items,\n pageNumber: page.pageNumber,\n pageSize: page.pageSize,\n hasNextPage,\n ...(totalCount === undefined ? {} : { totalCount }),\n ...(nextCursor === undefined ? {} : { nextCursor }),\n ...(prevCursor === undefined ? {} : { prevCursor }),\n };\n}\n","/**\n * A built query filter — structurally matched, NOT imported, so the SDK stays\n * decoupled from `@viu/emporix-mixins` (which lists the SDK as an optional\n * peer; a real import would be circular). `@viu/emporix-mixins`' `MixinFilter<E>`\n * satisfies this shape.\n */\nexport interface BuiltQuery<E extends string = string> {\n toString(): string;\n readonly usesCompound?: boolean;\n /** Phantom entity tag — gates which service a filter may be passed to. */\n readonly __entity?: E;\n}\n\n/** A `q` value a service method accepts: a raw DSL string or a built filter for entity `E`. */\nexport type QueryFor<E extends string = string> = string | BuiltQuery<E>;\n\n/** Per-service capability flags consulted by {@link resolveQuery}. */\nexport interface QueryCapability {\n /** Whether the target service supports the `compoundLogicalQuery` (OR) operator. */\n compoundLogicalQuery: boolean;\n}\n\n/**\n * Normalizes a `string | BuiltQuery` into a `q` string and enforces the\n * `compoundLogicalQuery` capability gate: an `or()`-built filter passed to a\n * service that does not support it throws rather than silently producing a\n * query the backend cannot execute.\n */\nexport function resolveQuery(q: QueryFor, cap: QueryCapability): string {\n if (typeof q === \"string\") return q;\n if (q.usesCompound === true && !cap.compoundLogicalQuery) {\n throw new Error(\n \"This filter uses or()/compoundLogicalQuery, which the target service does not support. \" +\n \"Combine conditions with and() (space-separated AND) instead.\",\n );\n }\n return q.toString();\n}\n","import type { ClientContext, PaginatedItems } from \"../core/context\";\nimport { iterateAll } from \"../core/context\";\nimport { requestPage } from \"../core/paged\";\nimport type { AuthContext } from \"../core/auth\";\nimport { resolveQuery, type QueryFor } from \"../core/query\";\nimport type {\n BasicProductWithId,\n BundleProductWithId,\n ParentVariantProductWithId,\n ProductMedia,\n ProductCreateBody,\n ProductUpdateBody,\n ProductPartialUpdateBody,\n ProductBulkCreateBody,\n ProductBulkUpdateBody,\n BulkResponse,\n ResourceLocation,\n DynamicVariantRecalculationRequest,\n DynamicVariantRecalculationResponse,\n DynamicVariantRecalculationJobResponse,\n DynamicVariantRecalculationJobStatus,\n ProductTemplateResponse,\n ProductTemplateCreation,\n ProductTemplateUpdate,\n} from \"../generated/product\";\n\nconst ANON: AuthContext = { kind: \"anonymous\" };\nconst SERVICE: AuthContext = { kind: \"service\" };\n\n/** A product as returned by the Product service (all generated fields). */\nexport type Product = BasicProductWithId | BundleProductWithId | ParentVariantProductWithId;\n\n/** A single product media entry (generated; `ProductMedia` is the list type). */\nexport type Media = ProductMedia[number];\n\n/** Body for creating a product (`POST /products`) — any of the 5 product shapes. */\nexport type ProductCreateInput = ProductCreateBody;\n\n/** Body for a full product replace (`PUT /products/{id}`). */\nexport type ProductUpdateInput = ProductUpdateBody;\n\n/** Body for a partial product update (`PATCH /products/{id}`). */\nexport type ProductPatchInput = ProductPartialUpdateBody;\n\n/** Id/location envelope returned when a product is created. */\nexport type ProductCreated = ResourceLocation;\n\n/** Body for bulk-creating products (`POST /products/bulk`). */\nexport type ProductBulkCreateInput = ProductBulkCreateBody;\n\n/** Body for bulk-updating products (`PUT /products/bulk`). */\nexport type ProductBulkUpdateInput = ProductBulkUpdateBody;\n\n/** Per-entry result of a bulk product operation (207 Multi-Status). */\nexport type ProductBulkResult = BulkResponse;\n\n/** Body for triggering a dynamic-variant recalculation. */\nexport type ProductRecalculationInput = DynamicVariantRecalculationRequest;\n\n/** Result of triggering a recalculation — created jobs plus skipped product ids. */\nexport type ProductRecalculationResult = DynamicVariantRecalculationResponse;\n\n/** A dynamic-variant recalculation job. */\nexport type ProductRecalculationJob = DynamicVariantRecalculationJobResponse;\n\n/** Status of a recalculation job. */\nexport type ProductRecalculationJobStatus = DynamicVariantRecalculationJobStatus;\n\n/** A product template as returned by the Product service. */\nexport type ProductTemplate = ProductTemplateResponse;\n\n/** Body for creating a product template. */\nexport type ProductTemplateCreateInput = ProductTemplateCreation;\n\n/** Body for updating a product template (`PUT`, full replace). */\nexport type ProductTemplateUpdateInput = ProductTemplateUpdate;\n\n/** Id envelope returned when a product template is created. */\nexport type ProductTemplateCreated = { id?: string };\n\n/** Options shared by the product write endpoints. */\nexport interface ProductWriteOptions {\n skipVariantGeneration?: boolean;\n doIndex?: boolean;\n skipRelatedItemsValidation?: boolean;\n /**\n * `Content-Language` for this call, overriding `EmporixConfig.contentLanguage`:\n * `\"*\"` when `name`, `description` and the other localized fields are maps of\n * translations, a language code such as `\"de\"` when they are plain strings.\n */\n contentLanguage?: string;\n}\n\n/** Catalog reads. Default auth: anonymous; pass customer for personalized pricing. */\nexport class ProductService {\n static readonly channel = \"product\" as const;\n constructor(private readonly ctx: ClientContext) {}\n\n /** Fetches one product by id. */\n async get(\n productId: string,\n _opts?: Record<string, never>,\n auth: AuthContext = ANON,\n ): Promise<Product> {\n return this.ctx.http.request<Product>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products/${productId}`,\n auth,\n });\n }\n\n /** Fetches one product by its code. */\n async getByCode(code: string, auth: AuthContext = ANON): Promise<Product> {\n const rows = await this.ctx.http.request<Product[]>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products`,\n query: { q: `code:${code}` },\n auth,\n });\n const first = rows[0];\n if (!first) throw new Error(`No product with code \"${code}\"`);\n return first;\n }\n\n /** One page of products. */\n async list(\n params: { pageNumber?: number; pageSize?: number; totalCount?: boolean } = {},\n auth: AuthContext = ANON,\n ): Promise<PaginatedItems<Product>> {\n const pageNumber = params.pageNumber ?? 1;\n const pageSize = params.pageSize ?? 50;\n return requestPage<Product>(\n this.ctx.http,\n {\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products`,\n query: { pageNumber, pageSize },\n auth,\n },\n {\n pageNumber,\n pageSize,\n ...(params.totalCount === undefined ? {} : { totalCount: params.totalCount }),\n },\n );\n }\n\n /** Async-iterates every product across pages. */\n listAll(params: { pageSize?: number } = {}, auth: AuthContext = ANON): AsyncIterable<Product> {\n const pageSize = params.pageSize ?? 50;\n return iterateAll<Product>((pageNumber) => this.list({ pageNumber, pageSize }, auth));\n }\n\n /**\n * Searches products by a `q` filter — a raw Emporix DSL string or a built\n * filter (e.g. `@viu/emporix-mixins`' `mixinQuery(...)`). Product supports\n * `compoundLogicalQuery`, so `or()` filters are allowed.\n */\n async search(\n query: QueryFor<\"PRODUCT\">,\n params: { pageNumber?: number; pageSize?: number; totalCount?: boolean } = {},\n auth: AuthContext = ANON,\n ): Promise<PaginatedItems<Product>> {\n const q = resolveQuery(query, { compoundLogicalQuery: true });\n const pageNumber = params.pageNumber ?? 1;\n const pageSize = params.pageSize ?? 50;\n return requestPage<Product>(\n this.ctx.http,\n {\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products`,\n query: { q, pageNumber, pageSize },\n auth,\n },\n {\n pageNumber,\n pageSize,\n ...(params.totalCount === undefined ? {} : { totalCount: params.totalCount }),\n },\n );\n }\n\n /**\n * Free-text product search by name. The product `q` is a `field:value` DSL,\n * so a bare term (e.g. \"in time\") 400s with \"No value for key …\". This builds\n * a `name:(~<term>)` regex filter (regex metacharacters escaped) and delegates\n * to {@link search}.\n *\n * Safe for text a shopper typed: `( ) \"` are **removed** rather than escaped,\n * because Emporix parses the filter's own structure before it looks at the\n * regex. `name:(~a \\()` is rejected with «Missing closing parenthesis in value»\n * even though the paren is escaped, so a search box would 400 on an opening\n * bracket. Measured against a live tenant on 2026-08-03: of every regex\n * metacharacter only those three break; the rest survive escaping.\n *\n * A query consisting solely of those characters leaves nothing to search for and\n * returns an empty page without a request — `name:(~)` is a 400.\n */\n async searchByName(\n query: string,\n // Makes no request of its own — `totalCount` is here purely so it can be\n // forwarded to `search`, which is where the header actually gets sent.\n params: { pageNumber?: number; pageSize?: number; totalCount?: boolean } = {},\n auth: AuthContext = ANON,\n ): Promise<PaginatedItems<Product>> {\n // Replaced by a space rather than dropped, so «Access(JIT)» does not become\n // one run-together word — and then collapsed, because a leftover double space\n // is two LITERAL spaces in the regex and would match nothing.\n const term = query\n .replace(/[()\"]/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n if (term === \"\") {\n // Defaults mirror `search`, so the shape matches a real answer.\n return {\n items: [],\n pageNumber: params.pageNumber ?? 1,\n pageSize: params.pageSize ?? 50,\n hasNextPage: false,\n };\n }\n const escaped = term.replace(/[.*+?^${}|[\\]\\\\]/g, \"\\\\$&\");\n return this.search(`name:(~${escaped})`, params, auth);\n }\n\n /**\n * Bulk fetch by id. POSTs `/products/search` with `q=\"id:(id1,id2,…)\"`,\n * chunking when the list is larger than `options.chunkSize` (default\n * 100). An empty list short-circuits with no HTTP call. **Order is not\n * guaranteed** across chunks — re-index by `id` if order matters.\n */\n async searchByIds(\n ids: string[],\n options: { chunkSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<Product[]> {\n if (ids.length === 0) return [];\n const chunkSize = options.chunkSize ?? 100;\n const chunks: string[][] = [];\n for (let i = 0; i < ids.length; i += chunkSize) {\n chunks.push(ids.slice(i, i + chunkSize));\n }\n const pages = await Promise.all(\n chunks.map((chunk) =>\n this.ctx.http.request<Product[]>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products/search`,\n query: { pageSize: chunk.length },\n auth,\n body: { q: `id:(${chunk.join(\",\")})` },\n idempotent: true, // pure read over POST — safe to replay on 5xx/429\n }),\n ),\n );\n return pages.flat();\n }\n\n /**\n * Bulk fetch by code. POSTs `/products/search` with `q=\"code:(c1,c2,…)\"`,\n * chunking when the list is larger than `options.chunkSize` (default 100).\n * Duplicate codes are de-duplicated. Codes containing query-delimiter\n * characters (`(`, `)`, `,`, whitespace, `\"`) are dropped with a logged\n * warning, because the Emporix `q` syntax uses them as delimiters and does\n * not support escaping them in a plain IN-list. An empty list — or one with\n * no safe codes — short-circuits with no HTTP call. **Order is not\n * guaranteed** across chunks — re-index by `code` if order matters.\n */\n async searchByCodes(\n codes: string[],\n options: { chunkSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<Product[]> {\n const unique = [...new Set(codes)];\n const unsafe = /[(),\"\\s]/;\n const safe = unique.filter((c) => !unsafe.test(c));\n const dropped = unique.filter((c) => unsafe.test(c));\n if (dropped.length > 0) {\n this.ctx.logger.warn(\n \"products.searchByCodes: dropped codes containing query-delimiter characters\",\n { dropped },\n );\n }\n if (safe.length === 0) return [];\n const chunkSize = options.chunkSize ?? 100;\n const chunks: string[][] = [];\n for (let i = 0; i < safe.length; i += chunkSize) {\n chunks.push(safe.slice(i, i + chunkSize));\n }\n const pages = await Promise.all(\n chunks.map((chunk) =>\n this.ctx.http.request<Product[]>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products/search`,\n query: { pageSize: chunk.length },\n auth,\n body: { q: `code:(${chunk.join(\",\")})` },\n idempotent: true, // pure read over POST — safe to replay on 5xx/429\n }),\n ),\n );\n return pages.flat();\n }\n\n /**\n * Streams the VARIANT children of a PARENT_VARIANT product, page by page,\n * via the search query `productType:VARIANT parentVariantId:<id>`. Default\n * pageSize 200. The query syntax (space-separated fields = implicit AND) is\n * encapsulated here so consumers don't build it themselves.\n */\n listVariantChildrenAll(\n parentVariantId: string,\n params: { pageSize?: number } = {},\n auth: AuthContext = ANON,\n ): AsyncIterable<Product> {\n const pageSize = params.pageSize ?? 200;\n const q = `productType:VARIANT parentVariantId:${parentVariantId}`;\n return iterateAll<Product>((pageNumber) => this.search(q, { pageNumber, pageSize }, auth));\n }\n\n /**\n * Resolves ALL VARIANT children of a PARENT_VARIANT product into a flat\n * array (loads every page). Default pageSize 200. Returns `[]` when there are\n * no children — never throws.\n */\n async listVariantChildren(\n parentVariantId: string,\n params: { pageSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<Product[]> {\n const out: Product[] = [];\n for await (const child of this.listVariantChildrenAll(parentVariantId, params, auth)) {\n out.push(child);\n }\n return out;\n }\n\n // --- Admin writes. Default auth: service. ---\n\n /**\n * Creates a product (`POST /products`). Default auth: service. Accepts any of\n * the five product shapes (basic, bundle, parent-variant, variant,\n * dynamic-variant).\n */\n async create(\n input: ProductCreateInput,\n options: ProductWriteOptions = {},\n auth: AuthContext = SERVICE,\n ): Promise<ProductCreated> {\n const query = {\n ...(options.skipVariantGeneration === undefined ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n ...(options.skipRelatedItemsValidation === undefined ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }),\n };\n return this.ctx.http.request<ProductCreated>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n ...(options.contentLanguage === undefined\n ? {}\n : { headers: { \"Content-Language\": options.contentLanguage } }),\n body: input,\n auth,\n });\n }\n\n /**\n * Partially updates a product (`PATCH /products/{productId}`). Default auth:\n * service. Use {@link replace} for a full replace (PUT).\n *\n * Omitted fields stay as they are. **Mixins merge rather than replace**, and\n * the corollary catches people out: there is no way to delete a mixin here.\n * - a mixin name you omit stays on the product;\n * - fields you send inside a mixin are merged recursively, and fields you\n * omit inside that mixin keep their values;\n * - `null` does **not** delete a mixin — it stores `null` as its value.\n *\n * To actually remove one, read the product and send it back through\n * {@link replace} with `partial: false`, leaving the mixin out of both\n * `mixins` and `metadata.mixins`.\n *\n * Despite the HTTP verb this is **not** a JSON-Patch endpoint: an op-array of\n * `{ op, path, value }` is rejected. Send a partial product document.\n */\n async update(\n productId: string,\n input: ProductPatchInput,\n options: ProductWriteOptions = {},\n auth: AuthContext = SERVICE,\n ): Promise<void> {\n const query = {\n ...(options.skipVariantGeneration === undefined ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n ...(options.skipRelatedItemsValidation === undefined ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }),\n };\n await this.ctx.http.request<void>({\n method: \"PATCH\",\n path: `/product/${this.ctx.tenant}/products/${productId}`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n ...(options.contentLanguage === undefined\n ? {}\n : { headers: { \"Content-Language\": options.contentLanguage } }),\n body: input,\n auth,\n });\n }\n\n /**\n * Full-replaces a product (`PUT /products/{productId}`). Returns the created\n * resource on 201 (upsert) and nothing on 204. `options.partial` sends\n * `?partial=true` for a merge-style replace. Default auth: service.\n *\n * With `partial: false` (the default) the body must be the **complete**\n * product document, and any mixin name missing from it is removed — which is\n * what makes this the only way to delete a mixin, since {@link update} merges\n * them. The flip side is that a body you did not build from a fresh read will\n * silently drop mixins.\n */\n async replace(\n productId: string,\n input: ProductUpdateInput,\n options: ProductWriteOptions & { partial?: boolean } = {},\n auth: AuthContext = SERVICE,\n ): Promise<ProductCreated | void> {\n const query = {\n ...(options.partial === undefined ? {} : { partial: String(options.partial) }),\n ...(options.skipVariantGeneration === undefined ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n ...(options.skipRelatedItemsValidation === undefined ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }),\n };\n return this.ctx.http.request<ProductCreated | void>({\n method: \"PUT\",\n path: `/product/${this.ctx.tenant}/products/${productId}`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n ...(options.contentLanguage === undefined\n ? {}\n : { headers: { \"Content-Language\": options.contentLanguage } }),\n body: input,\n auth,\n });\n }\n\n /**\n * Deletes a product (`DELETE /products/{productId}`). `options.force` deletes\n * even when the product is referenced. Default auth: service.\n */\n async delete(\n productId: string,\n options: { force?: boolean; doIndex?: boolean } = {},\n auth: AuthContext = SERVICE,\n ): Promise<void> {\n const query = {\n ...(options.force === undefined ? {} : { force: String(options.force) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n };\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `/product/${this.ctx.tenant}/products/${productId}`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n auth,\n });\n }\n\n /**\n * Bulk-creates products (`POST /products/bulk`). Responds 207 Multi-Status:\n * partial failures do **not** throw — inspect each entry. Default auth: service.\n */\n async bulkCreate(\n input: ProductBulkCreateInput,\n options: ProductWriteOptions = {},\n auth: AuthContext = SERVICE,\n ): Promise<ProductBulkResult[]> {\n const query = {\n ...(options.skipVariantGeneration === undefined ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n ...(options.skipRelatedItemsValidation === undefined ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }),\n };\n return this.ctx.http.request<ProductBulkResult[]>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products/bulk`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n ...(options.contentLanguage === undefined\n ? {}\n : { headers: { \"Content-Language\": options.contentLanguage } }),\n body: input,\n auth,\n });\n }\n\n /**\n * Bulk-updates products (`PUT /products/bulk`). Responds 207 Multi-Status:\n * partial failures do **not** throw — inspect each entry. Default auth: service.\n */\n async bulkUpdate(\n input: ProductBulkUpdateInput,\n options: ProductWriteOptions = {},\n auth: AuthContext = SERVICE,\n ): Promise<ProductBulkResult[]> {\n const query = {\n ...(options.skipVariantGeneration === undefined ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n ...(options.skipRelatedItemsValidation === undefined ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }),\n };\n return this.ctx.http.request<ProductBulkResult[]>({\n method: \"PUT\",\n path: `/product/${this.ctx.tenant}/products/bulk`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n ...(options.contentLanguage === undefined\n ? {}\n : { headers: { \"Content-Language\": options.contentLanguage } }),\n body: input,\n auth,\n });\n }\n\n /**\n * Triggers a dynamic-variant recalculation for the given product ids\n * (`POST /products/recalculate`, 202). The result carries the created or\n * already-referenced `jobs` plus `skippedProductIds` — products whose root\n * already has a PENDING/PROCESSING job. Default auth: service.\n */\n async recalculate(\n input: ProductRecalculationInput,\n auth: AuthContext = SERVICE,\n ): Promise<ProductRecalculationResult> {\n return this.ctx.http.request<ProductRecalculationResult>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products/recalculate`,\n body: input,\n auth,\n });\n }\n\n /** Lists dynamic-variant recalculation jobs, optionally filtered by status. Default auth: anonymous. */\n async listRecalculationJobs(\n params: { status?: ProductRecalculationJobStatus } = {},\n auth: AuthContext = ANON,\n ): Promise<ProductRecalculationJob[]> {\n return this.ctx.http.request<ProductRecalculationJob[]>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products/recalculate/jobs`,\n ...(params.status === undefined ? {} : { query: { status: params.status } }),\n auth,\n });\n }\n\n /** Fetches one dynamic-variant recalculation job by id. Default auth: anonymous. */\n async getRecalculationJob(jobId: string, auth: AuthContext = ANON): Promise<ProductRecalculationJob> {\n return this.ctx.http.request<ProductRecalculationJob>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products/recalculate/jobs/${jobId}`,\n auth,\n });\n }\n\n /**\n * Product templates (`/product-templates`). Reads default to anonymous,\n * writes to service auth.\n */\n readonly templates = {\n /** One page of product templates. Default auth: anonymous. */\n list: async (\n params: { pageNumber?: number; pageSize?: number; sort?: string; q?: string } = {},\n auth: AuthContext = ANON,\n ): Promise<ProductTemplate[]> =>\n this.ctx.http.request<ProductTemplate[]>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/product-templates`,\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.q === undefined ? {} : { q: params.q }),\n },\n auth,\n }),\n\n /** Fetches one product template by id. Default auth: anonymous. */\n get: async (templateId: string, auth: AuthContext = ANON): Promise<ProductTemplate> =>\n this.ctx.http.request<ProductTemplate>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/product-templates/${templateId}`,\n auth,\n }),\n\n /** Creates a product template. Default auth: service. */\n create: async (\n input: ProductTemplateCreateInput,\n auth: AuthContext = SERVICE,\n ): Promise<ProductTemplateCreated> =>\n this.ctx.http.request<ProductTemplateCreated>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/product-templates`,\n body: input,\n auth,\n }),\n\n /** Full-replaces a product template (`PUT`). Default auth: service. */\n update: async (\n templateId: string,\n input: ProductTemplateUpdateInput,\n auth: AuthContext = SERVICE,\n ): Promise<void> => {\n await this.ctx.http.request<void>({\n method: \"PUT\",\n path: `/product/${this.ctx.tenant}/product-templates/${templateId}`,\n body: input,\n auth,\n });\n },\n\n /** Deletes a product template. Default auth: service. */\n delete: async (templateId: string, auth: AuthContext = SERVICE): Promise<void> => {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `/product/${this.ctx.tenant}/product-templates/${templateId}`,\n auth,\n });\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/core/context.ts","../src/core/paged.ts","../src/core/query.ts","../src/services/product.ts"],"names":[],"mappings":";;;AAmDA,gBAAuB,UAAA,CACrB,SAAA,EACA,KAAA,GAAQ,CAAA,EACU;AAClB,EAAA,IAAI,CAAA,GAAI,KAAA;AACR,EAAA,WAAS;AACP,IAAA,MAAM,IAAA,GAAO,MAAM,SAAA,CAAU,CAAC,CAAA;AAC9B,IAAA,KAAA,MAAW,EAAA,IAAM,IAAA,CAAK,KAAA,EAAO,MAAM,EAAA;AACnC,IAAA,IAAI,CAAC,KAAK,WAAA,EAAa;AACvB,IAAA,CAAA,IAAK,CAAA;AAAA,EACP;AACF;;;ACrCA,SAAS,SAAA,CAAU,SAAkB,IAAA,EAAkC;AACrE,EAAA,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,IAAI,CAAA;AAC5B,EAAA,IAAI,QAAQ,IAAA,IAAQ,GAAA,CAAI,IAAA,EAAK,KAAM,IAAI,OAAO,MAAA;AAC9C,EAAA,MAAM,CAAA,GAAI,OAAO,GAAG,CAAA;AACpB,EAAA,OAAO,OAAO,SAAA,CAAU,CAAC,CAAA,IAAK,CAAA,IAAK,IAAI,CAAA,GAAI,MAAA;AAC7C;AAWA,eAAsB,WAAA,CACpB,IAAA,EACA,CAAA,EACA,IAAA,EAC4B;AAC5B,EAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAQ,GAAI,MAAM,IAAA,CAAK,eAAA;AAAA,IACnC,KAAK,UAAA,KAAe,IAAA,GAChB,EAAE,GAAG,GAAG,OAAA,EAAS,EAAE,GAAI,CAAA,CAAE,WAAW,EAAC,EAAI,eAAA,EAAiB,MAAA,IAAS,GACnE;AAAA,GACN;AAIA,EAAA,MAAM,KAAA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,SAAA,EAAY,IAAA,CAAK,GAAA,CAAI,MAAM,sBAAsB,UAAU,CAAA,CAAA;AAAA,QACjE;AAAA,OACD,CAAA;AAAA,IACH;AAAA,GACF;AACF","file":"product.cjs","sourcesContent":["import type { HttpClient } from \"./http\";\nimport type { TokenProvider, AuthContext } from \"./auth\";\nimport type { Logger } from \"./logger\";\n\n/** Shared dependencies every service facade receives. */\nexport interface ClientContext {\n tenant: string;\n http: HttpClient;\n tokenProvider: TokenProvider;\n logger: Logger;\n}\n\n/**\n * A cursor-paged collection — `pageNumber`/`pageSize` indexing with a\n * `hasNextPage` signal driven by the source page being full. Used by all\n * paginated services and hooks across the SDK.\n */\nexport interface PaginatedItems<T> {\n items: T[];\n pageNumber: number;\n pageSize: number;\n hasNextPage: boolean;\n /**\n * Absolute number of matches, when the caller asked for it and the endpoint\n * answered. Opt-in per call (`totalCount: true`), because Emporix computes it\n * with a second query — see `core/paged.ts`.\n *\n * Always `undefined` in cursor mode: the server ignores the request header\n * and omits the response header there.\n */\n totalCount?: number;\n /**\n * Opaque cursor for the next page, on the endpoints that offer one (today:\n * the schema service's custom instances). Pass it back as the `next` query\n * parameter. Absence means \"this endpoint said nothing\", NOT \"last page\".\n */\n nextCursor?: string;\n /** Opaque cursor for the previous page. Same caveat as {@link nextCursor}. */\n prevCursor?: string;\n}\n\n/** Default `AuthContext` applied by a service when the caller passes none. */\nexport type DefaultAuth = AuthContext | undefined;\n\n/**\n * Async-iterates every item across pages of a `PaginatedItems<T>` source.\n * Stops when the source reports `hasNextPage: false`.\n *\n * @param fetchPage - given a 1-based page number, returns the page.\n * @param start - first page to fetch (default `1`).\n */\nexport async function* iterateAll<T>(\n fetchPage: (pageNumber: number) => Promise<PaginatedItems<T>>,\n start = 1,\n): AsyncIterable<T> {\n let p = start;\n for (;;) {\n const page = await fetchPage(p);\n for (const it of page.items) yield it;\n if (!page.hasNextPage) return;\n p += 1;\n }\n}\n\n","import type { PaginatedItems } from \"./context\";\nimport type { HttpClient, RequestOptions } from \"./http\";\n\n/** Pagination inputs for {@link requestPage}. */\nexport interface PageParams {\n /** 1-based, as Emporix counts. */\n pageNumber: number;\n pageSize: number;\n /**\n * Ask Emporix for the absolute match count via the `X-Total-Count: true`\n * request header.\n *\n * Off by default and opt-in per call, not a client-wide setting: the count\n * costs the server a second query, and defaulting it on would put that cost\n * on every list every storefront issues.\n */\n totalCount?: boolean;\n}\n\n/**\n * Reads a non-negative integer header, or `undefined` when it is missing or is\n * not one. A malformed value must not reach the `hasNextPage` arithmetic —\n * `Number(\"lots\")` is `NaN`, and every comparison against `NaN` is `false`,\n * which would silently report \"last page\" on every page.\n */\nfunction intHeader(headers: Headers, name: string): number | undefined {\n const raw = headers.get(name);\n if (raw === null || raw.trim() === \"\") return undefined;\n const n = Number(raw);\n return Number.isInteger(n) && n >= 0 ? n : undefined;\n}\n\n/**\n * Issues one page of a list endpoint and assembles {@link PaginatedItems} from\n * the body plus Emporix's pagination response headers.\n *\n * Cursors travel in opposite directions: the caller sends one as the `next` or\n * `prev` **query parameter** (so it belongs in `o.query`), and the server\n * returns the following one as the `X-Next-Cursor` **response header**. This\n * helper only ever reads them.\n */\nexport async function requestPage<T>(\n http: HttpClient,\n o: RequestOptions,\n page: PageParams,\n): Promise<PaginatedItems<T>> {\n const { data, headers } = await http.requestWithMeta<T[]>(\n page.totalCount === true\n ? { ...o, headers: { ...(o.headers ?? {}), \"X-Total-Count\": \"true\" } }\n : o,\n );\n\n // A 204 or empty body parses to `undefined`. Facades used to index straight\n // into the result and would throw; an empty page is the honest answer.\n const items = data ?? [];\n const totalCount = intHeader(headers, \"X-Total-Count\");\n const nextCursor = headers.get(\"X-Next-Cursor\") ?? undefined;\n const prevCursor = headers.get(\"X-Prev-Cursor\") ?? undefined;\n\n // Three tiers, most precise first. Tier 1 is ONE-DIRECTIONAL on purpose: only\n // two endpoints in the whole API emit a cursor header, so its absence says\n // nothing at all and has to fall through to the other two.\n const hasNextPage =\n nextCursor !== undefined\n ? true\n : totalCount !== undefined\n ? page.pageNumber * page.pageSize < totalCount\n : items.length === page.pageSize;\n\n // Spread conditionally — `exactOptionalPropertyTypes` rejects an explicit\n // `undefined` for an optional property.\n return {\n items,\n pageNumber: page.pageNumber,\n pageSize: page.pageSize,\n hasNextPage,\n ...(totalCount === undefined ? {} : { totalCount }),\n ...(nextCursor === undefined ? {} : { nextCursor }),\n ...(prevCursor === undefined ? {} : { prevCursor }),\n };\n}\n","/**\n * A built query filter — structurally matched, NOT imported, so the SDK stays\n * decoupled from `@viu/emporix-mixins` (which lists the SDK as an optional\n * peer; a real import would be circular). `@viu/emporix-mixins`' `MixinFilter<E>`\n * satisfies this shape.\n */\nexport interface BuiltQuery<E extends string = string> {\n toString(): string;\n readonly usesCompound?: boolean;\n /** Phantom entity tag — gates which service a filter may be passed to. */\n readonly __entity?: E;\n}\n\n/** A `q` value a service method accepts: a raw DSL string or a built filter for entity `E`. */\nexport type QueryFor<E extends string = string> = string | BuiltQuery<E>;\n\n/** Per-service capability flags consulted by {@link resolveQuery}. */\nexport interface QueryCapability {\n /** Whether the target service supports the `compoundLogicalQuery` (OR) operator. */\n compoundLogicalQuery: boolean;\n}\n\n/**\n * Normalizes a `string | BuiltQuery` into a `q` string and enforces the\n * `compoundLogicalQuery` capability gate: an `or()`-built filter passed to a\n * service that does not support it throws rather than silently producing a\n * query the backend cannot execute.\n */\nexport function resolveQuery(q: QueryFor, cap: QueryCapability): string {\n if (typeof q === \"string\") return q;\n if (q.usesCompound === true && !cap.compoundLogicalQuery) {\n throw new Error(\n \"This filter uses or()/compoundLogicalQuery, which the target service does not support. \" +\n \"Combine conditions with and() (space-separated AND) instead.\",\n );\n }\n return q.toString();\n}\n","import type { ClientContext, PaginatedItems } from \"../core/context\";\nimport { iterateAll } from \"../core/context\";\nimport { requestPage } from \"../core/paged\";\nimport type { AuthContext } from \"../core/auth\";\nimport { resolveQuery, type QueryFor } from \"../core/query\";\nimport type {\n BasicProductWithId,\n BundleProductWithId,\n ParentVariantProductWithId,\n VariantProductWithId,\n DynamicVariantProductWithId,\n ProductMedia,\n ProductCreateBody,\n ProductUpdateBody,\n ProductPartialUpdateBody,\n ProductBulkCreateBody,\n ProductBulkUpdateBody,\n BulkResponse,\n ResourceLocation,\n DynamicVariantRecalculationRequest,\n DynamicVariantRecalculationResponse,\n DynamicVariantRecalculationJobResponse,\n DynamicVariantRecalculationJobStatus,\n ProductTemplateResponse,\n ProductTemplateCreation,\n ProductTemplateUpdate,\n} from \"../generated/product\";\n\nconst ANON: AuthContext = { kind: \"anonymous\" };\nconst SERVICE: AuthContext = { kind: \"service\" };\n\n/** A product as returned by the Product service (all generated fields). */\nexport type Product =\n | BasicProductWithId\n | BundleProductWithId\n | ParentVariantProductWithId\n | ProductVariant;\n\n/**\n * A product below a parent: a `VARIANT` of a `PARENT_VARIANT` (`parentVariantId`),\n * or a `DYNAMIC_VARIANT` of any level (`parentVariantId` is the direct parent,\n * `parentVariantPath` lists every ancestor up to the root).\n */\nexport type ProductVariant = VariantProductWithId | DynamicVariantProductWithId;\n\n/** A single product media entry (generated; `ProductMedia` is the list type). */\nexport type Media = ProductMedia[number];\n\n/** Body for creating a product (`POST /products`) — any of the 5 product shapes. */\nexport type ProductCreateInput = ProductCreateBody;\n\n/** Body for a full product replace (`PUT /products/{id}`). */\nexport type ProductUpdateInput = ProductUpdateBody;\n\n/** Body for a partial product update (`PATCH /products/{id}`). */\nexport type ProductPatchInput = ProductPartialUpdateBody;\n\n/** Id/location envelope returned when a product is created. */\nexport type ProductCreated = ResourceLocation;\n\n/** Body for bulk-creating products (`POST /products/bulk`). */\nexport type ProductBulkCreateInput = ProductBulkCreateBody;\n\n/** Body for bulk-updating products (`PUT /products/bulk`). */\nexport type ProductBulkUpdateInput = ProductBulkUpdateBody;\n\n/** Per-entry result of a bulk product operation (207 Multi-Status). */\nexport type ProductBulkResult = BulkResponse;\n\n/** Body for triggering a dynamic-variant recalculation. */\nexport type ProductRecalculationInput = DynamicVariantRecalculationRequest;\n\n/** Result of triggering a recalculation — created jobs plus skipped product ids. */\nexport type ProductRecalculationResult = DynamicVariantRecalculationResponse;\n\n/** A dynamic-variant recalculation job. */\nexport type ProductRecalculationJob = DynamicVariantRecalculationJobResponse;\n\n/** Status of a recalculation job. */\nexport type ProductRecalculationJobStatus = DynamicVariantRecalculationJobStatus;\n\n/** A product template as returned by the Product service. */\nexport type ProductTemplate = ProductTemplateResponse;\n\n/** Body for creating a product template. */\nexport type ProductTemplateCreateInput = ProductTemplateCreation;\n\n/** Body for updating a product template (`PUT`, full replace). */\nexport type ProductTemplateUpdateInput = ProductTemplateUpdate;\n\n/** Id envelope returned when a product template is created. */\nexport type ProductTemplateCreated = { id?: string };\n\n/** Options shared by the product write endpoints. */\nexport interface ProductWriteOptions {\n skipVariantGeneration?: boolean;\n doIndex?: boolean;\n skipRelatedItemsValidation?: boolean;\n /**\n * `Content-Language` for this call, overriding `EmporixConfig.contentLanguage`:\n * `\"*\"` when `name`, `description` and the other localized fields are maps of\n * translations, a language code such as `\"de\"` when they are plain strings.\n */\n contentLanguage?: string;\n}\n\n/** Catalog reads. Default auth: anonymous; pass customer for personalized pricing. */\nexport class ProductService {\n static readonly channel = \"product\" as const;\n constructor(private readonly ctx: ClientContext) {}\n\n /** Fetches one product by id. */\n async get(productId: string, auth?: AuthContext): Promise<Product>;\n /** @deprecated The second parameter is unused — pass the auth context second: `get(id, auth)`. */\n async get(productId: string, opts: Record<string, never> | undefined, auth?: AuthContext): Promise<Product>;\n async get(\n productId: string,\n authOrOpts?: AuthContext | Record<string, never>,\n legacyAuth?: AuthContext,\n ): Promise<Product> {\n // The legacy options slot is `{}` or `undefined`; an auth context always has a `kind`.\n const auth =\n legacyAuth ?? (authOrOpts !== undefined && \"kind\" in authOrOpts ? (authOrOpts as AuthContext) : ANON);\n return this.ctx.http.request<Product>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products/${productId}`,\n auth,\n });\n }\n\n /** Fetches one product by its code. */\n async getByCode(code: string, auth: AuthContext = ANON): Promise<Product> {\n const rows = await this.ctx.http.request<Product[]>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products`,\n query: { q: `code:${code}` },\n auth,\n });\n const first = rows[0];\n if (!first) throw new Error(`No product with code \"${code}\"`);\n return first;\n }\n\n /** One page of products. */\n async list(\n params: { pageNumber?: number; pageSize?: number; totalCount?: boolean } = {},\n auth: AuthContext = ANON,\n ): Promise<PaginatedItems<Product>> {\n const pageNumber = params.pageNumber ?? 1;\n const pageSize = params.pageSize ?? 50;\n return requestPage<Product>(\n this.ctx.http,\n {\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products`,\n query: { pageNumber, pageSize },\n auth,\n },\n {\n pageNumber,\n pageSize,\n ...(params.totalCount === undefined ? {} : { totalCount: params.totalCount }),\n },\n );\n }\n\n /** Async-iterates every product across pages. */\n listAll(params: { pageSize?: number } = {}, auth: AuthContext = ANON): AsyncIterable<Product> {\n const pageSize = params.pageSize ?? 50;\n return iterateAll<Product>((pageNumber) => this.list({ pageNumber, pageSize }, auth));\n }\n\n /**\n * Searches products by a `q` filter — a raw Emporix DSL string or a built\n * filter (e.g. `@viu/emporix-mixins`' `mixinQuery(...)`). Product supports\n * `compoundLogicalQuery`, so `or()` filters are allowed.\n */\n async search(\n query: QueryFor<\"PRODUCT\">,\n params: { pageNumber?: number; pageSize?: number; totalCount?: boolean } = {},\n auth: AuthContext = ANON,\n ): Promise<PaginatedItems<Product>> {\n const q = resolveQuery(query, { compoundLogicalQuery: true });\n const pageNumber = params.pageNumber ?? 1;\n const pageSize = params.pageSize ?? 50;\n return requestPage<Product>(\n this.ctx.http,\n {\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products`,\n query: { q, pageNumber, pageSize },\n auth,\n },\n {\n pageNumber,\n pageSize,\n ...(params.totalCount === undefined ? {} : { totalCount: params.totalCount }),\n },\n );\n }\n\n /**\n * Free-text product search by name. The product `q` is a `field:value` DSL,\n * so a bare term (e.g. \"in time\") 400s with \"No value for key …\". This builds\n * a `name:(~<term>)` regex filter (regex metacharacters escaped) and delegates\n * to {@link search}.\n *\n * Safe for text a shopper typed: `( ) \"` are **removed** rather than escaped,\n * because Emporix parses the filter's own structure before it looks at the\n * regex. `name:(~a \\()` is rejected with «Missing closing parenthesis in value»\n * even though the paren is escaped, so a search box would 400 on an opening\n * bracket. Measured against a live tenant on 2026-08-03: of every regex\n * metacharacter only those three break; the rest survive escaping.\n *\n * A query consisting solely of those characters leaves nothing to search for and\n * returns an empty page without a request — `name:(~)` is a 400.\n */\n async searchByName(\n query: string,\n // Makes no request of its own — `totalCount` is here purely so it can be\n // forwarded to `search`, which is where the header actually gets sent.\n params: { pageNumber?: number; pageSize?: number; totalCount?: boolean } = {},\n auth: AuthContext = ANON,\n ): Promise<PaginatedItems<Product>> {\n // Replaced by a space rather than dropped, so «Access(JIT)» does not become\n // one run-together word — and then collapsed, because a leftover double space\n // is two LITERAL spaces in the regex and would match nothing.\n const term = query\n .replace(/[()\"]/g, \" \")\n .replace(/\\s+/g, \" \")\n .trim();\n if (term === \"\") {\n // Defaults mirror `search`, so the shape matches a real answer.\n return {\n items: [],\n pageNumber: params.pageNumber ?? 1,\n pageSize: params.pageSize ?? 50,\n hasNextPage: false,\n };\n }\n const escaped = term.replace(/[.*+?^${}|[\\]\\\\]/g, \"\\\\$&\");\n return this.search(`name:(~${escaped})`, params, auth);\n }\n\n /**\n * Bulk fetch by id. POSTs `/products/search` with `q=\"id:(id1,id2,…)\"`,\n * chunking when the list is larger than `options.chunkSize` (default\n * 100). An empty list short-circuits with no HTTP call. **Order is not\n * guaranteed** across chunks — re-index by `id` if order matters.\n */\n async searchByIds(\n ids: string[],\n options: { chunkSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<Product[]> {\n if (ids.length === 0) return [];\n const chunkSize = options.chunkSize ?? 100;\n const chunks: string[][] = [];\n for (let i = 0; i < ids.length; i += chunkSize) {\n chunks.push(ids.slice(i, i + chunkSize));\n }\n const pages = await Promise.all(\n chunks.map((chunk) =>\n this.ctx.http.request<Product[]>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products/search`,\n query: { pageSize: chunk.length },\n auth,\n body: { q: `id:(${chunk.join(\",\")})` },\n idempotent: true, // pure read over POST — safe to replay on 5xx/429\n }),\n ),\n );\n return pages.flat();\n }\n\n /**\n * Bulk fetch by code. POSTs `/products/search` with `q=\"code:(c1,c2,…)\"`,\n * chunking when the list is larger than `options.chunkSize` (default 100).\n * Duplicate codes are de-duplicated. Codes containing query-delimiter\n * characters (`(`, `)`, `,`, whitespace, `\"`) are dropped with a logged\n * warning, because the Emporix `q` syntax uses them as delimiters and does\n * not support escaping them in a plain IN-list. An empty list — or one with\n * no safe codes — short-circuits with no HTTP call. **Order is not\n * guaranteed** across chunks — re-index by `code` if order matters.\n */\n async searchByCodes(\n codes: string[],\n options: { chunkSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<Product[]> {\n const unique = [...new Set(codes)];\n const unsafe = /[(),\"\\s]/;\n const safe = unique.filter((c) => !unsafe.test(c));\n const dropped = unique.filter((c) => unsafe.test(c));\n if (dropped.length > 0) {\n this.ctx.logger.warn(\n \"products.searchByCodes: dropped codes containing query-delimiter characters\",\n { dropped },\n );\n }\n if (safe.length === 0) return [];\n const chunkSize = options.chunkSize ?? 100;\n const chunks: string[][] = [];\n for (let i = 0; i < safe.length; i += chunkSize) {\n chunks.push(safe.slice(i, i + chunkSize));\n }\n const pages = await Promise.all(\n chunks.map((chunk) =>\n this.ctx.http.request<Product[]>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products/search`,\n query: { pageSize: chunk.length },\n auth,\n body: { q: `code:(${chunk.join(\",\")})` },\n idempotent: true, // pure read over POST — safe to replay on 5xx/429\n }),\n ),\n );\n return pages.flat();\n }\n\n /**\n * Streams the variants below a product, page by page, in two searches: the\n * VARIANT children of a PARENT_VARIANT (`productType:VARIANT\n * parentVariantId:<id>`), then the DYNAMIC_VARIANT descendants of every level\n * (`parentVariantPath:<id>` — every ancestor is in the path). Only one of the\n * two finds anything for a given product. Default pageSize 200. The query\n * syntax (space-separated fields = implicit AND) is encapsulated here so\n * consumers don't build it themselves.\n */\n async *listVariantChildrenAll(\n parentVariantId: string,\n params: { pageSize?: number } = {},\n auth: AuthContext = ANON,\n ): AsyncIterable<ProductVariant> {\n const pageSize = params.pageSize ?? 200;\n for (const q of [\n `productType:VARIANT parentVariantId:${parentVariantId}`,\n `parentVariantPath:${parentVariantId}`,\n ]) {\n // Both queries can only match variants.\n yield* iterateAll((pageNumber) =>\n this.search(q, { pageNumber, pageSize }, auth) as Promise<PaginatedItems<ProductVariant>>,\n );\n }\n }\n\n /**\n * Resolves every variant below a product into a flat array (loads every\n * page): the VARIANT children of a PARENT_VARIANT, or the DYNAMIC_VARIANT\n * descendants of all levels — tell them apart by `parentVariantId` (the\n * direct parent) or pick the purchasable ones by `sellable`. Default pageSize\n * 200. Returns `[]` when there are none — never throws.\n */\n async listVariantChildren(\n parentVariantId: string,\n params: { pageSize?: number } = {},\n auth: AuthContext = ANON,\n ): Promise<ProductVariant[]> {\n const out: ProductVariant[] = [];\n for await (const child of this.listVariantChildrenAll(parentVariantId, params, auth)) {\n out.push(child);\n }\n return out;\n }\n\n // --- Admin writes. Default auth: service. ---\n\n /**\n * Creates a product (`POST /products`). Default auth: service. Accepts any of\n * the five product shapes (basic, bundle, parent-variant, variant,\n * dynamic-variant).\n */\n async create(\n input: ProductCreateInput,\n options: ProductWriteOptions = {},\n auth: AuthContext = SERVICE,\n ): Promise<ProductCreated> {\n const query = {\n ...(options.skipVariantGeneration === undefined ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n ...(options.skipRelatedItemsValidation === undefined ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }),\n };\n return this.ctx.http.request<ProductCreated>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n ...(options.contentLanguage === undefined\n ? {}\n : { headers: { \"Content-Language\": options.contentLanguage } }),\n body: input,\n auth,\n });\n }\n\n /**\n * Partially updates a product (`PATCH /products/{productId}`). Default auth:\n * service. Use {@link replace} for a full replace (PUT).\n *\n * Omitted fields stay as they are. **Mixins merge rather than replace**, and\n * the corollary catches people out: there is no way to delete a mixin here.\n * - a mixin name you omit stays on the product;\n * - fields you send inside a mixin are merged recursively, and fields you\n * omit inside that mixin keep their values;\n * - `null` does **not** delete a mixin — it stores `null` as its value.\n *\n * To actually remove one, read the product and send it back through\n * {@link replace} with `partial: false`, leaving the mixin out of both\n * `mixins` and `metadata.mixins`.\n *\n * Despite the HTTP verb this is **not** a JSON-Patch endpoint: an op-array of\n * `{ op, path, value }` is rejected. Send a partial product document.\n */\n async update(\n productId: string,\n input: ProductPatchInput,\n options: ProductWriteOptions = {},\n auth: AuthContext = SERVICE,\n ): Promise<void> {\n const query = {\n ...(options.skipVariantGeneration === undefined ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n ...(options.skipRelatedItemsValidation === undefined ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }),\n };\n await this.ctx.http.request<void>({\n method: \"PATCH\",\n path: `/product/${this.ctx.tenant}/products/${productId}`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n ...(options.contentLanguage === undefined\n ? {}\n : { headers: { \"Content-Language\": options.contentLanguage } }),\n body: input,\n auth,\n });\n }\n\n /**\n * Full-replaces a product (`PUT /products/{productId}`). Returns the created\n * resource on 201 (upsert) and nothing on 204. `options.partial` sends\n * `?partial=true` for a merge-style replace. Default auth: service.\n *\n * With `partial: false` (the default) the body must be the **complete**\n * product document, and any mixin name missing from it is removed — which is\n * what makes this the only way to delete a mixin, since {@link update} merges\n * them. The flip side is that a body you did not build from a fresh read will\n * silently drop mixins.\n */\n async replace(\n productId: string,\n input: ProductUpdateInput,\n options: ProductWriteOptions & { partial?: boolean } = {},\n auth: AuthContext = SERVICE,\n ): Promise<ProductCreated | void> {\n const query = {\n ...(options.partial === undefined ? {} : { partial: String(options.partial) }),\n ...(options.skipVariantGeneration === undefined ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n ...(options.skipRelatedItemsValidation === undefined ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }),\n };\n return this.ctx.http.request<ProductCreated | void>({\n method: \"PUT\",\n path: `/product/${this.ctx.tenant}/products/${productId}`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n ...(options.contentLanguage === undefined\n ? {}\n : { headers: { \"Content-Language\": options.contentLanguage } }),\n body: input,\n auth,\n });\n }\n\n /**\n * Deletes a product (`DELETE /products/{productId}`). `options.force` deletes\n * even when the product is referenced. Default auth: service.\n */\n async delete(\n productId: string,\n options: { force?: boolean; doIndex?: boolean } = {},\n auth: AuthContext = SERVICE,\n ): Promise<void> {\n const query = {\n ...(options.force === undefined ? {} : { force: String(options.force) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n };\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `/product/${this.ctx.tenant}/products/${productId}`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n auth,\n });\n }\n\n /**\n * Bulk-creates products (`POST /products/bulk`). Responds 207 Multi-Status:\n * partial failures do **not** throw — inspect each entry. Default auth: service.\n */\n async bulkCreate(\n input: ProductBulkCreateInput,\n options: ProductWriteOptions = {},\n auth: AuthContext = SERVICE,\n ): Promise<ProductBulkResult[]> {\n const query = {\n ...(options.skipVariantGeneration === undefined ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n ...(options.skipRelatedItemsValidation === undefined ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }),\n };\n return this.ctx.http.request<ProductBulkResult[]>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products/bulk`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n ...(options.contentLanguage === undefined\n ? {}\n : { headers: { \"Content-Language\": options.contentLanguage } }),\n body: input,\n auth,\n });\n }\n\n /**\n * Bulk-updates products (`PUT /products/bulk`). Responds 207 Multi-Status:\n * partial failures do **not** throw — inspect each entry. Default auth: service.\n */\n async bulkUpdate(\n input: ProductBulkUpdateInput,\n options: ProductWriteOptions = {},\n auth: AuthContext = SERVICE,\n ): Promise<ProductBulkResult[]> {\n const query = {\n ...(options.skipVariantGeneration === undefined ? {} : { skipVariantGeneration: String(options.skipVariantGeneration) }),\n ...(options.doIndex === undefined ? {} : { doIndex: String(options.doIndex) }),\n ...(options.skipRelatedItemsValidation === undefined ? {} : { skipRelatedItemsValidation: String(options.skipRelatedItemsValidation) }),\n };\n return this.ctx.http.request<ProductBulkResult[]>({\n method: \"PUT\",\n path: `/product/${this.ctx.tenant}/products/bulk`,\n ...(Object.keys(query).length > 0 ? { query } : {}),\n ...(options.contentLanguage === undefined\n ? {}\n : { headers: { \"Content-Language\": options.contentLanguage } }),\n body: input,\n auth,\n });\n }\n\n /**\n * Triggers a dynamic-variant recalculation for the given product ids\n * (`POST /products/recalculate`, 202). The result carries the created or\n * already-referenced `jobs` plus `skippedProductIds` — products whose root\n * already has a PENDING/PROCESSING job. Default auth: service.\n */\n async recalculate(\n input: ProductRecalculationInput,\n auth: AuthContext = SERVICE,\n ): Promise<ProductRecalculationResult> {\n return this.ctx.http.request<ProductRecalculationResult>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/products/recalculate`,\n body: input,\n auth,\n });\n }\n\n /** Lists dynamic-variant recalculation jobs, optionally filtered by status. Default auth: anonymous. */\n async listRecalculationJobs(\n params: { status?: ProductRecalculationJobStatus } = {},\n auth: AuthContext = ANON,\n ): Promise<ProductRecalculationJob[]> {\n return this.ctx.http.request<ProductRecalculationJob[]>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products/recalculate/jobs`,\n ...(params.status === undefined ? {} : { query: { status: params.status } }),\n auth,\n });\n }\n\n /** Fetches one dynamic-variant recalculation job by id. Default auth: anonymous. */\n async getRecalculationJob(jobId: string, auth: AuthContext = ANON): Promise<ProductRecalculationJob> {\n return this.ctx.http.request<ProductRecalculationJob>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/products/recalculate/jobs/${jobId}`,\n auth,\n });\n }\n\n /**\n * Product templates (`/product-templates`). Reads default to anonymous,\n * writes to service auth.\n */\n readonly templates = {\n /** One page of product templates. Default auth: anonymous. */\n list: async (\n params: { pageNumber?: number; pageSize?: number; sort?: string; q?: string } = {},\n auth: AuthContext = ANON,\n ): Promise<ProductTemplate[]> =>\n this.ctx.http.request<ProductTemplate[]>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/product-templates`,\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.q === undefined ? {} : { q: params.q }),\n },\n auth,\n }),\n\n /** Fetches one product template by id. Default auth: anonymous. */\n get: async (templateId: string, auth: AuthContext = ANON): Promise<ProductTemplate> =>\n this.ctx.http.request<ProductTemplate>({\n method: \"GET\",\n path: `/product/${this.ctx.tenant}/product-templates/${templateId}`,\n auth,\n }),\n\n /** Creates a product template. Default auth: service. */\n create: async (\n input: ProductTemplateCreateInput,\n auth: AuthContext = SERVICE,\n ): Promise<ProductTemplateCreated> =>\n this.ctx.http.request<ProductTemplateCreated>({\n method: \"POST\",\n path: `/product/${this.ctx.tenant}/product-templates`,\n body: input,\n auth,\n }),\n\n /** Full-replaces a product template (`PUT`). Default auth: service. */\n update: async (\n templateId: string,\n input: ProductTemplateUpdateInput,\n auth: AuthContext = SERVICE,\n ): Promise<void> => {\n await this.ctx.http.request<void>({\n method: \"PUT\",\n path: `/product/${this.ctx.tenant}/product-templates/${templateId}`,\n body: input,\n auth,\n });\n },\n\n /** Deletes a product template. Default auth: service. */\n delete: async (templateId: string, auth: AuthContext = SERVICE): Promise<void> => {\n await this.ctx.http.request<void>({\n method: \"DELETE\",\n path: `/product/${this.ctx.tenant}/product-templates/${templateId}`,\n auth,\n });\n },\n };\n}\n"]}
|
package/dist/product.d.cts
CHANGED
|
@@ -259,6 +259,10 @@ type ProductMetadataGet = ProductMetadataWithVersion & {
|
|
|
259
259
|
*/
|
|
260
260
|
modifiedAt?: string;
|
|
261
261
|
};
|
|
262
|
+
/**
|
|
263
|
+
* Variant metadata response.
|
|
264
|
+
*/
|
|
265
|
+
type VariantProductMetadataGet = ProductMetadataGet & VariantProductMetadataWithVersion;
|
|
262
266
|
/**
|
|
263
267
|
* Metadata request.
|
|
264
268
|
*/
|
|
@@ -539,6 +543,23 @@ type VariantProductCreation = VariantProduct & {
|
|
|
539
543
|
parentVariantId?: string;
|
|
540
544
|
productType?: ProductType;
|
|
541
545
|
};
|
|
546
|
+
/**
|
|
547
|
+
* Products of the VARIANT type.
|
|
548
|
+
*/
|
|
549
|
+
type VariantProductWithId = VariantProductCreation & {
|
|
550
|
+
id?: Id;
|
|
551
|
+
yrn?: Yrn;
|
|
552
|
+
media?: ProductMedia;
|
|
553
|
+
metadata?: VariantProductMetadataGet;
|
|
554
|
+
/**
|
|
555
|
+
* Customer segment IDs assigned to the product.
|
|
556
|
+
*/
|
|
557
|
+
customerSegmentIds?: Array<string>;
|
|
558
|
+
/**
|
|
559
|
+
* Category IDs assigned to the product.
|
|
560
|
+
*/
|
|
561
|
+
categoryIds?: Array<string>;
|
|
562
|
+
};
|
|
542
563
|
/**
|
|
543
564
|
* Updating products of the VARIANT type.
|
|
544
565
|
*/
|
|
@@ -593,6 +614,79 @@ type DynamicVariantAttribute = {
|
|
|
593
614
|
type OwnVariantAttributes = {
|
|
594
615
|
[key: string]: DynamicVariantAttribute;
|
|
595
616
|
};
|
|
617
|
+
/**
|
|
618
|
+
* Read-only map of variant attributes inherited from ancestor products in the hierarchy. These cannot be modified on this product — to change an inherited attribute, update the ancestor that owns it.
|
|
619
|
+
*
|
|
620
|
+
*/
|
|
621
|
+
type InheritedVariantAttributes = {
|
|
622
|
+
[key: string]: DynamicVariantAttribute;
|
|
623
|
+
};
|
|
624
|
+
/**
|
|
625
|
+
* A single entry in the root product's `variants` map. In API responses the `variantAttributes` field contains **accumulated** attributes — the entry's own delta attributes merged with all ancestor attributes up the chain, so storefront clients receive a ready-to-use combination without additional API calls. The `published` flag is included only when the caller has the `product.product_read_unpublished` scope.
|
|
626
|
+
*
|
|
627
|
+
*/
|
|
628
|
+
type VariantMapEntry = {
|
|
629
|
+
/**
|
|
630
|
+
* Version of the source variant product at the time of the last recalculation.
|
|
631
|
+
*/
|
|
632
|
+
version?: number;
|
|
633
|
+
/**
|
|
634
|
+
* Code of the source variant product.
|
|
635
|
+
*/
|
|
636
|
+
code?: string;
|
|
637
|
+
name?: LocalizedValue;
|
|
638
|
+
/**
|
|
639
|
+
* Identifier of the immediate parent product in the variant hierarchy.
|
|
640
|
+
*/
|
|
641
|
+
parentVariantId?: string;
|
|
642
|
+
/**
|
|
643
|
+
* Indicates whether this variant can be sold directly.
|
|
644
|
+
*/
|
|
645
|
+
sellable?: boolean;
|
|
646
|
+
/**
|
|
647
|
+
* Publication state of this variant. Only included in responses when the caller has the `product.product_read_unpublished` scope; entries with `published: false` are otherwise omitted from the map.
|
|
648
|
+
*
|
|
649
|
+
*/
|
|
650
|
+
published?: boolean;
|
|
651
|
+
/**
|
|
652
|
+
* Optional label identifying the variant level or kind (for example, `"H1_L1"`).
|
|
653
|
+
*/
|
|
654
|
+
dynamicVariantType?: string;
|
|
655
|
+
/**
|
|
656
|
+
* Accumulated variant attributes for this entry. For leaf variants this includes all ancestor attributes merged with the entry's own delta. Keys are attribute identifiers.
|
|
657
|
+
*
|
|
658
|
+
*/
|
|
659
|
+
variantAttributes?: {
|
|
660
|
+
[key: string]: DynamicVariantAttribute;
|
|
661
|
+
};
|
|
662
|
+
};
|
|
663
|
+
/**
|
|
664
|
+
* Denormalized flat map of all descendant variants stored on the root product. Keys are variant product identifiers. In API responses each entry's `variantAttributes` contains accumulated attributes.
|
|
665
|
+
*
|
|
666
|
+
*/
|
|
667
|
+
type VariantsMap = {
|
|
668
|
+
[key: string]: VariantMapEntry;
|
|
669
|
+
};
|
|
670
|
+
/**
|
|
671
|
+
* Hierarchy integrity information populated when the variant tree has structural problems. Present only when an issue is detected.
|
|
672
|
+
*
|
|
673
|
+
*/
|
|
674
|
+
type DynamicVariantInfo = {
|
|
675
|
+
/**
|
|
676
|
+
* Identifier of an ancestor product that could not be found, indicating a broken hierarchy chain.
|
|
677
|
+
*/
|
|
678
|
+
missingAncestorId?: string;
|
|
679
|
+
/**
|
|
680
|
+
* Indicates that a circular reference was detected in the `parentVariantId` chain.
|
|
681
|
+
*/
|
|
682
|
+
cycleDetected?: boolean;
|
|
683
|
+
};
|
|
684
|
+
/**
|
|
685
|
+
* Metadata for GET responses on DYNAMIC_VARIANT products. Extends the standard product metadata with hierarchy integrity information.
|
|
686
|
+
*/
|
|
687
|
+
type DynamicVariantProductMetadataGet = ProductMetadataGet & {
|
|
688
|
+
dynamicVariantInfo?: DynamicVariantInfo;
|
|
689
|
+
};
|
|
596
690
|
/**
|
|
597
691
|
* Base schema for products of the DYNAMIC_VARIANT type.
|
|
598
692
|
*/
|
|
@@ -625,6 +719,80 @@ type DynamicVariantProductCreation = DynamicVariantProduct & {
|
|
|
625
719
|
id?: string;
|
|
626
720
|
productType?: ProductType;
|
|
627
721
|
};
|
|
722
|
+
/**
|
|
723
|
+
* Response schema for products of the DYNAMIC_VARIANT type.
|
|
724
|
+
*
|
|
725
|
+
* - **`sellable`** — not inherited from parents; must be set explicitly on each product. Root and intermediate variants are typically `false`; leaf variants are typically `true`.
|
|
726
|
+
* - **Root products** include a `variants` map containing all descendants with accumulated attributes.
|
|
727
|
+
* - **Child products** include `ownVariantAttributes` (attributes defined on this product) and `inheritedVariantAttributes` (read-only, merged from ancestors).
|
|
728
|
+
* - `parentVariantPath` is an ordered array of ancestor IDs from direct parent (index 0) to root (last index). Empty for root products.
|
|
729
|
+
* - `metadata.dynamicVariantInfo` is present only when a hierarchy integrity issue is detected.
|
|
730
|
+
*
|
|
731
|
+
*/
|
|
732
|
+
type DynamicVariantProductWithId = {
|
|
733
|
+
id: Id;
|
|
734
|
+
yrn?: Yrn;
|
|
735
|
+
/**
|
|
736
|
+
* Unique product identifier, defined by the user.
|
|
737
|
+
*/
|
|
738
|
+
code: string;
|
|
739
|
+
name: LocalizedValue;
|
|
740
|
+
description?: LocalizedValue;
|
|
741
|
+
productType: ProductType;
|
|
742
|
+
published?: Published;
|
|
743
|
+
/**
|
|
744
|
+
* Indicates whether this variant can be sold directly (i.e. it is a leaf in the hierarchy that a customer can add to a cart). This value is **not inherited** from parent variants — it must be set explicitly on each product. Root products and intermediate-level variants are typically `false`; leaf variants are typically `true`.
|
|
745
|
+
*
|
|
746
|
+
*/
|
|
747
|
+
sellable?: boolean;
|
|
748
|
+
/**
|
|
749
|
+
* Identifier of the immediate parent product in the variant hierarchy. Absent for root-level products.
|
|
750
|
+
*/
|
|
751
|
+
parentVariantId?: string;
|
|
752
|
+
/**
|
|
753
|
+
* Ordered array of ancestor product identifiers, from the direct parent (index 0) to the root (last index). Empty for root-level products.
|
|
754
|
+
*
|
|
755
|
+
*/
|
|
756
|
+
parentVariantPath?: Array<string>;
|
|
757
|
+
/**
|
|
758
|
+
* Optional label identifying the variant level or kind within the hierarchy (for example, `"H1_L1"`).
|
|
759
|
+
*/
|
|
760
|
+
dynamicVariantType?: string;
|
|
761
|
+
ownVariantAttributes?: OwnVariantAttributes;
|
|
762
|
+
inheritedVariantAttributes?: InheritedVariantAttributes;
|
|
763
|
+
variants?: VariantsMap;
|
|
764
|
+
taxClasses?: TaxClasses;
|
|
765
|
+
vendor?: Vendor;
|
|
766
|
+
/**
|
|
767
|
+
* ID of brand.
|
|
768
|
+
*/
|
|
769
|
+
brandId?: string;
|
|
770
|
+
brand?: Brand;
|
|
771
|
+
/**
|
|
772
|
+
* Collection of label IDs.
|
|
773
|
+
*/
|
|
774
|
+
labelIds?: Array<string>;
|
|
775
|
+
labels?: Array<Label>;
|
|
776
|
+
/**
|
|
777
|
+
* Category IDs assigned to the product.
|
|
778
|
+
*/
|
|
779
|
+
categoryIds?: Array<string>;
|
|
780
|
+
/**
|
|
781
|
+
* Customer segment IDs assigned to the product.
|
|
782
|
+
*/
|
|
783
|
+
customerSegmentIds?: Array<string>;
|
|
784
|
+
/**
|
|
785
|
+
* List of items in a relationship with this product.
|
|
786
|
+
*/
|
|
787
|
+
relatedItems?: Array<RelatedItem>;
|
|
788
|
+
/**
|
|
789
|
+
* Mark the product as weight-dependent if the line item price could change after packaging.
|
|
790
|
+
*/
|
|
791
|
+
weightDependent?: boolean;
|
|
792
|
+
mixins?: ProductMixins;
|
|
793
|
+
media?: ProductMedia;
|
|
794
|
+
metadata?: DynamicVariantProductMetadataGet;
|
|
795
|
+
};
|
|
628
796
|
/**
|
|
629
797
|
* Updating products of the DYNAMIC_VARIANT type.
|
|
630
798
|
*/
|
|
@@ -783,7 +951,13 @@ type ProductBulkUpdateBody = Array<BasicProductBulkUpdate | BundleProductBulkUpd
|
|
|
783
951
|
type ProductBulkCreateBody = Array<BasicProductCreation | BundleProductCreation | ParentVariantProductCreation | VariantProductCreation | DynamicVariantProductCreation>;
|
|
784
952
|
|
|
785
953
|
/** A product as returned by the Product service (all generated fields). */
|
|
786
|
-
type Product = BasicProductWithId | BundleProductWithId | ParentVariantProductWithId;
|
|
954
|
+
type Product = BasicProductWithId | BundleProductWithId | ParentVariantProductWithId | ProductVariant;
|
|
955
|
+
/**
|
|
956
|
+
* A product below a parent: a `VARIANT` of a `PARENT_VARIANT` (`parentVariantId`),
|
|
957
|
+
* or a `DYNAMIC_VARIANT` of any level (`parentVariantId` is the direct parent,
|
|
958
|
+
* `parentVariantPath` lists every ancestor up to the root).
|
|
959
|
+
*/
|
|
960
|
+
type ProductVariant = VariantProductWithId | DynamicVariantProductWithId;
|
|
787
961
|
/** A single product media entry (generated; `ProductMedia` is the list type). */
|
|
788
962
|
type Media = ProductMedia[number];
|
|
789
963
|
/** Body for creating a product (`POST /products`) — any of the 5 product shapes. */
|
|
@@ -836,7 +1010,9 @@ declare class ProductService {
|
|
|
836
1010
|
static readonly channel: "product";
|
|
837
1011
|
constructor(ctx: ClientContext);
|
|
838
1012
|
/** Fetches one product by id. */
|
|
839
|
-
get(productId: string,
|
|
1013
|
+
get(productId: string, auth?: AuthContext): Promise<Product>;
|
|
1014
|
+
/** @deprecated The second parameter is unused — pass the auth context second: `get(id, auth)`. */
|
|
1015
|
+
get(productId: string, opts: Record<string, never> | undefined, auth?: AuthContext): Promise<Product>;
|
|
840
1016
|
/** Fetches one product by its code. */
|
|
841
1017
|
getByCode(code: string, auth?: AuthContext): Promise<Product>;
|
|
842
1018
|
/** One page of products. */
|
|
@@ -903,22 +1079,27 @@ declare class ProductService {
|
|
|
903
1079
|
chunkSize?: number;
|
|
904
1080
|
}, auth?: AuthContext): Promise<Product[]>;
|
|
905
1081
|
/**
|
|
906
|
-
* Streams the
|
|
907
|
-
*
|
|
908
|
-
*
|
|
909
|
-
*
|
|
1082
|
+
* Streams the variants below a product, page by page, in two searches: the
|
|
1083
|
+
* VARIANT children of a PARENT_VARIANT (`productType:VARIANT
|
|
1084
|
+
* parentVariantId:<id>`), then the DYNAMIC_VARIANT descendants of every level
|
|
1085
|
+
* (`parentVariantPath:<id>` — every ancestor is in the path). Only one of the
|
|
1086
|
+
* two finds anything for a given product. Default pageSize 200. The query
|
|
1087
|
+
* syntax (space-separated fields = implicit AND) is encapsulated here so
|
|
1088
|
+
* consumers don't build it themselves.
|
|
910
1089
|
*/
|
|
911
1090
|
listVariantChildrenAll(parentVariantId: string, params?: {
|
|
912
1091
|
pageSize?: number;
|
|
913
|
-
}, auth?: AuthContext): AsyncIterable<
|
|
1092
|
+
}, auth?: AuthContext): AsyncIterable<ProductVariant>;
|
|
914
1093
|
/**
|
|
915
|
-
* Resolves
|
|
916
|
-
*
|
|
917
|
-
*
|
|
1094
|
+
* Resolves every variant below a product into a flat array (loads every
|
|
1095
|
+
* page): the VARIANT children of a PARENT_VARIANT, or the DYNAMIC_VARIANT
|
|
1096
|
+
* descendants of all levels — tell them apart by `parentVariantId` (the
|
|
1097
|
+
* direct parent) or pick the purchasable ones by `sellable`. Default pageSize
|
|
1098
|
+
* 200. Returns `[]` when there are none — never throws.
|
|
918
1099
|
*/
|
|
919
1100
|
listVariantChildren(parentVariantId: string, params?: {
|
|
920
1101
|
pageSize?: number;
|
|
921
|
-
}, auth?: AuthContext): Promise<
|
|
1102
|
+
}, auth?: AuthContext): Promise<ProductVariant[]>;
|
|
922
1103
|
/**
|
|
923
1104
|
* Creates a product (`POST /products`). Default auth: service. Accepts any of
|
|
924
1105
|
* the five product shapes (basic, bundle, parent-variant, variant,
|
|
@@ -1012,4 +1193,4 @@ declare class ProductService {
|
|
|
1012
1193
|
};
|
|
1013
1194
|
}
|
|
1014
1195
|
|
|
1015
|
-
export { type Media, type Product, type ProductBulkCreateInput, type ProductBulkResult, type ProductBulkUpdateInput, type ProductCreateInput, type ProductCreated, type ProductPatchInput, type ProductRecalculationInput, type ProductRecalculationJob, type ProductRecalculationJobStatus, type ProductRecalculationResult, ProductService, type ProductTemplate, type ProductTemplateCreateInput, type ProductTemplateCreated, type ProductTemplateUpdateInput, type ProductUpdateInput, type ProductWriteOptions };
|
|
1196
|
+
export { type Media, type Product, type ProductBulkCreateInput, type ProductBulkResult, type ProductBulkUpdateInput, type ProductCreateInput, type ProductCreated, type ProductPatchInput, type ProductRecalculationInput, type ProductRecalculationJob, type ProductRecalculationJobStatus, type ProductRecalculationResult, ProductService, type ProductTemplate, type ProductTemplateCreateInput, type ProductTemplateCreated, type ProductTemplateUpdateInput, type ProductUpdateInput, type ProductVariant, type ProductWriteOptions };
|