Conversation
…object types Square's catalog API supports both `SUBSCRIPTION_PLAN` (template) and `SUBSCRIPTION_PLAN_VARIATION` (the actual subscribable record whose ID is passed as `planVariationId` to `subscriptions.create`) as catalog object types. Both were missing from the `CatalogObjectType` union, which made it impossible to list available plans via `catalog.search`/`catalog.list` from the wrapper. This is a TypeScript-only change — Square already accepts these values on the underlying API, the wrapper just didn't declare them. Updates the catalog guide table and the README service-class summary to mention subscription plan listing. Closes #67
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #68 +/- ##
=======================================
Coverage 97.06% 97.06%
=======================================
Files 18 18
Lines 955 955
Branches 277 277
=======================================
Hits 927 927
Misses 1 1
Partials 27 27 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Extends the Catalog service’s TypeScript surface area to include Square Catalog object types for subscription plans and plan variations, enabling consumers to enumerate available subscription offerings via catalog.search/catalog.list without type errors.
Changes:
- Added
SUBSCRIPTION_PLANandSUBSCRIPTION_PLAN_VARIATIONto theCatalogObjectTypeunion. - Added a TypeScript-usage test that exercises
CatalogService.search({ objectTypes: [...] })with the new object types. - Updated catalog documentation and README to mention subscription plan listing support.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/core/services/catalog.service.ts |
Adds the two subscription-related catalog object types to CatalogObjectType. |
src/core/__tests__/catalog.service.test.ts |
Adds a test covering search() acceptance of the new object types. |
docs/guides/core/catalog.md |
Documents the two new catalog object types in the guide table. |
README.md |
Mentions subscription plan listing as part of Catalog service capabilities. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🎉 This PR is included in version 1.11.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Adds
SUBSCRIPTION_PLAN(template) andSUBSCRIPTION_PLAN_VARIATION(the actual subscribable record whose ID is passed asplanVariationIdtosubscriptions.create) to theCatalogObjectTypeunion so consumers can list available subscription plans viacatalog.search/catalog.list.This is a TypeScript-only change — Square already accepts these values on the underlying API; the wrapper just didn't declare them.
Closes #67.
Why
The Subscriptions service has full coverage for create/get/update/pause/resume/cancel/search, but there was no way to enumerate available plans for a "pick a plan" admin UI. Without the catalog types,
catalog.search({ objectTypes: ['SUBSCRIPTION_PLAN'] })was a TypeScript error and there was no alternate path.Changes
src/core/services/catalog.service.tsCatalogObjectTypesrc/core/__tests__/catalog.service.test.tssearch()accepts both asobjectTypes(locks the type at use site)docs/guides/core/catalog.mdREADME.mdHow Has This Been Tested?
Test plan
square.catalog.search({ objectTypes: ['SUBSCRIPTION_PLAN'] })andsquare.catalog.search({ objectTypes: ['SUBSCRIPTION_PLAN_VARIATION'] })typecheck and return Square's expected payloads