@archont561/qgis-sdk 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -70,7 +70,7 @@ declare class QgisSdkContractValidationError2 extends QgisSdkError2 {
70
70
  toJSON(): SerializedContractValidationError2;
71
71
  }
72
72
  /**
73
- * Parse and validate a version 1 `PluginDescription` emitted by `describe_plugin`.
73
+ * Parse and validate a version 1 `PluginDescription` emitted by `describe(app)`.
74
74
  */
75
75
  declare function parsePluginDescription2(input: string | Readonly<Record<string, unknown>>): PluginDescription2;
76
76
  declare const BRIDGE_PROTOCOL_VERSION2: 1;
@@ -134,75 +134,6 @@ interface BridgeClientOptions2 {
134
134
  interface InvokeOptions2 {
135
135
  readonly signal?: AbortSignal;
136
136
  }
137
- /**
138
- * An envelope or reply does not match the versioned bridge protocol.
139
- */
140
- declare class QgisSdkBridgeProtocolError2 extends QgisSdkError2 {
141
- constructor(message: string);
142
- }
143
- /**
144
- * The host did not answer in time. The call may still have run, so this is an
145
- * unknown outcome: retrying automatically is forbidden, deciding is the caller's.
146
- */
147
- declare class QgisSdkBridgeTimeoutError2 extends QgisSdkError2 {
148
- readonly callId: string;
149
- constructor(callId: string, timeoutMs: number);
150
- }
151
- /**
152
- * The caller aborted locally. Distinct from the host cancelling the operation,
153
- * which arrives as a failure reply carrying the `cancelled` code.
154
- */
155
- declare class QgisSdkBridgeAbortedError2 extends QgisSdkError2 {
156
- readonly callId: string;
157
- constructor(callId: string);
158
- }
159
- /**
160
- * The client was closed, so pending calls can no longer be answered.
161
- */
162
- declare class QgisSdkBridgeClosedError2 extends QgisSdkError2 {
163
- constructor();
164
- }
165
- /**
166
- * A subscription's frames were not the sequence the host promised.
167
- *
168
- * The client does not try to reassemble: a missed frame is a fact about the
169
- * subscription, not something to paper over.
170
- */
171
- declare class QgisSdkBridgeSequenceError2 extends QgisSdkError2 {
172
- readonly subscriptionId: string;
173
- readonly expected: number;
174
- readonly received: number;
175
- constructor(subscriptionId: string, expected: number, received: number);
176
- }
177
- /**
178
- * The subscription ended with a terminal frame the caller may want to inspect.
179
- */
180
- declare class QgisSdkBridgeStreamEndedError2 extends QgisSdkError2 {
181
- readonly subscriptionId: string;
182
- readonly terminal: BridgeStreamTerminal2;
183
- constructor(subscriptionId: string, terminal: BridgeStreamTerminal2);
184
- }
185
- /**
186
- * The host refused or failed the operation; `failure.code` is the contract.
187
- */
188
- declare class QgisSdkBridgeRemoteError2 extends QgisSdkError2 {
189
- readonly failure: BridgeFailure2;
190
- readonly callId: string;
191
- constructor(callId: string, failure: BridgeFailure2);
192
- }
193
- /**
194
- * Parse one reply, refusing anything the host could not legitimately have sent.
195
- */
196
- declare function parseInvokeReply2(raw: unknown): InvokeReply2;
197
- /**
198
- * Parse one stream frame, refusing anything the host could not legitimately
199
- * have sent.
200
- *
201
- * Exactly one of `event` and `terminal` has to be present: a frame that carries
202
- * both leaves the client guessing which one wins, and a client that guesses is
203
- * a client that will eventually deliver an event after the end of a stream.
204
- */
205
- declare function parseStreamFrame2(raw: unknown): BridgeStreamFrame2;
206
137
  /** Callbacks a subscription reports through. */
207
138
  interface SubscriptionHandlers2 {
208
139
  readonly onEvent?: (event: BridgeStreamEvent2) => void;
@@ -277,4 +208,53 @@ declare class BridgeClient2 {
277
208
  /** The last malformed message this client refused, if any. */
278
209
  get protocolError(): Error | null;
279
210
  }
280
- export { MAX_SAFE_INTEGER2, MIN_SAFE_INTEGER2, PLUGIN_DESCRIPTION_SCHEMA_VERSION2, ValidationDirection2, SerializedValidationIssue2, SerializedContractValidationError2, ActionDescription2, StreamEventKind2, StreamDescription2, PluginDescription2, isSafeJsonInteger2, QgisSdkDeclarationError2, QgisSdkValidationIssue2, QgisSdkContractValidationError2, parsePluginDescription2, BRIDGE_PROTOCOL_VERSION2, MAX_CALL_ID_LENGTH2, BridgeFailure2, InvokeReply2, StreamTerminalKind2, BridgeStreamEvent2, BridgeStreamTerminal2, BridgeEventFrame2, BridgeTerminalFrame2, BridgeStreamFrame2, WireTransport2, BridgeClientOptions2, InvokeOptions2, QgisSdkBridgeProtocolError2, QgisSdkBridgeTimeoutError2, QgisSdkBridgeAbortedError2, QgisSdkBridgeClosedError2, QgisSdkBridgeSequenceError2, QgisSdkBridgeStreamEndedError2, QgisSdkBridgeRemoteError2, parseInvokeReply2, parseStreamFrame2, SubscriptionHandlers2, BridgeSubscription2, BridgeClient2 };
211
+ /**
212
+ * An envelope or reply does not match the versioned bridge protocol.
213
+ */
214
+ declare class QgisSdkBridgeProtocolError2 extends QgisSdkError2 {
215
+ constructor(message: string);
216
+ }
217
+ /**
218
+ * The host did not answer in time. The call may still have run, so this is an
219
+ * unknown outcome: retrying automatically is forbidden, deciding is the caller's.
220
+ */
221
+ declare class QgisSdkBridgeTimeoutError2 extends QgisSdkError2 {
222
+ readonly callId: string;
223
+ constructor(callId: string, timeoutMs: number);
224
+ }
225
+ /**
226
+ * The caller aborted locally. Distinct from the host cancelling the operation,
227
+ * which arrives as a failure reply carrying the `cancelled` code.
228
+ */
229
+ declare class QgisSdkBridgeAbortedError2 extends QgisSdkError2 {
230
+ readonly callId: string;
231
+ constructor(callId: string);
232
+ }
233
+ /**
234
+ * The client was closed, so pending calls can no longer be answered.
235
+ */
236
+ declare class QgisSdkBridgeClosedError2 extends QgisSdkError2 {
237
+ constructor();
238
+ }
239
+ /**
240
+ * The host refused or failed the operation; `failure.code` is the contract.
241
+ */
242
+ declare class QgisSdkBridgeRemoteError2 extends QgisSdkError2 {
243
+ readonly failure: BridgeFailure2;
244
+ readonly callId: string;
245
+ constructor(callId: string, failure: BridgeFailure2);
246
+ }
247
+ /**
248
+ * Parse one reply, refusing anything the host could not legitimately have sent.
249
+ */
250
+ declare function parseInvokeReply2(raw: unknown): InvokeReply2;
251
+ /**
252
+ * Parse one stream frame, refusing anything the host could not legitimately
253
+ * have sent.
254
+ *
255
+ * Exactly one of `event` and `terminal` has to be present: a frame that carries
256
+ * both leaves the client guessing which one wins, and a client that guesses is
257
+ * a client that will eventually deliver an event after the end of a stream.
258
+ */
259
+ declare function parseStreamFrame2(raw: unknown): BridgeStreamFrame2;
260
+ export { MAX_SAFE_INTEGER2, MIN_SAFE_INTEGER2, PLUGIN_DESCRIPTION_SCHEMA_VERSION2, ValidationDirection2, SerializedValidationIssue2, SerializedContractValidationError2, ActionDescription2, StreamEventKind2, StreamDescription2, PluginDescription2, isSafeJsonInteger2, QgisSdkDeclarationError2, QgisSdkValidationIssue2, QgisSdkContractValidationError2, parsePluginDescription2, BRIDGE_PROTOCOL_VERSION2, MAX_CALL_ID_LENGTH2, BridgeFailure2, InvokeReply2, StreamTerminalKind2, BridgeStreamEvent2, BridgeStreamTerminal2, BridgeEventFrame2, BridgeTerminalFrame2, BridgeStreamFrame2, WireTransport2, BridgeClientOptions2, InvokeOptions2, SubscriptionHandlers2, BridgeSubscription2, BridgeClient2, QgisSdkBridgeProtocolError2, QgisSdkBridgeTimeoutError2, QgisSdkBridgeAbortedError2, QgisSdkBridgeClosedError2, QgisSdkBridgeRemoteError2, parseInvokeReply2, parseStreamFrame2 };
@@ -1,7 +1,35 @@
1
- import { SerializedValidationIssue2, ActionDescription2, QgisSdkValidationIssue2 } from "./chunk-wtv4vt4q.js";
1
+ import { SerializedValidationIssue2, ActionDescription2, QgisSdkValidationIssue2 } from "./chunk-8c12nwme.js";
2
2
  import { HostOperationId2, VectorLayerInfo2 } from "./chunk-7tgzmz0m.js";
3
- import { OperationShape2, QgisSdkHost2, QgisSdkCore2 } from "./chunk-a33y575v.js";
3
+ import { OperationShape2, QgisSdkHost2, QgisSdkCore2 } from "./chunk-nwz8n14x.js";
4
4
  import { QgisSdkError2 } from "./chunk-pdj2fxjb.js";
5
+ /** A store was built or driven outside the shape it needs. */
6
+ declare class QgisSdkStoreError2 extends QgisSdkError2 {
7
+ constructor(message: string);
8
+ }
9
+ /** What a listener receives: the whole snapshot, never a diff. */
10
+ type StoreListener2<T> = (snapshot: T) => void;
11
+ /**
12
+ * The contract every store honours, and the one `useSyncExternalStore`,
13
+ * Vue's `shallowRef` wiring and Svelte's `$store` all read.
14
+ */
15
+ interface Store2<T> {
16
+ /** The current value; the same object until the next change. Bound. */
17
+ readonly getSnapshot: () => T;
18
+ /**
19
+ * Call `listener` now and after every change; the returned function
20
+ * stops the calls. Bound. Svelte passes a second `invalidate` argument,
21
+ * which is ignored.
22
+ */
23
+ readonly subscribe: (listener: StoreListener2<T>) => () => void;
24
+ }
25
+ declare abstract class BaseStore<T> implements Store2<T> {
26
+ private snapshot;
27
+ private readonly listeners;
28
+ protected constructor(initial: T);
29
+ readonly getSnapshot: () => T;
30
+ readonly subscribe: (listener: StoreListener2<T>) => (() => void);
31
+ protected publish(next: T): void;
32
+ }
5
33
  /** One schema of the declared dialect, as the description carries it. */
6
34
  type DeclaredSchema2 = Readonly<Record<string, unknown>>;
7
35
  /** Options for {@link validateAgainstSchema}. */
@@ -40,34 +68,6 @@ declare class QgisSdkContractError2 extends QgisSdkError2 {
40
68
  * dialect, because that is a fault in the declaration, never in the value.
41
69
  */
42
70
  declare function validateAgainstSchema2(value: unknown, schema: DeclaredSchema2, options?: ValidateOptions2): QgisSdkValidationIssue2[];
43
- /** A store was built or driven outside the shape it needs. */
44
- declare class QgisSdkStoreError2 extends QgisSdkError2 {
45
- constructor(message: string);
46
- }
47
- /** What a listener receives: the whole snapshot, never a diff. */
48
- type StoreListener2<T> = (snapshot: T) => void;
49
- /**
50
- * The contract every store honours, and the one `useSyncExternalStore`,
51
- * Vue's `shallowRef` wiring and Svelte's `$store` all read.
52
- */
53
- interface Store2<T> {
54
- /** The current value; the same object until the next change. Bound. */
55
- readonly getSnapshot: () => T;
56
- /**
57
- * Call `listener` now and after every change; the returned function
58
- * stops the calls. Bound. Svelte passes a second `invalidate` argument,
59
- * which is ignored.
60
- */
61
- readonly subscribe: (listener: StoreListener2<T>) => () => void;
62
- }
63
- declare abstract class BaseStore<T> implements Store2<T> {
64
- private snapshot;
65
- private readonly listeners;
66
- protected constructor(initial: T);
67
- readonly getSnapshot: () => T;
68
- readonly subscribe: (listener: StoreListener2<T>) => (() => void);
69
- protected publish(next: T): void;
70
- }
71
71
  /** Where one invocation stands. */
72
72
  type OperationState2<R> = {
73
73
  readonly status: "idle";
@@ -109,68 +109,6 @@ declare class OperationStore2<
109
109
  readonly reset: () => void;
110
110
  readonly run: (input: I) => Promise<R | undefined>;
111
111
  }
112
- /** How a stream ended, as the generated module reports it. */
113
- interface StreamTerminalLike2 {
114
- readonly kind: string;
115
- readonly message?: string;
116
- readonly dropped?: number;
117
- }
118
- /** The handle a generated stream member resolves with. */
119
- interface StreamHandleLike2 {
120
- readonly id: string;
121
- readonly closed: boolean;
122
- close(): void;
123
- }
124
- /** Handlers for a stream, as a generated module types them. */
125
- interface StreamHandlersLike2<E> {
126
- readonly onEvent?: (event: E) => void;
127
- readonly onTerminal?: (terminal: StreamTerminalLike2) => void;
128
- }
129
- /** A stream member of a generated map. */
130
- type Stream2<
131
- I,
132
- E
133
- > = (input: I, handlers: StreamHandlersLike2<E>, options?: {
134
- readonly signal?: AbortSignal;
135
- }) => Promise<StreamHandleLike2>;
136
- /** Where one subscription stands. */
137
- interface StreamState2<E> {
138
- /** `idle` with a null input, `failed` when the host refused to open it. */
139
- readonly status: "idle" | "opening" | "open" | "ended" | "failed";
140
- readonly lastEvent: E | null;
141
- readonly terminal: StreamTerminalLike2 | null;
142
- readonly error: Error | null;
143
- }
144
- /**
145
- * Return a key that is equal for two inputs with the same content, whatever
146
- * the order their fields were written in.
147
- */
148
- declare function stableKey2(value: unknown): string;
149
- /**
150
- * Hold one generated stream open while its input is non-null.
151
- *
152
- * `setInput` follows the *content* of the input: a new object with the same
153
- * fields changes nothing, a different one closes the old stream and opens a
154
- * new one, `null` closes it. Handlers are read fresh on every frame, so
155
- * `setHandlers` with a new closure reopens nothing. `close` is safe before the
156
- * host has acknowledged the stream: the handle is closed the moment it
157
- * arrives.
158
- */
159
- declare class StreamStore2<
160
- I,
161
- E
162
- > extends BaseStore<StreamState2<E>> {
163
- private readonly open;
164
- private handlers;
165
- private key;
166
- private cancel;
167
- constructor(open: Stream2<I, E>, handlers?: StreamHandlersLike2<E>);
168
- /** Replace the handlers the next frames reach; nothing reopens. */
169
- setHandlers(handlers: StreamHandlersLike2<E>): void;
170
- readonly setInput: (input: I | null) => void;
171
- readonly close: () => void;
172
- private start;
173
- }
174
112
  /**
175
113
  * The input families a declared request can ask for: the same names the
176
114
  * Python `qgis_sdk.ui` catalogue draws, so a form on either side of the
@@ -339,4 +277,66 @@ declare function layersQuery2(qgis: QgisSdkCore2<unknown, unknown>, options?: La
339
277
  * on the same reply; a project CRS query is not on the wire yet.
340
278
  */
341
279
  declare function layerFieldsQuery2(qgis: QgisSdkCore2<unknown, unknown>, layerId: string): HostQueryStore2<readonly string[]>;
342
- export { DeclaredSchema2, ValidateOptions2, ContractDirection2, SerializedContractError2, QgisSdkContractError2, validateAgainstSchema2, QgisSdkStoreError2, StoreListener2, Store2, OperationState2, Operation2, OperationStore2, StreamTerminalLike2, StreamHandleLike2, StreamHandlersLike2, Stream2, StreamState2, stableKey2, StreamStore2, FormFieldKind2, FormField2, labelFor2, schemaFields2, FormValues2, FormState2, FormOptions2, FormStore2, formStore2, HostQueryState2, HostQueryLoader2, HostQueryStore2, LayersQueryOptions2, layersQuery2, layerFieldsQuery2 };
280
+ /** How a stream ended, as the generated module reports it. */
281
+ interface StreamTerminalLike2 {
282
+ readonly kind: string;
283
+ readonly message?: string;
284
+ readonly dropped?: number;
285
+ }
286
+ /** The handle a generated stream member resolves with. */
287
+ interface StreamHandleLike2 {
288
+ readonly id: string;
289
+ readonly closed: boolean;
290
+ close(): void;
291
+ }
292
+ /** Handlers for a stream, as a generated module types them. */
293
+ interface StreamHandlersLike2<E> {
294
+ readonly onEvent?: (event: E) => void;
295
+ readonly onTerminal?: (terminal: StreamTerminalLike2) => void;
296
+ }
297
+ /** A stream member of a generated map. */
298
+ type Stream2<
299
+ I,
300
+ E
301
+ > = (input: I, handlers: StreamHandlersLike2<E>, options?: {
302
+ readonly signal?: AbortSignal;
303
+ }) => Promise<StreamHandleLike2>;
304
+ /** Where one subscription stands. */
305
+ interface StreamState2<E> {
306
+ /** `idle` with a null input, `failed` when the host refused to open it. */
307
+ readonly status: "idle" | "opening" | "open" | "ended" | "failed";
308
+ readonly lastEvent: E | null;
309
+ readonly terminal: StreamTerminalLike2 | null;
310
+ readonly error: Error | null;
311
+ }
312
+ /**
313
+ * Return a key that is equal for two inputs with the same content, whatever
314
+ * the order their fields were written in.
315
+ */
316
+ declare function stableKey2(value: unknown): string;
317
+ /**
318
+ * Hold one generated stream open while its input is non-null.
319
+ *
320
+ * `setInput` follows the *content* of the input: a new object with the same
321
+ * fields changes nothing, a different one closes the old stream and opens a
322
+ * new one, `null` closes it. Handlers are read fresh on every frame, so
323
+ * `setHandlers` with a new closure reopens nothing. `close` is safe before the
324
+ * host has acknowledged the stream: the handle is closed the moment it
325
+ * arrives.
326
+ */
327
+ declare class StreamStore2<
328
+ I,
329
+ E
330
+ > extends BaseStore<StreamState2<E>> {
331
+ private readonly open;
332
+ private handlers;
333
+ private key;
334
+ private cancel;
335
+ constructor(open: Stream2<I, E>, handlers?: StreamHandlersLike2<E>);
336
+ /** Replace the handlers the next frames reach; nothing reopens. */
337
+ setHandlers(handlers: StreamHandlersLike2<E>): void;
338
+ readonly setInput: (input: I | null) => void;
339
+ readonly close: () => void;
340
+ private start;
341
+ }
342
+ export { QgisSdkStoreError2, StoreListener2, Store2, DeclaredSchema2, ValidateOptions2, ContractDirection2, SerializedContractError2, QgisSdkContractError2, validateAgainstSchema2, OperationState2, Operation2, OperationStore2, FormFieldKind2, FormField2, labelFor2, schemaFields2, FormValues2, FormState2, FormOptions2, FormStore2, formStore2, HostQueryState2, HostQueryLoader2, HostQueryStore2, LayersQueryOptions2, layersQuery2, layerFieldsQuery2, StreamTerminalLike2, StreamHandleLike2, StreamHandlersLike2, Stream2, StreamState2, stableKey2, StreamStore2 };
@@ -1,4 +1,4 @@
1
- import { PluginDescription2, BridgeStreamTerminal2, WireTransport2, InvokeOptions2, BridgeSubscription2, BridgeClient2 } from "./chunk-wtv4vt4q.js";
1
+ import { PluginDescription2, BridgeStreamTerminal2, WireTransport2, InvokeOptions2, BridgeSubscription2, BridgeClient2 } from "./chunk-8c12nwme.js";
2
2
  import { HostOperationId2, HostOperations2 } from "./chunk-7tgzmz0m.js";
3
3
  /** What one declared action promises: an object in, a value out. */
4
4
  interface OperationShape2 {