Repository navigation
Install the latest Server SDK in guides instead of pinned versions - #908
Devon-White wants to merge 3 commits into
Conversation
Drop signalwire-sdk==3.4.1, @signalwire/sdk@2.0.5 and the >=1.0.15 requirements floor from every guide, and update the capability-guide rule: Server SDK installs are unpinned and guides never state a minimum Server SDK version. The @signalwire/js v4 pin stays, since @signalwire/js@latest is still the 3.x line. The latest TypeScript SDK (3.x) takes positional arguments for REST calling commands, so the TypeScript samples that relied on the 2.0.5 options-object form are updated to match (dial, play, stream, streamStop, transfer, refer, setRelayTopic, createSubscriberToken), the notes explaining the version difference are removed, and the SMS guide gains the TypeScript REST messages.create() sample that 2.0.5 couldn't provide.
|
@Devon-White This checks out. I pulled every TypeScript sample from the changed pages, ran A few small things:
Not for this PR: about 38 TypeScript reference pages under |
- Send and receive messages: the TypeScript SDK serves the reply document with schemaValidation off, matching the Python sample's output, so the server step shows both languages. - Serverless: the Lambda handler types its event as ServerlessEvent, which runServerless expects, so the sample passes tsc --strict. - Capability guides rule: a missing SDK method is judged against the latest Server SDK release.
|
@Manny-r31 Thanks for the thorough check. Changes are in ad015a6.
Follow-up: #914. By my count, 91 of the 312 TypeScript REST reference pages fail
|
Summary
Guides now install the latest Server SDK instead of a pinned version, so samples don't drift behind the features the pages describe.
signalwire-sdk==3.4.1→signalwire-sdk,@signalwire/sdk@2.0.5→@signalwire/sdk, and thesignalwire-sdk>=1.0.15floor in the serverless and dev-environmentrequirements.txtsnippets →signalwire-sdk.dial()/play()signature depends on the SDK version" notes, and reworded the code comments that named a version (the@ts-expect-errorcomment on the TTS pages and theenter_queuevalidation workaround on Call queues). Both workarounds are still needed on the latest releases (TypeScript 3.7.1, Python 3.7.5), so the code stays and only the comment changed.calling.dial(9 samples plus the TCPA example),calling.play,calling.stream/streamStop,calling.transfer,calling.refer,phoneNumbers.setRelayTopic,fabric.tokens.createSubscriberToken, and the sidecar server (serve()replacesrun(), and the tool returns aFunctionResult). SWML Script uploads use.render(), which matches the SDK'scontentstype. A line highlight on Make and receive calls moved to match.messages.create()next to Python. The inbound reply server is no longer Python only: a TypeScriptSWMLServiceaddsreplywithschemaValidation: false, the same approach as the Python sample, and serves the same document.eventasServerlessEvent, whichrunServerlessexpects, so the sample passestsc --strict..claude/rules/mdx-capability-guides.md: the install header comments are unpinned. The "Pinned versions" rule is replaced by two rules: Server SDK installs are unpinned and guides never state a minimum Server SDK version, while the Browser SDK pin@signalwire/js@4.0.0-rc.5 rxjs@7.8.2stays literal and identical, because@signalwire/js@lateststill installs 3.x. A missing SDK method is judged against the latest Server SDK release, and the validation step names the latest releases.The
@signalwire/jspins and all generated files are untouched. 27 pages changed, plus the rule file. No changelog entry, since this is documentation work.Notes for reviewers
tsc --strict, these samples still report type errors that come from the SDK's own type definitions. The requests they send are correct.SwmlBuilder.build()returnsRecord<string, unknown>, which isn't assignable to theSWMLObjectthatcalling.dial({ swml })andcalling.transfer()expect. This affects 8 dial samples and the Forward calls transfer sample.call.device.params?.from_numberfails to type-check becauseDeviceis a union./docs/server-sdks/reference/typescript/rest/...failtsc --strictagainst 3.7.1: 42 pass a single options object where 3.x takes positional arguments, and 51 read response fields the 3.x types don't declare. Out of scope here because SDK reference pages are left alone; tracked in TypeScript Server SDK REST reference pages use 2.x call signatures #914./docs/server-sdks/reference/python/agents/semantic-gatesays "Requires SDK 3.7.1 or later". It documents a version on a reference page, which this change keeps.python -m pip install signalwire-sdkandnpm install @signalwire/sdk, with no minimum-version wording.Verification
tsc --strictagainst@signalwire/sdk2.0.5 and 3.7.1, and ran pyright on the Python ones againstsignalwire-sdk3.4.1 and 3.7.5. The Python samples show no new errors on the latest release. The TypeScript failures that appeared only on 3.7.1 are fixed here, except the typing items above.fetchand compared the request body with the page's cURL example:dial,play,stream,stream.stop,transfer,refer, relay topic, subscriber token,messages.create, SWML Script create, andlogs.messages.get.tsc --stricton 3.7.1 and runs unchanged as JavaScript. Served over HTTP, it returns a document identical to the Python sample's (signalwire-sdk3.7.5), and returns401without credentials.tsc --stricton 3.7.1 (the previousevent: unknownfails), and returns a response when invoked with a Lambda-style event.yarn fern-md-checkpasses.Preview