diff --git a/sdk-output/index.spec.ts b/sdk-output/index.spec.ts index d360a06b..1084eacc 100644 --- a/sdk-output/index.spec.ts +++ b/sdk-output/index.spec.ts @@ -1,5 +1,5 @@ import { SailPoint, Configuration, Paginator, UsersNERMApi, DelegationsNERMV2025Api } from "./index" -import type { SearchV1 } from "./search/api" +import type { Search } from "./search/api" describe('accounts', () => { it('list accounts', async () => { @@ -89,7 +89,7 @@ describe('search', () => { let apiConfig = new Configuration() let api = new SailPoint.SearchApi(apiConfig) - let search: SearchV1 = { + let search: Search = { indices: [ "identities" ], diff --git a/sdk-output/paginator.ts b/sdk-output/paginator.ts index 3e2c45d0..163dddaa 100644 --- a/sdk-output/paginator.ts +++ b/sdk-output/paginator.ts @@ -1,8 +1,8 @@ import type { AxiosResponse, RawAxiosRequestConfig } from "axios"; import { - SearchV1, - SearchV1Api, - SearchV1ApiSearchPostV1Request, + Search, + SearchApi, + SearchApiSearchPostV1Request, } from "./search/api"; export interface PaginationParams { @@ -38,9 +38,9 @@ export interface ExtraParams { } interface SearchApiTypeMap { - SearchV1Api: { - search: SearchV1; - searchParams: SearchV1ApiSearchPostV1Request; + SearchApi: { + search: Search; + searchParams: SearchApiSearchPostV1Request; document: object; }; } @@ -48,7 +48,7 @@ interface SearchApiTypeMap { type ApiType = keyof SearchApiTypeMap; type ApiInstanceMap = { - SearchV1Api: SearchV1Api; + SearchApi: SearchApi; }; export class Paginator { @@ -174,11 +174,11 @@ export class Paginator { let results: AxiosResponse; try { - const searchParams: SearchV1ApiSearchPostV1Request = { - searchV1: search as SearchV1, + const searchParams: SearchApiSearchPostV1Request = { + search: search as Search, limit: increment, }; - results = (await (searchAPI as SearchV1Api).searchPostV1( + results = (await (searchAPI as SearchApi).searchPostV1( searchParams )) as AxiosResponse; } catch (e: any) { @@ -235,11 +235,11 @@ export class Paginator { let results: AxiosResponse; try { - const searchParams: SearchV1ApiSearchPostV1Request = { - searchV1: search as SearchV1, + const searchParams: SearchApiSearchPostV1Request = { + search: search as Search, limit: increment, }; - results = (await (searchAPI as SearchV1Api).searchPostV1( + results = (await (searchAPI as SearchApi).searchPostV1( searchParams )) as AxiosResponse; } catch (e: any) { diff --git a/sdk-resources/build-versioned-sdk.js b/sdk-resources/build-versioned-sdk.js index 6d736f75..83d4df4f 100644 --- a/sdk-resources/build-versioned-sdk.js +++ b/sdk-resources/build-versioned-sdk.js @@ -232,7 +232,6 @@ function writePartitionConfig(partitionName) { `npmVersion: ${NPM_VERSION}`, `useSingleRequestParameter: true`, `apiVersion: ${API_VERSION}`, - `enumNameSuffix: V1`, `packageName: ${packageDir}`, ].join("\n"); @@ -263,8 +262,7 @@ function generatePartition(partitionName, bundledSpec, configPath) { "-o", outputDir, "--global-property", "skipFormModel=false,apiDocs=true,modelDocs=true", "--config", configPath, - "--api-name-suffix", "V1Api", - "--model-name-suffix", "V1", + "--api-name-suffix", "Api", ], { encoding: "utf8" } ); @@ -425,15 +423,15 @@ node sdk-resources/build-versioned-sdk.js // Regenerate sdk-output/index.ts from discovered partition packages // // Naming convention in the SailPoint namespace: -// Generated class AccountsV1Api → SailPoint.AccountsApi -// Generated class AccountsV2Api → still SailPoint.AccountsApi (combined) +// Generated class AccountsApi → SailPoint.AccountsApi +// Two partitions for same resource → combined class (extends latest, copies older methods) // -// The version suffix is stripped from the namespace name so the import never -// changes as new versions land. Method names carry the version suffix -// (listAccountsV1, listAccountsV2) so you always know which version you're -// calling. +// API class names carry no version suffix — versions live only in method names +// (listAccountsV1, listAccountsV2) so callers always know which version they call. +// Model names also carry no generated suffix; any version in a model name comes +// from the spec itself (e.g. accessrequestconfigv2 → AccessrequestconfigV2). // -// Single-version resource → const AccountsApi = _AccountsV1Api +// Single-version resource → const AccountsApi = _AccountsApi // Multi-version resource → generated combined class that extends the // latest version and copies older-version prototype methods, with // TypeScript interface merging for full type safety on all methods. @@ -444,12 +442,18 @@ node sdk-resources/build-versioned-sdk.js // import type { AccountV1 } from "sailpoint-api-client/accounts_v1/api" // --------------------------------------------------------------------------- -/** AccountsV1Api → AccountsApi */ +/** + * AccountsApi → AccountsApi (no-op for single-version; strips Vn for hypothetical + * future multi-version partitions whose class names include a version, e.g. AccountsV2Api). + */ function toResourceApiName(className) { return className.replace(/V\d+Api$/, "Api"); } -/** Extract the numeric version from a class name: AccountsV1Api → 1 */ +/** + * Extract the numeric version from a class name if present (e.g. AccountsV2Api → 2). + * Defaults to 1 so single-version classes (e.g. AccountsApi) sort correctly. + */ function classVersion(className) { return parseInt(className.match(/V(\d+)Api$/)?.[1] ?? "1", 10); } @@ -542,12 +546,12 @@ function generateIndexTs() { /* eslint-disable */ // Code generated by build-versioned-sdk.js; DO NOT EDIT. // -// Named imports — backward-compatible, version-explicit: -// import { AccountsV1Api, Configuration } from "sailpoint-api-client" +// Named imports — version-explicit class names: +// import { AccountsApi, Configuration } from "sailpoint-api-client" // // Namespace — resource-named, version-agnostic (preferred): // import { SailPoint, Configuration } from "sailpoint-api-client" -// const api = new SailPoint.AccountsApi(config) // works for v1, v2, v3 … +// const api = new SailPoint.AccountsApi(config) // api.listAccountsV1(...) // method name shows version // api.listAccountsV2(...) // when v2 partition lands // @@ -591,7 +595,7 @@ ${nsLines.join("\n")} // Main // --------------------------------------------------------------------------- -async function main() { +function main() { if (!fs.existsSync(apisDir)) { console.error(`Error: apis directory not found: ${apisDir}`); process.exit(1); @@ -741,7 +745,4 @@ async function main() { } } -main().catch(err => { - console.error(`Unexpected error: ${err.message}`); - process.exit(1); -}); +main();