diff --git a/docs/changelog/0.0.1-alpha.2.md b/docs/changelog/0.0.1-alpha.2.md new file mode 100644 index 0000000..92af706 --- /dev/null +++ b/docs/changelog/0.0.1-alpha.2.md @@ -0,0 +1,106 @@ +# Interface Change Summary: 0.0.1-alpha.2 + +## New files +```diff ++ tax_customers.v3.ts +``` +## Modified files +### `catalog/category_trees_catalog.v3.ts` + +components.schemas.CategoryNode: +```diff ++ readonly url?: string; +``` + +### `customers.v3.ts` + +components.schemas.MetaFieldCollectionResponse: +```diff ++ readonly meta?: components["schemas"]["CollectionMeta"]; +``` + +components.responses: +```diff +- readonly MetafieldCollectionResponse: { +- headers: { +- readonly [name: string]: unknown; +- }; +- content: { +- readonly "application/json": { +- readonly items?: { +- readonly id: number; +- readonly key: string; +- readonly value: string; +- readonly namespace: string; +- readonly permission_set: "app_only" | "read" | "write" | "read_and_sf_access" | "write_and_sf_access"; +- readonly resource_type: "brand" | "product" | "variant" | "category" | "cart" | "channel" | "location" | "order" | "customer"; +- readonly resource_id: number; +- readonly description: string; +- readonly date_created: string; +- readonly date_modified: string; +- readonly owner_client_id?: string; +- }; +- }; +- }; +- }; +``` + +operations.getCustomersMetafields.responses: +```diff +- readonly 200: components["responses"]["MetafieldCollectionResponse"]; ++ readonly 200: { +``` + +operations.getCustomersMetafields.responses.200: +```diff ++ headers: { ++ readonly [name: string]: unknown; ++ content: { ++ readonly "application/json": { ++ readonly data?: readonly components["schemas"]["metafield_Full"][]; ++ readonly meta?: components["schemas"]["metaCollection_Full"]; ++ }; ++ }; ++ }; ++ }; +``` + +operations.getMetafieldsCustomerId.responses: +```diff +- readonly 200: components["responses"]["MetafieldCollectionResponse"]; ++ readonly 200: { +``` + +operations.getMetafieldsCustomerId.responses.200: +```diff ++ headers: { ++ readonly [name: string]: unknown; ++ }; ++ content: { ++ readonly "application/json": { ++ readonly data?: components["schemas"]["metafield_Full"]; ++ readonly meta?: components["schemas"]["metaEmpty_Full"]; ++ }; ++ }; ++ }; +``` + +### `tax_properties.v3.ts` + +components.schemas.Property: +```diff ++ readonly type?: "PRODUCT" | "CUSTOMER"; +``` + +components.schemas.PropertyPOST: +```diff ++ readonly type: "PRODUCT" | "CUSTOMER"; +``` + +### `tax_provider.ts` + +components.schemas."request-quote".customer: +```diff ++ readonly tax_properties?: readonly components["schemas"]["request-item-tax-property"][]; +``` + diff --git a/package.json b/package.json index 4bc6025..5e898aa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aligent/bigcommerce-api", - "version": "0.0.1-alpha.1", + "version": "0.0.1-alpha.2", "type": "module", "scripts": { "test": "tsd", @@ -55,7 +55,6 @@ "prettier": "^3.5.3", "rimraf": "^6.0.1", "simple-git": "^3.27.0", - "temp-dir": "^3.0.0", "ts-morph": "^25.0.1", "tsd": "^0.32.0", "tshy": "^3.0.2", diff --git a/src/internal/reference/files.json b/src/internal/reference/files.json index 46b0b37..126c205 100644 --- a/src/internal/reference/files.json +++ b/src/internal/reference/files.json @@ -61,6 +61,7 @@ "subscriptions.sf.yml", "tax.v3.yml", "tax_classes.v2.yml", + "tax_customers.v3.yml", "tax_properties.v3.yml", "tax_provider.yml", "tax_rates_zones.v3.yml", diff --git a/src/internal/reference/generate.js b/src/internal/reference/generate.js index be99729..10f0480 100644 --- a/src/internal/reference/generate.js +++ b/src/internal/reference/generate.js @@ -1,7 +1,6 @@ import { mkdir, rename, rm, writeFile } from 'fs/promises'; import { basename, dirname, join } from 'node:path'; import openapiTS, { astToString } from 'openapi-typescript'; -import tempDir from 'temp-dir'; import { Project } from 'ts-morph'; import { v4 as uuid } from 'uuid'; import packageJson from '../../../package.json' with { type: 'json' }; @@ -188,7 +187,10 @@ async function main() { await replaceDir(tempOutputDir, outputDir); } catch (error) { console.error('Failed to generate TypeScript types:', error); - process.exit(1); + process.exitCode = 1; + } finally { + // Clean up the temporary build directory + await rm(tempOutputDir, { recursive: true, force: true }); } } diff --git a/src/internal/reference/generated/catalog/category_trees_catalog.v3.ts b/src/internal/reference/generated/catalog/category_trees_catalog.v3.ts index b6f313b..dfcedd3 100644 --- a/src/internal/reference/generated/catalog/category_trees_catalog.v3.ts +++ b/src/internal/reference/generated/catalog/category_trees_catalog.v3.ts @@ -312,6 +312,7 @@ export interface components { readonly name?: string; readonly is_visible?: boolean; readonly children?: readonly components["schemas"]["CategoryNode"][]; + readonly url?: string; }; readonly MetaPaginationObject: { readonly pagination?: { diff --git a/src/internal/reference/generated/channels.v3.ts b/src/internal/reference/generated/channels.v3.ts index 168f525..d522c6d 100644 --- a/src/internal/reference/generated/channels.v3.ts +++ b/src/internal/reference/generated/channels.v3.ts @@ -220,6 +220,13 @@ export interface paths { /** * Upsert a Siteʼs Checkout URL * @description Creates or updates (upserts) a siteʼs checkout URL + * + * + * For the "urls" object, we no longer modify the `www` prefix of the primary URL. The API returns URLs exactly as the customer enters them, similar to the "url" field. + * + * * If the customer saves a URL with `www`, the API returns it with `www`. + * * If the customer saves a URL without `www`, the API returns it without `www`. + * */ readonly put: operations["updateCheckoutUrl"]; /** @@ -247,16 +254,37 @@ export interface paths { * * Returns site data for the specified channel. * + * + * For the "urls" object, we no longer modify the `www` prefix of the primary URL. The API returns URLs exactly as the customer enters them, similar to the "url" field. + * + * * If the customer saves a URL with `www`, the API returns it with `www`. + * * If the customer saves a URL without `www`, the API returns it without `www`. + * + * */ readonly get: operations["getChannelSite"]; /** * Update a Channel Site * @description Updates a site for provided channel. + * + * + * For the "urls" object, we no longer modify the `www` prefix of the primary URL. The API returns URLs exactly as the customer enters them, similar to the "url" field. + * + * * If the customer saves a URL with `www`, the API returns it with `www`. + * * If the customer saves a URL without `www`, the API returns it without `www`. + * */ readonly put: operations["updateChannelSite"]; /** * Create a Channel Site * @description Alias of POST `/sites`. Creates a site for provided channel. + * + * + * For the "urls" object, we no longer modify the `www` prefix of the primary URL. The API returns URLs exactly as the customer enters them, similar to the "url" field. + * + * * If the customer saves a URL with `www`, the API returns it with `www`. + * * If the customer saves a URL without `www`, the API returns it without `www`. + * */ readonly post: operations["createChannelSite"]; /** diff --git a/src/internal/reference/generated/customers.v3.ts b/src/internal/reference/generated/customers.v3.ts index c7f8faa..678a69a 100644 --- a/src/internal/reference/generated/customers.v3.ts +++ b/src/internal/reference/generated/customers.v3.ts @@ -396,7 +396,7 @@ export interface paths { }; /** * Get a Customer Metafield - * @description Lists available metafields for a customer. To retrieve the list, use `customerId` and `metafieldId` in the query parameters. + * @description Returns a single *Customer Metafield*. * */ readonly get: operations["getMetafieldsCustomerId"]; @@ -1442,6 +1442,7 @@ export interface components { * */ readonly MetaFieldCollectionResponse: { readonly data?: readonly components["schemas"]["Metafield"][]; + readonly meta?: components["schemas"]["CollectionMeta"]; }; /** @description Response payload for the BigCommerce API. */ readonly MetaFieldCollectionPostPutResponses: { @@ -2249,88 +2250,6 @@ export interface components { }; }; }; - /** @description Response payload for the BigCommerce API. */ - readonly MetafieldCollectionResponse: { - headers: { - readonly [name: string]: unknown; - }; - content: { - readonly "application/json": { - readonly items?: { - /** - * @description Unique ID of the *Metafield*. Read-Only. - * @example 0 - */ - readonly id: number; - /** - * @description The key for the metafields. - * @example Staff Name - */ - readonly key: string; - /** - * @description The description for the metafield. - * @example Ronaldo - */ - readonly value: string; - /** - * @description Namespace for the metafield, for organizational purposes. - * - * @example Sales Department - */ - readonly namespace: string; - /** - * @description Determines the visibility and writeability of the field by other API consumers. - * | Value | Description | - * | :--- | :--- | - * | `app_only` | Private to the app that owns the field. | - * | `read` | Visible to other API consumers. | - * | `write` | Open for reading and writing by other API consumers. | - * | `read_and_sf_access` | Visible to other API consumers, including on storefront. | - * | `write_and_sf_access` | Open for reading and writing by other API consumers, including on storefront. | - * - * @enum {string} - */ - readonly permission_set: "app_only" | "read" | "write" | "read_and_sf_access" | "write_and_sf_access"; - /** - * @description The type of resource with which the metafield is associated. - * - * @example cart - * @enum {string} - */ - readonly resource_type: "brand" | "product" | "variant" | "category" | "cart" | "channel" | "location" | "order" | "customer"; - /** - * @description The unique identifier for the resource with which the metafield is associated. - * - * @example 0 - */ - readonly resource_id: number; - /** - * @description Description for the metafields. - * - * @example order - */ - readonly description: string; - /** - * Format: date-time - * @description Date and time of the metafieldʼs creation. - * @example 2022-06-16T18:39:00+00:00 - */ - readonly date_created: string; - /** - * Format: date-time - * @description Date and time when the metafield was last updated. - * @example 2022-06-16T18:39:00+00:00 - */ - readonly date_modified: string; - /** - * @description Client ID for the metafield's creator. - * @example ramciw4fnoz87it3ynjfif2zrkil5p - */ - readonly owner_client_id?: string; - }; - }; - }; - }; readonly consent_Resp: { headers: { readonly [name: string]: unknown; @@ -3246,7 +3165,18 @@ export interface operations { }; readonly requestBody?: never; readonly responses: { - readonly 200: components["responses"]["MetafieldCollectionResponse"]; + /** @description Response payload for the BigCommerce API. */ + readonly 200: { + headers: { + readonly [name: string]: unknown; + }; + content: { + readonly "application/json": { + readonly data?: readonly components["schemas"]["metafield_Full"][]; + readonly meta?: components["schemas"]["metaCollection_Full"]; + }; + }; + }; }; }; readonly createCustomerMetafields: { @@ -3323,7 +3253,17 @@ export interface operations { }; readonly requestBody?: never; readonly responses: { - readonly 200: components["responses"]["MetafieldCollectionResponse"]; + readonly 200: { + headers: { + readonly [name: string]: unknown; + }; + content: { + readonly "application/json": { + readonly data?: components["schemas"]["metafield_Full"]; + readonly meta?: components["schemas"]["metaEmpty_Full"]; + }; + }; + }; /** @description Not found (A metafield was not found with this query). * */ readonly 404: { diff --git a/src/internal/reference/generated/exports/v3.ts b/src/internal/reference/generated/exports/v3.ts index dd6e597..a1f857f 100644 --- a/src/internal/reference/generated/exports/v3.ts +++ b/src/internal/reference/generated/exports/v3.ts @@ -43,6 +43,7 @@ import type * as store_logs from "../store_logs.v3.js"; import type * as storefront_tokens from "../storefront_tokens.v3.js"; import type * as subscribers from "../subscribers.v3.js"; import type * as tax from "../tax.v3.js"; +import type * as tax_customers from "../tax_customers.v3.js"; import type * as tax_properties from "../tax_properties.v3.js"; import type * as tax_rates_zones from "../tax_rates_zones.v3.js"; import type * as tax_settings from "../tax_settings.v3.js"; @@ -91,6 +92,7 @@ export type Operation = & InferOperationIndex & InferOperationIndex & InferOperationIndex + & InferOperationIndex & InferOperationIndex & InferOperationIndex & InferOperationIndex diff --git a/src/internal/reference/generated/tax_customers.v3.ts b/src/internal/reference/generated/tax_customers.v3.ts new file mode 100644 index 0000000..464cf3e --- /dev/null +++ b/src/internal/reference/generated/tax_customers.v3.ts @@ -0,0 +1,185 @@ +/** + * This file was auto-generated by openapi-typescript and ts-morph. + * Do not make direct changes to the file. + */ + +export interface paths { + readonly "/tax/customers": { + readonly parameters: { + readonly query?: never; + readonly header: { + /** @description The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the request body. */ + readonly "Content-Type": components["parameters"]["ContentType"]; + }; + readonly path?: never; + readonly cookie?: never; + }; + /** + * Get Tax Customers + * @description Retrieves a list of customer tax data. + */ + readonly get: operations["getTaxCustomers"]; + /** + * Update Tax Customers + * @description Update the tax data associated with one or more customers. + * This operation will be additive to any values already associated with the customer, overwriting any existing values. + */ + readonly put: operations["updateTaxCustomers"]; + /** + * Delete Tax Customers + * @description Delete tax data that is associated with one or more customers. + */ + readonly delete: operations["deleteTaxCustomers"]; + }; +} +export type webhooks = Record; +export interface components { + schemas: { + /** @description Represents a customer and their associated tax-related attributes. */ + readonly TaxCustomer: { + /** + * @description A reference to the customer. + * @example 157 + */ + readonly customer_id: number; + /** + * @description A simple key-value pairing. + * The tax property must be defined to associate a value. + * These values will be sent to the active tax provider during Tax Provider API operations whenever the associated customer is included in the operation. + * @example { + * "A-123456789": "26", + * "B-6731789": "200" + * } + */ + readonly tax_properties: { + readonly [key: string]: unknown; + }; + }; + /** + * Response meta + * @description Response metadata. + */ + readonly MetaOpen: { + readonly [key: string]: unknown; + }; + }; + responses: never; + parameters: { + /** @description The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the response body. */ + readonly Accept: string; + /** @description The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the request body. */ + readonly ContentType: string; + /** @description ID of customer. To target multiple customers, provide a comma-separated list of IDs such as `12,34,56`. */ + readonly customer_idin: readonly number[]; + }; + requestBodies: never; + headers: never; + pathItems: never; +} +export type $defs = Record; +export interface operations { + readonly getTaxCustomers: { + readonly parameters: { + readonly query?: { + /** @description ID of customer. To target multiple customers, provide a comma-separated list of IDs such as `12,34,56`. */ + readonly "customer_id:in"?: components["parameters"]["customer_idin"]; + }; + readonly header?: { + /** @description The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the request body. */ + readonly "Content-Type"?: components["parameters"]["ContentType"]; + }; + readonly path?: never; + readonly cookie?: never; + }; + readonly requestBody?: never; + readonly responses: { + /** @description OK */ + readonly 200: { + headers: { + readonly [name: string]: unknown; + }; + content: { + readonly "application/json": { + readonly data?: readonly components["schemas"]["TaxCustomer"][]; + readonly meta?: components["schemas"]["MetaOpen"]; + }; + }; + }; + /** @description Request parameters invalid */ + readonly 400: { + headers: { + readonly [name: string]: unknown; + }; + content?: never; + }; + }; + }; + readonly updateTaxCustomers: { + readonly parameters: { + readonly query?: never; + readonly header?: { + /** @description The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the request body. */ + readonly "Content-Type"?: components["parameters"]["ContentType"]; + }; + readonly path?: never; + readonly cookie?: never; + }; + readonly requestBody: { + readonly content: { + readonly "application/json": readonly components["schemas"]["TaxCustomer"][]; + }; + }; + readonly responses: { + /** @description OK */ + readonly 200: { + headers: { + readonly [name: string]: unknown; + }; + content: { + readonly "application/json": { + readonly data?: readonly components["schemas"]["TaxCustomer"][]; + readonly meta?: components["schemas"]["MetaOpen"]; + }; + }; + }; + /** @description The request body does not meet specifications. */ + readonly 422: { + headers: { + readonly [name: string]: unknown; + }; + content?: never; + }; + }; + }; + readonly deleteTaxCustomers: { + readonly parameters: { + readonly query?: { + /** @description ID of customer. To target multiple customers, provide a comma-separated list of IDs such as `12,34,56`. */ + readonly "customer_id:in"?: components["parameters"]["customer_idin"]; + }; + readonly header?: { + /** @description The [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) of the request body. */ + readonly "Content-Type"?: components["parameters"]["ContentType"]; + }; + readonly path?: never; + readonly cookie?: never; + }; + readonly requestBody?: never; + readonly responses: { + /** @description No Content */ + readonly 204: { + headers: { + readonly [name: string]: unknown; + }; + content?: never; + }; + /** @description Request parameters invalid */ + readonly 400: { + headers: { + readonly [name: string]: unknown; + }; + content?: never; + }; + }; + }; +} diff --git a/src/internal/reference/generated/tax_properties.v3.ts b/src/internal/reference/generated/tax_properties.v3.ts index 1f9dd97..0502a75 100644 --- a/src/internal/reference/generated/tax_properties.v3.ts +++ b/src/internal/reference/generated/tax_properties.v3.ts @@ -98,6 +98,12 @@ export interface components { * @example 2022-07-21T19:33:57+00:00 */ readonly updated_at?: string; + /** + * @description The type of entity that the tax property can be associated with. + * @example PRODUCT + * @enum {string} + */ + readonly type?: "PRODUCT" | "CUSTOMER"; }; readonly PropertyPOST: { /** @@ -115,6 +121,12 @@ export interface components { * @example Food Industry */ readonly description?: string; + /** + * @description The type of entity that the tax property can be associated with. Default + * @example PRODUCT + * @enum {string} + */ + readonly type: "PRODUCT" | "CUSTOMER"; }; readonly PropertyPUT: { /** diff --git a/src/internal/reference/generated/tax_provider.ts b/src/internal/reference/generated/tax_provider.ts index 0c331b2..ab0418f 100644 --- a/src/internal/reference/generated/tax_provider.ts +++ b/src/internal/reference/generated/tax_provider.ts @@ -132,7 +132,7 @@ export interface components { * @default false */ readonly tax_exempt: boolean; - /** @description Merchants may opt to include additional properties that a tax provider can choose to support, factoring these values into tax calculation. */ + /** @description Merchants may opt to include additional properties that a tax provider can choose to support, factoring these values into tax calculation. See [Tax Properties API](/docs/rest-management/tax-properties) for more information on configuring tax properties. */ readonly tax_properties?: readonly components["schemas"]["request-item-tax-property"][]; }; /** @@ -198,10 +198,12 @@ export interface components { readonly customer_group_id: string; /** @description If applicable, the tax exemption code of the shopper’s customer account. A taxability code is intended to apply to multiple customers. This code should match the exemption codes provided by the third-party integration. */ readonly taxability_code?: string; + /** @description Any tax property values that have been associated with this customer. See [Tax Properties API](/docs/rest-management/tax-properties) for more information on configuring tax properties. */ + readonly tax_properties?: readonly components["schemas"]["request-item-tax-property"][]; }; /** * Format: date-time - * @description ISO 8601 formatted date the shopper placed this order. Dates will be provided in UTC. + * @description ISO 8601 formatted date the shopper placed this order. Tax quotes are expected to reflect taxes applicable on this date. Dates will be provided in UTC. */ readonly transaction_date: string; /** @description One or more consignments containing items being purchased by the shopper, including shipping and handling fees that are charged for each consignment. Most orders will contain a single consignment (to a single shipping address), however the BigCommerce platform also supports "Multi-address orders" which allow shoppers to place a single order with items shipped to different addresses. */ diff --git a/test-d/v3/customers/customer-get-metafield.ts b/test-d/v3/customers/customer-get-metafield.ts index 6fa34f0..8d47b1e 100644 --- a/test-d/v3/customers/customer-get-metafield.ts +++ b/test-d/v3/customers/customer-get-metafield.ts @@ -9,37 +9,24 @@ export default (client: Client) => { }, }) .then(response => { - // @ts-expect-error - Change this test if BigCommerce fixes the documentation: https://github.com/bigcommerce/docs/issues/912 expectType(response); }); }; type Expected = { - readonly items?: { - readonly id: number; - readonly key: string; - readonly value: string; - readonly namespace: string; - readonly permission_set: - | 'app_only' - | 'read' - | 'write' - | 'read_and_sf_access' - | 'write_and_sf_access'; - readonly resource_type: - | 'cart' - | 'customer' - | 'location' - | 'product' - | 'category' - | 'brand' - | 'order' - | 'variant' - | 'channel'; - readonly resource_id: number; - readonly description: string; - readonly date_created: string; - readonly date_modified: string; - readonly owner_client_id?: string; - }; -}; + readonly value: string; + readonly key: string; + readonly description: string; + readonly id: number; + readonly date_created: string; + readonly date_modified: string; + readonly resource_id: number; + readonly namespace: string; + readonly permission_set: + | 'app_only' + | 'read' + | 'write' + | 'read_and_sf_access' + | 'write_and_sf_access'; + readonly resource_type: 'category' | 'brand' | 'product' | 'variant' | 'customer'; +} | null; diff --git a/yarn.lock b/yarn.lock index 6a428a2..a386ca9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20,7 +20,6 @@ __metadata: query-string: "npm:^9.1.1" rimraf: "npm:^6.0.1" simple-git: "npm:^3.27.0" - temp-dir: "npm:^3.0.0" ts-morph: "npm:^25.0.1" tsd: "npm:^0.32.0" tshy: "npm:^3.0.2" @@ -4209,13 +4208,6 @@ __metadata: languageName: node linkType: hard -"temp-dir@npm:^3.0.0": - version: 3.0.0 - resolution: "temp-dir@npm:3.0.0" - checksum: 10c0/a86978a400984cd5f315b77ebf3fe53bb58c61f192278cafcb1f3fb32d584a21dc8e08b93171d7874b7cc972234d3455c467306cc1bfc4524b622e5ad3bfd671 - languageName: node - linkType: hard - "tinyglobby@npm:^0.2.12": version: 0.2.13 resolution: "tinyglobby@npm:0.2.13"