Skip to content

Feat: Remove API Family Layer (@W-18726388@)#425

Merged
joeluong-sfcc merged 4 commits intofeature/oasfrom
ju/remove-api-family
Jul 7, 2025
Merged

Feat: Remove API Family Layer (@W-18726388@)#425
joeluong-sfcc merged 4 commits intofeature/oasfrom
ju/remove-api-family

Conversation

@joeluong-sfcc
Copy link
Collaborator

@joeluong-sfcc joeluong-sfcc commented Jul 2, 2025

The intention of this PR was to remove the API family layer, however, since the OAS commerce SDK is modeled after the OAS Isomorphic SDK, the current version of the OAS SDK is already implemented without the API family layer, without any typescript naming collision issues.

This PR removes the namespace surrounding all the API classes, as this is redundant after introducing the <apiName>Types namespace, such as ShopperProductsTypes or ShopperLoginTypes, which solves the same problem of preventing naming collisions. This is much more straightforward so you can call ShopperLogin without needing to use ShopperLogin.ShopperLogin

Example of what the top level index.ts file looks like. As you can see, we do not export under API family namespace and export the classes directly.

export { Assignments } from "./assignments";
import type * as AssignmentsTypes from "./assignments";
export type { AssignmentsTypes };
export { Campaigns } from "./campaigns";
import type * as CampaignsTypes from "./campaigns";
export type { CampaignsTypes };
export { CatalogsV1 } from "./catalogs";
import type * as CatalogsV1Types from "./catalogs";
export type { CatalogsV1Types };
export { CDNZones } from "./cdnApiProcessApis";
import type * as CDNZonesTypes from "./cdnApiProcessApis";
export type { CDNZonesTypes };
export { Coupons } from "./coupons";
import type * as CouponsTypes from "./coupons";
export type { CouponsTypes };
export { Customers } from "./customers";
import type * as CustomersTypes from "./customers";
export type { CustomersTypes };
export { ShopperCustomers } from "./shopperCustomers";
import type * as ShopperCustomersTypes from "./shopperCustomers";
export type { ShopperCustomersTypes };
export { GiftCertificates } from "./giftCertificates";
import type * as GiftCertificatesTypes from "./giftCertificates";
export type { GiftCertificatesTypes };
export { ShopperGiftCertificates } from "./shopperGiftCertificates";
import type * as ShopperGiftCertificatesTypes from "./shopperGiftCertificates";
export type { ShopperGiftCertificatesTypes };
export { Orders } from "./orders";
import type * as OrdersTypes from "./orders";
export type { OrdersTypes };
export { ShopperOrders } from "./shopperOrders";
import type * as ShopperOrdersTypes from "./shopperOrders";
export type { ShopperOrdersTypes };
export { CORSPreferences } from "./corsPreferences";
import type * as CORSPreferencesTypes from "./corsPreferences";
export type { CORSPreferencesTypes };
export { Preferences } from "./preferences";
import type * as PreferencesTypes from "./preferences";
export type { PreferencesTypes };
export { Products } from "./products";
import type * as ProductsTypes from "./products";
export type { ProductsTypes };
export { ShopperProducts } from "./shopperProducts";
import type * as ShopperProductsTypes from "./shopperProducts";
export type { ShopperProductsTypes };
export { Promotions } from "./promotions";
import type * as PromotionsTypes from "./promotions";
export type { PromotionsTypes };
export { ShopperPromotions } from "./shopperPromotions";
import type * as ShopperPromotionsTypes from "./shopperPromotions";
export type { ShopperPromotionsTypes };
export { ShopperSearch } from "./shopperSearch";
import type * as ShopperSearchTypes from "./shopperSearch";
export type { ShopperSearchTypes };
export { Seo } from "./seo";
import type * as SeoTypes from "./seo";
export type { SeoTypes };
export { ShopperSEO } from "./shopperSeo";
import type * as ShopperSEOTypes from "./shopperSeo";
export type { ShopperSEOTypes };
export { ShopperBasketsV1 } from "./shopperBaskets";
import type * as ShopperBasketsV1Types from "./shopperBaskets";
export type { ShopperBasketsV1Types };
export { ShopperBasketsV2 } from "./shopperBasketsv2";
import type * as ShopperBasketsV2Types from "./shopperBasketsv2";
export type { ShopperBasketsV2Types };
export { ShopperContexts } from "./shopperContext";
import type * as ShopperContextsTypes from "./shopperContext";
export type { ShopperContextsTypes };
export { ShopperExperience } from "./shopperExperience";
import type * as ShopperExperienceTypes from "./shopperExperience";
export type { ShopperExperienceTypes };
export { ShopperLogin } from "./shopperLogin";
import type * as ShopperLoginTypes from "./shopperLogin";
export type { ShopperLoginTypes };
export { ShopperStores } from "./shopperStores";
import type * as ShopperStoresTypes from "./shopperStores";
export type { ShopperStoresTypes };
export { SlasAdmin } from "./slasAdmin";
import type * as SlasAdminTypes from "./slasAdmin";
export type { SlasAdminTypes };
export { SourceCodeGroups } from "./sourceCodeGroups";
import type * as SourceCodeGroupsTypes from "./sourceCodeGroups";
export type { SourceCodeGroupsTypes };

import * as helpers from "./helpers";
export { helpers };

export { ClientConfig, CommonParameters, sdkLogger } from "@commerce-apps/core"

@joeluong-sfcc joeluong-sfcc marked this pull request as ready for review July 2, 2025 16:33
@joeluong-sfcc joeluong-sfcc requested a review from a team as a code owner July 2, 2025 16:33
Copy link
Contributor

@vcua-mobify vcua-mobify left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I ran the generator and have verified that the namespaces are no longer there in the generated APIs. APIs like ShopperContext and Catalog which in the past had naming collisions did not have any.

@joeluong-sfcc joeluong-sfcc merged commit 77f766a into feature/oas Jul 7, 2025
7 checks passed
@joeluong-sfcc joeluong-sfcc deleted the ju/remove-api-family branch July 7, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants