feat!: sync SDK with OpenAPI spec, remove stale resources, v3.0.0#170
Conversation
Fix schema generation regex escaping bug that broke Prettier since April 17. Regenerate buyer schemas from live spec. Remove all storefront-only and deprecated resources (agents, billing/storefront, inventory-sources, notifications, readiness, bundles, signals, sales-agents, conversion-events, creative-sets). Add missing buyer endpoints (discovery, accounts, planning-briefs, moderation, storefronts, audit-logs, notification-preferences). Replace typed campaign creation methods with generic create/update/delete. BREAKING CHANGE: Storefront persona removed. Multiple resources deleted. Campaign API surface changed from typed methods to generic CRUD.
| }); | ||
| }); | ||
| describe('removed', () => { | ||
| it.todo('resource removed in v3'); |
There was a problem hiding this comment.
if the resource is gone, just delete the test file - the describe('removed') placeholder is noise. also 'resource removed in v3' is a temporal reference in code (same issue with the other it.todo stubs across the removed test files)
| throw new Error(`Unknown persona: ${_exhaustive}`); | ||
| } | ||
| } | ||
| this._advertisers = new AdvertisersResource(this.adapter); |
There was a problem hiding this comment.
the exhaustive switch with _exhaustive: never caught unhandled personas at compile time - now that it's gone, new Scope3Client({ persona: 'storefront' }) silently gets buyer resources with no error. if storefront persona is being dropped, narrow Persona to 'buyer'. if not, the behavior change is a footgun
| brief?: string; | ||
| constraints?: CampaignConstraints; | ||
| performanceConfig?: PerformanceConfig; | ||
| [key: string]: unknown; |
There was a problem hiding this comment.
this index signature effectively turns off the type checker for CreateCampaignInput - anything goes. if campaign types need different optional fields depending on type, a discriminated union would be safer. intentional?
| result.data = validateResponse(campaignSchemas.response, result.data) as unknown as Campaign; | ||
| } | ||
| return result; | ||
| async create(data: CreateCampaignInput): Promise<ApiResponse<Campaign>> { |
There was a problem hiding this comment.
the old typed create methods called validateResponse(campaignSchemas.response, ...) - dropped here. intentional?
| * @param data Optional configuration for product selection | ||
| * @returns Auto-selection result | ||
| */ | ||
| async autoSelectProducts( |
There was a problem hiding this comment.
are response shapes defined in the spec for autoSelectProducts, getMediaBuyStatus, getProducts? if so worth typing them rather than Record<string, unknown>
Summary
Test plan
tsc --noEmitpassesnpm run detect-driftto confirm reduced endpoint drift