0.4.0 migration notes
0.4.0 is unreleased at the time of writing; it is the root-entry change of
decision-40
on main, paired with Python 0.6.0. Neither the transport protocol (1),
the plugin-description contract (1), HOST_SCHEMA_VERSION nor
HOST_FINGERPRINT moves: what crosses QWebChannel is identical.
-
QgisSdk.fromBridgeSchema(schema)replaces the generated client (decision-44).qgis-sdk bridge generatenow writesweb/src/bridge.schema.ts, a module with types and the parsed description and no validators; the SDK validates at run time. The hand-writtenQWebChannelglue the 0.3.0 scaffold put inweb/src/transport.tsis in the package. The reference example’smain.ts, before and after:// 0.3.0import { BridgeClient } from "@archont561/qgis-sdk/bridge";import { createApp } from "./app";import { createOperations } from "./bridge";import { connectWebChannel, insideQgis } from "./transport";if (insideQgis()) {connectWebChannel().then((transport) => createApp(root, createOperations(new BridgeClient(transport))),(failure: unknown) => { root.textContent = String(failure); },);} else {root.textContent = "Open this page from QGIS.";}// 0.4.0import { QgisSdk } from "@archont561/qgis-sdk";import { createApp } from "./app";import schema from "./bridge.schema";const qgis = QgisSdk.fromBridgeSchema(schema);createApp(root, qgis);Methods nest by the dots in the declared id exactly as the 0.3.0 client’s did (
operations.sites.summary(...)becomesqgis.sites.summary(...),operations.buffer(...)becomesqgis.buffer(...)). Point thebindingsscript at--out web/src/bridge.schema.ts --check, deletetransport.tsand the oldbridge.ts, and pass the instance wherecreateOperations(client)was passed; in tests,createBridgeHarness(schema)plusQgisSdk.fromBridgeSchema(schema, { transport: harness }). The--out web/src/bridge.tsform keeps rendering the 0.3.0 client for one minor with a deprecation note.qgis-sdk new --webfrom tools0.6.0writes the three-statement page; its pinned bridge moves to0.4.0in the same release stamp (decision-41). -
The handshake answers from the dispatcher. A page’s first envelope may be
kind: "handshake"; a Python0.6.0host answers it with the protocol, generation, plugin description and the host operation ids this view may call. Protocol1is unchanged: a0.5.0host refuses the same envelope withinvalid_message, soqgis.readyrejects with thatQgisSdkBridgeRemoteErrorandqgis.host.grantedstays empty; the declared methods still work against it. -
The root re-exports
./bridge.import { BridgeClient } from "@archont561/qgis-sdk"works; the./bridgesubpath is unchanged and remains the import of existing code../host,./reactand./testingstay subpath-only. -
Removed from the root:
QgisSdkScopeClosedErrorandQgisSdkUnsupportedCapabilityError(never raised by this package; the Python error arrives as aQgisSdkBridgeRemoteErrorwhosecodeisscope_closedorunsupported_capability) andisPlainRecord(an internal helper; write the three-line guard locally if you relied on it). -
Generated errors renamed, with a code.
./hostexportsQgisSdkHostContractError(wasHostContractError), now aQgisSdkErrorwithcode: "contract_validation_failed". A plugin client regenerated withqgis-sdk bridge generatefrom tools0.6.0exportsQgisSdkContractError(wasContractError), still a plainError, with the samecode. Replace the names incatchclauses and prefer matching onerror.code. -
Manifest: stays
0.3.0until the release gate stamps it. Verify a stamped pair withpython scripts/release.py verify-versions --scope typescript --version 0.4.0.