Repository navigation
List linked catalog products in CLI #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6d096cf
feat(cli): list linked catalog products
purpshell b29c992
Merge commit '7410e0078f455fde6a7b0efdf0d71c87edf515b9' into codex/cl…
purpshell fd4c6a5
style(cli): format catalog products command
purpshell 5622536
Merge commit 'a57f0811ed55c27bd2ebd2a63130ff957960e1cc' into codex/cl…
purpshell eaee933
Merge commit 'f75adb9fab7e99ab378abe4ac581a5f320b99fdc' into codex/cl…
purpshell 2c2f3a0
Merge CLI dev with the published SDK pin
purpshell fb8d4d9
Test linked catalog product listing
purpshell 9410bbc
Type the parsed catalog output in tests
purpshell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Catalog product inventory command gate | ||
|
|
||
| `cloud catalog products` consumes the typed | ||
| `MessagingClient.cloudCatalogs.listProducts` method from the SDK follow-up to | ||
| PR #313. The exact API source is `polymorfa/polymorfa` PR #380 at | ||
| `bbfb2f4af3a8e1289074d9b7d0ed058b96881410`; its Graph OpenAPI copy is | ||
| `docs/api-reference/openapi.graph.json` with SHA-256 | ||
| `b9d3778f17a90fd0c58e0cb1b3f6ef689661980fa83ad7565bc55ae4ab93fab4`. | ||
| The API checks live WABA/project authority and a linked catalog before reading | ||
| Meta's `/{catalogId}/products` edge. The response carries only the projected | ||
| fields and opaque cursors, never Meta paging URLs. | ||
|
|
||
| The CLI remains on its older exact SDK registry version. Merge the upstream | ||
| API and SDK PR chains, publish and verify the SDK artifact, then pin that exact | ||
| version and regenerate the CLI lockfile before CLI merge or release. No live | ||
| catalog permissions, product visibility, deployed path or customer access were | ||
| verified here. No release flag or Admin capability changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import {Flags} from '@oclif/core' | ||
| import {PolymorfaConfigurationError} from '@polymorfa/sdk' | ||
| import {BaseCommand} from '../../../base-command.js' | ||
|
|
||
| export default class CloudCatalogProducts extends BaseCommand { | ||
| static override description = | ||
| 'List products in a catalog linked to an Official API WABA (beta). Requires sessions:read and Graph access.' | ||
|
|
||
| static override flags = { | ||
| waba: Flags.string({ | ||
| description: 'WhatsApp Business Account ID.', | ||
| required: true, | ||
| }), | ||
| catalog: Flags.string({ | ||
| description: 'Numeric product catalog ID linked to the WABA.', | ||
| required: true, | ||
| }), | ||
| 'graph-version': Flags.string({ | ||
| description: 'Meta Graph version, for example v26.0.', | ||
| required: true, | ||
| }), | ||
| limit: Flags.integer({ | ||
| description: 'Page size from 1 to 100; API default is 25.', | ||
| min: 1, | ||
| max: 100, | ||
| }), | ||
| after: Flags.string({ | ||
| description: 'Opaque cursor from the previous response.', | ||
| }), | ||
| } | ||
|
|
||
| async run(): Promise<void> { | ||
| const {flags} = await this.parse(CloudCatalogProducts) | ||
| if ( | ||
| !flags.waba.trim() || | ||
| !/^[0-9]+$/.test(flags.catalog) || | ||
| !flags['graph-version'].trim() | ||
| ) | ||
| throw new PolymorfaConfigurationError( | ||
| 'Provide a WABA ID, numeric catalog ID, and Graph version.', | ||
| ) | ||
| const client = await this.messagingClient(flags, { | ||
| serverCredentialOnly: 'Official API', | ||
| }) | ||
| const response = await client.cloudCatalogs.listProducts( | ||
| flags.waba, | ||
| flags.catalog, | ||
| { | ||
| version: flags['graph-version'], | ||
| ...(flags.limit === undefined ? {} : {limit: flags.limit}), | ||
| ...(flags.after === undefined ? {} : {after: flags.after}), | ||
| }, | ||
| ) | ||
| this.writeValue(response, JSON.stringify(response.data, null, 2), flags) | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On every clean install and build of this commit,
client.cloudCatalogs.listProductsis unavailable because bothpackage.jsonandpackage-lock.jsonstill pin@polymorfa/sdkto0.1.0-dev.20260926005918, which predates this method (as the newly added internal gate document also acknowledges). Consequently TypeScript cannot compile the command, so the SDK dependency and lockfile must be updated to the published version containinglistProductsbefore adding this invocation.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Valid publication gate. The
cloudCatalogs.listProductsmethod exists in SDK PR #314 and this CLI PR is deliberately stacked as source-ready consumer code. The only registry SDK pinned bypackage.json/lockfile predates it; changing to an unpublished version would makenpm cifail. We validated the CLI source against a local package built from SDK #316 (which includes #314): typecheck, build, and full tests passed. We will update the exact dependency and regenerated lockfile only after the SDK chain merges and its published version/integrity are verified; this CLI PR must not merge before then.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolved: this branch now merges CLI
dev, which pins@polymorfa/sdk0.1.0-dev.20261001124422(published after polymorfa/sdks #314 merged). That version exportscloudCatalogs.listProducts; typecheck and build pass against it.