Conversation
1 of 2 tasks
SDK 8 can put an API version in the request path (/api/<version>/…). clApi.apiVersion reads it from the --api-version flag, then CL_CLI_API_VERSION; without one the requests stay unversioned, which is what the production API serves today (versioned paths answer 404). clCommand.apiVersionFlag is the shared flag definition. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previews come from pkg.pr.new (commercelayer-sdk 5259929, built from the staging1 schemas): @commercelayer/sdk 8.0.0-beta.13 and @commercelayer/provisioning-sdk 3.0.0-beta.1. Not for release: the catalog points at preview URLs until SDK 8 is on npm. - The Core API clients pass apiVersion (clApi.apiVersion), and the commands that call the Core API get the --api-version flag; requests stay unversioned by default. The resources Node snippet uses the named CommerceLayer import (the default export is deprecated) and adds apiVersion when set. - provisioning: the CommonJS declarations of the provisioning-sdk preview end with export=, which hides its named exports from CommonJS code. src/sdk.ts re-exports them typed with the ESM declarations (the runtime exports are fine); the cli patch does the same for CommerceLayerProvisioningStatic. To remove once the SDK fixes its declarations. - Tests: resources:schema prints the API version (2026-05) instead of a semver. - resources: the resource list is regenerated from the SDK (staging1 schema, so it includes resources not yet in production). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pviti
force-pushed
the
feat/sdk-8-preview
branch
from
October 1, 2026 16:04
391a3b5 to
8008678
Compare
3 of 4 tasks
The Core API version is an operating parameter, as the domain is: the domain says where the requests go, and more API versions can answer there, so the version can be given, or a default applies. - The --api-version flag of the commands is hidden, set by CL_CLI_API_VERSION (as --domain by CL_CLI_DOMAIN). - applications:login and applications:add take --api-version and save it with the application, as the domain; the prerun hook adds it to the commands' flags, and applications:scope keeps it. - The default is clConfig.api.default_api_version (as default_domain), unversioned for now: production doesn't serve /api/<version>/… yet. A version equal to the default isn't saved. - applications --extra shows the API VERSION column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Draft — do not merge. The SDK-independent changes went to #251 (merged); only what SDK 8 needs is here.
Do not merge: the catalog points at the pkg.pr.new previews of SDK 8 (commercelayer-sdk
5259929, branchpkg-pr-new-staging1):@commercelayer/sdk8.0.0-beta.13 and@commercelayer/provisioning-sdk3.0.0-beta.1. To be updated with each new preview and merged once SDK 8 is on npm.Changes in the CLI
apiVersion: this is a version-aware SDK build: its types requireapiVersion(2017-08|2026-05), which becomes a path segment (/api/2026-05/orders). The production API doesn't serve versioned paths yet (checked:/api/skus→ 401,/api/2017-08/skusand/api/2026-05/skus→ 404), so requests stay unversioned by default (the SDK omits the segment at runtime whenapiVersionis undefined).--api-version, an operating parameter like--domain: the domain says where the requests go, and more API versions can answer there, so the version can be chosen, otherwise a default applies.CL_CLI_API_VERSION(as--domainbyCL_CLI_DOMAIN), mostly to pick the environment in development (clCommand.apiVersionFlag,clApi.apiVersionin cli-core).applications:login/applications:add --api-version <v>save it with the application, as the domain. The prerun hook adds it to the commands, andapplications:scopekeeps it.applications --extrashows an API VERSION column.clConfig.api.default_api_version(next todefault_domain), unversioned for now. A version equal to the default isn't saved.CL_CLI_API_VERSION, then the default.apiVersionprecedence and default (core). The prerun hook adds the saved domain and API version only to commands that have the flags (cli, temporary config folder).lib/index.d.cts) end withexport =, which hides the named exports (CommerceLayerProvisioningStatic,QueryParams, …) from CommonJS code.plugins/provisioning/src/sdk.tsre-exports them typed with the ESM declarations; the runtime exports are fine. To remove once the SDK is fixed (see below).CommerceLayerimport (the default export is deprecated); resource list regenerated from the SDK — from the staging1 schema, so it includes resources not yet in production (payment_*, …).resources:schemaprints the API version (2026-05) instead of a semver.QueryArraySortable/QueryRecordSortable/QueryRecordFields; provisioning list mocks; integration on dependency changes) moved to refactor: stop using SDK exports that SDK 8 drops; integration on dependency changes #251.To fix in the SDK
lib/index.d.ctsof both packages ends with// @ts-ignore+export = <default>next to named exports. TypeScript (modulenodenext, CommonJS consumers) then ignores the named exports: with the provisioning-sdk preview,CommerceLayerProvisioningStatic,QueryParams,ResourceTypeLock,RequestObjare "not exported". Droppingexport =(keepingexport default+ named exports, or thecjsInteropoption of tsup) would fix it.apiVersionand production:apiVersionis required by the types, but no value works against production today, where versioned paths answer 404. Either an unversioned option in the types, or2017-08mapped to the unversioned path.Test plan
pnpm build,pnpm lint,check-packages,pnpm install --frozen-lockfileapplications:login,config:show)monorepo(chore: move the release scripts to a cl-release workspace package #267–fix(metrics)!: fbt requires item IDs and prints readable results #269 included)🤖 Generated with Claude Code