Skip to content

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 generate now writes web/src/bridge.schema.ts, a module with types and the parsed description and no validators; the SDK validates at run time. The hand-written QWebChannel glue the 0.3.0 scaffold put in web/src/transport.ts is in the package. The reference example’s main.ts, before and after:

    // 0.3.0
    import { 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.0
    import { 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(...) becomes qgis.sites.summary(...), operations.buffer(...) becomes qgis.buffer(...)). Point the bindings script at --out web/src/bridge.schema.ts --check, delete transport.ts and the old bridge.ts, and pass the instance where createOperations(client) was passed; in tests, createBridgeHarness(schema) plus QgisSdk.fromBridgeSchema(schema, { transport: harness }). The --out web/src/bridge.ts form keeps rendering the 0.3.0 client for one minor with a deprecation note. qgis-sdk new --web from tools 0.6.0 writes the three-statement page; its pinned bridge moves to 0.4.0 in the same release stamp (decision-41).

  • The handshake answers from the dispatcher. A page’s first envelope may be kind: "handshake"; a Python 0.6.0 host answers it with the protocol, generation, plugin description and the host operation ids this view may call. Protocol 1 is unchanged: a 0.5.0 host refuses the same envelope with invalid_message, so qgis.ready rejects with that QgisSdkBridgeRemoteError and qgis.host.granted stays empty; the declared methods still work against it.

  • The root re-exports ./bridge. import { BridgeClient } from "@archont561/qgis-sdk" works; the ./bridge subpath is unchanged and remains the import of existing code. ./host, ./react and ./testing stay subpath-only.

  • Removed from the root: QgisSdkScopeClosedError and QgisSdkUnsupportedCapabilityError (never raised by this package; the Python error arrives as a QgisSdkBridgeRemoteError whose code is scope_closed or unsupported_capability) and isPlainRecord (an internal helper; write the three-line guard locally if you relied on it).

  • Generated errors renamed, with a code. ./host exports QgisSdkHostContractError (was HostContractError), now a QgisSdkError with code: "contract_validation_failed". A plugin client regenerated with qgis-sdk bridge generate from tools 0.6.0 exports QgisSdkContractError (was ContractError), still a plain Error, with the same code. Replace the names in catch clauses and prefer matching on error.code.

  • Manifest: stays 0.3.0 until the release gate stamps it. Verify a stamped pair with python scripts/release.py verify-versions --scope typescript --version 0.4.0.