@archont561/qgis-sdk 0.3.0 → 0.5.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.
- package/README.md +35 -33
- package/dist/bridge.d.ts +2 -205
- package/dist/bridge.js +3 -4
- package/dist/host.d.ts +2 -157
- package/dist/host.js +72 -430
- package/dist/index.d.ts +62 -95
- package/dist/index.js +399 -12
- package/dist/react.d.ts +61 -161
- package/dist/react.js +70 -139
- package/dist/shared/chunk-2hwva3a3.js +14 -0
- package/dist/shared/chunk-3zscfm3y.d.ts +342 -0
- package/dist/shared/chunk-7tgzmz0m.d.ts +252 -0
- package/dist/shared/chunk-8gawbn19.js +433 -0
- package/dist/shared/chunk-a33y575v.d.ts +155 -0
- package/dist/shared/chunk-pdj2fxjb.d.ts +17 -0
- package/dist/shared/chunk-stre69mw.js +777 -0
- package/dist/shared/chunk-t1vpt5yq.js +895 -0
- package/dist/shared/chunk-wtv4vt4q.d.ts +280 -0
- package/dist/svelte.d.ts +75 -0
- package/dist/svelte.js +70 -0
- package/dist/testing.d.ts +58 -30
- package/dist/testing.js +51 -5
- package/dist/vue.d.ts +106 -0
- package/dist/vue.js +91 -0
- package/package.json +21 -3
- package/dist/shared/chunk-0fknax6w.js +0 -207
- package/dist/shared/chunk-a7bjgeve.js +0 -422
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import { SerializedValidationIssue2, ActionDescription2, QgisSdkValidationIssue2 } from "./chunk-wtv4vt4q.js";
|
|
2
|
+
import { HostOperationId2, VectorLayerInfo2 } from "./chunk-7tgzmz0m.js";
|
|
3
|
+
import { OperationShape2, QgisSdkHost2, QgisSdkCore2 } from "./chunk-a33y575v.js";
|
|
4
|
+
import { QgisSdkError2 } from "./chunk-pdj2fxjb.js";
|
|
5
|
+
/** One schema of the declared dialect, as the description carries it. */
|
|
6
|
+
type DeclaredSchema2 = Readonly<Record<string, unknown>>;
|
|
7
|
+
/** Options for {@link validateAgainstSchema}. */
|
|
8
|
+
interface ValidateOptions2 {
|
|
9
|
+
/** Ignore properties the schema does not name (results and events). */
|
|
10
|
+
readonly allowUnknown?: boolean;
|
|
11
|
+
/** Where the value sits, prefixed to every issue's path. */
|
|
12
|
+
readonly path?: readonly (string | number)[];
|
|
13
|
+
}
|
|
14
|
+
/** Which side of a call a contract issue belongs to. */
|
|
15
|
+
type ContractDirection2 = "request" | "result" | "event";
|
|
16
|
+
/** The JSON form of {@link QgisSdkContractError}. */
|
|
17
|
+
interface SerializedContractError2 {
|
|
18
|
+
readonly code: string;
|
|
19
|
+
readonly operation: string;
|
|
20
|
+
readonly direction: ContractDirection2;
|
|
21
|
+
readonly issues: SerializedValidationIssue2[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* An argument, a reply or an event does not match the declared contract.
|
|
25
|
+
*
|
|
26
|
+
* The code is the one both languages use for this category, so a page that
|
|
27
|
+
* already matches `contract_validation_failed` needs no second branch.
|
|
28
|
+
*/
|
|
29
|
+
declare class QgisSdkContractError2 extends QgisSdkError2 {
|
|
30
|
+
readonly operation: string;
|
|
31
|
+
readonly direction: ContractDirection2;
|
|
32
|
+
readonly issues: readonly QgisSdkValidationIssue2[];
|
|
33
|
+
constructor(operation: string, direction: ContractDirection2, issues: readonly QgisSdkValidationIssue2[]);
|
|
34
|
+
toJSON(): SerializedContractError2;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Return every issue `value` has against `schema`; an empty array is a match.
|
|
38
|
+
*
|
|
39
|
+
* Throws {@link QgisSdkDeclarationError} when `schema` leaves the declared
|
|
40
|
+
* dialect, because that is a fault in the declaration, never in the value.
|
|
41
|
+
*/
|
|
42
|
+
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
|
+
/** Where one invocation stands. */
|
|
72
|
+
type OperationState2<R> = {
|
|
73
|
+
readonly status: "idle";
|
|
74
|
+
} | {
|
|
75
|
+
readonly status: "pending";
|
|
76
|
+
} | {
|
|
77
|
+
readonly status: "ok";
|
|
78
|
+
readonly value: R;
|
|
79
|
+
} | {
|
|
80
|
+
readonly status: "error";
|
|
81
|
+
readonly error: Error;
|
|
82
|
+
};
|
|
83
|
+
/** An operation member of a generated map: input, optional signal, promise. */
|
|
84
|
+
type Operation2<
|
|
85
|
+
I,
|
|
86
|
+
R
|
|
87
|
+
> = (input: I, options?: {
|
|
88
|
+
readonly signal?: AbortSignal;
|
|
89
|
+
}) => Promise<R>;
|
|
90
|
+
/**
|
|
91
|
+
* Run one generated operation.
|
|
92
|
+
*
|
|
93
|
+
* `run` resolves with the value, or with `undefined` when the call failed,
|
|
94
|
+
* was aborted or was superseded by a later run - the state carries the error,
|
|
95
|
+
* so the promise never rejects into an event handler. Only the latest run can
|
|
96
|
+
* change the state. `abort` ends the in-flight call locally (the host may
|
|
97
|
+
* still run it); `reset` aborts and returns to `idle`. The methods are bound,
|
|
98
|
+
* so they can be passed around without the store.
|
|
99
|
+
*/
|
|
100
|
+
declare class OperationStore2<
|
|
101
|
+
I,
|
|
102
|
+
R
|
|
103
|
+
> extends BaseStore<OperationState2<R>> {
|
|
104
|
+
private readonly operation;
|
|
105
|
+
private generation;
|
|
106
|
+
private controller;
|
|
107
|
+
constructor(operation: Operation2<I, R>);
|
|
108
|
+
readonly abort: () => void;
|
|
109
|
+
readonly reset: () => void;
|
|
110
|
+
readonly run: (input: I) => Promise<R | undefined>;
|
|
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
|
+
/**
|
|
175
|
+
* The input families a declared request can ask for: the same names the
|
|
176
|
+
* Python `qgis_sdk.ui` catalogue draws, so a form on either side of the
|
|
177
|
+
* bridge renders one declaration the same way.
|
|
178
|
+
*/
|
|
179
|
+
type FormFieldKind2 = "text" | "integer" | "number" | "boolean" | "choice" | "layer" | "crs" | "metres" | "file" | "directory" | "field" | "range" | "colour";
|
|
180
|
+
/** One input of a declared action, as a page should render it. */
|
|
181
|
+
interface FormField2 {
|
|
182
|
+
readonly name: string;
|
|
183
|
+
/** `buffer_distance` -> `Buffer distance`. */
|
|
184
|
+
readonly label: string;
|
|
185
|
+
readonly kind: FormFieldKind2;
|
|
186
|
+
readonly required: boolean;
|
|
187
|
+
readonly nullable: boolean;
|
|
188
|
+
/** The `enum` of a `choice` field; empty otherwise. */
|
|
189
|
+
readonly choices: readonly unknown[];
|
|
190
|
+
/** Bounds, a parent input, picker filters: what the kind needs beyond a name. */
|
|
191
|
+
readonly details: Readonly<Record<string, unknown>>;
|
|
192
|
+
/** The property schema the value is validated against. */
|
|
193
|
+
readonly schema: DeclaredSchema2;
|
|
194
|
+
}
|
|
195
|
+
/** Render a field name as a label. */
|
|
196
|
+
declare function labelFor2(name: string): string;
|
|
197
|
+
/**
|
|
198
|
+
* The fields of a declared request schema, in declaration order: the
|
|
199
|
+
* TypeScript twin of `qgis_sdk.ui.schema_fields`.
|
|
200
|
+
*/
|
|
201
|
+
declare function schemaFields2(schema: DeclaredSchema2, owner?: string): readonly FormField2[];
|
|
202
|
+
/** The values a form holds: one entry per field the user or the schema set. */
|
|
203
|
+
type FormValues2 = Readonly<Record<string, unknown>>;
|
|
204
|
+
/** Where one form stands. */
|
|
205
|
+
interface FormState2<R> {
|
|
206
|
+
readonly values: FormValues2;
|
|
207
|
+
/** Every issue the current values have against the request schema. */
|
|
208
|
+
readonly issues: readonly QgisSdkValidationIssue2[];
|
|
209
|
+
/** The first issue code per field name, for a label to show. */
|
|
210
|
+
readonly errors: Readonly<Record<string, string>>;
|
|
211
|
+
readonly valid: boolean;
|
|
212
|
+
/** A value changed since construction or the last `reset`. */
|
|
213
|
+
readonly dirty: boolean;
|
|
214
|
+
/** `submit` was attempted since construction or the last `reset`. */
|
|
215
|
+
readonly submitted: boolean;
|
|
216
|
+
/** The latest submission, as an operation store reports it. */
|
|
217
|
+
readonly submission: OperationState2<R>;
|
|
218
|
+
}
|
|
219
|
+
/** Options for {@link FormStore}. */
|
|
220
|
+
interface FormOptions2 {
|
|
221
|
+
/** Values to start from; the declared dialect has no defaults of its own. */
|
|
222
|
+
readonly initial?: FormValues2;
|
|
223
|
+
}
|
|
224
|
+
type RequestOf<
|
|
225
|
+
O,
|
|
226
|
+
K extends keyof O
|
|
227
|
+
> = O[K] extends OperationShape2 ? O[K]["request"] : never;
|
|
228
|
+
type ResultOf<
|
|
229
|
+
O,
|
|
230
|
+
K extends keyof O
|
|
231
|
+
> = O[K] extends OperationShape2 ? O[K]["result"] : never;
|
|
232
|
+
/**
|
|
233
|
+
* Bind the request of one declared action to its schema.
|
|
234
|
+
*
|
|
235
|
+
* The fields come from the declaration, so a page renders `form.fields`
|
|
236
|
+
* instead of guessing; `set` coerces what an `<input>` yields (`"3"` for a
|
|
237
|
+
* numeric field, `""` for an unset one) and re-validates; `submit` refuses
|
|
238
|
+
* invalid values without a call and otherwise runs the operation through an
|
|
239
|
+
* {@link OperationStore}, whose state is `submission`.
|
|
240
|
+
*/
|
|
241
|
+
declare class FormStore2<
|
|
242
|
+
Req extends object,
|
|
243
|
+
R
|
|
244
|
+
> extends BaseStore<FormState2<R>> {
|
|
245
|
+
readonly id: string;
|
|
246
|
+
readonly title: string;
|
|
247
|
+
readonly fields: readonly FormField2[];
|
|
248
|
+
private readonly byName;
|
|
249
|
+
private readonly request;
|
|
250
|
+
private readonly initial;
|
|
251
|
+
private readonly operation;
|
|
252
|
+
private readonly unsubscribe;
|
|
253
|
+
constructor(qgis: QgisSdkCore2<unknown, unknown>, id: string, options?: FormOptions2);
|
|
254
|
+
/** The declaration the form was built from, for a page that renders more. */
|
|
255
|
+
static describe(qgis: QgisSdkCore2<unknown, unknown>, id: string): ActionDescription2 | undefined;
|
|
256
|
+
private static defaults;
|
|
257
|
+
private static evaluate;
|
|
258
|
+
/** Set one field; `undefined` unsets it. */
|
|
259
|
+
readonly set: (name: string, value: unknown) => void;
|
|
260
|
+
/** Set several fields at once. */
|
|
261
|
+
readonly setValues: (changes: FormValues2) => void;
|
|
262
|
+
/** The declared field, for a renderer working from a name. */
|
|
263
|
+
field(name: string): FormField2;
|
|
264
|
+
/** Back to the initial values and an idle submission; aborts a call in flight. */
|
|
265
|
+
readonly reset: () => void;
|
|
266
|
+
/** Abort a submission in flight; the values stay. */
|
|
267
|
+
readonly abort: () => void;
|
|
268
|
+
/**
|
|
269
|
+
* Validate, then run the action with the current values. Resolves with the
|
|
270
|
+
* result, or `undefined` when the values are invalid (no call is made) or
|
|
271
|
+
* the call failed, was aborted or superseded - `submission` says which.
|
|
272
|
+
*/
|
|
273
|
+
readonly submit: () => Promise<R | undefined>;
|
|
274
|
+
/** Stop following the submission; for an adapter tearing the form down. */
|
|
275
|
+
dispose(): void;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* The form for `qgis.<id>`, typed from the schema: the request names the
|
|
279
|
+
* fields, the result types the submission.
|
|
280
|
+
*/
|
|
281
|
+
declare function formStore2<
|
|
282
|
+
O,
|
|
283
|
+
K extends keyof O & string
|
|
284
|
+
>(qgis: QgisSdkCore2<O, unknown>, id: K, options?: FormOptions2): FormStore2<RequestOf<O, K> & object, ResultOf<O, K>>;
|
|
285
|
+
/** Where one host query stands. */
|
|
286
|
+
type HostQueryState2<T> = {
|
|
287
|
+
readonly status: "idle";
|
|
288
|
+
} | {
|
|
289
|
+
readonly status: "loading";
|
|
290
|
+
} | {
|
|
291
|
+
readonly status: "ok";
|
|
292
|
+
readonly value: T;
|
|
293
|
+
} | {
|
|
294
|
+
readonly status: "error";
|
|
295
|
+
readonly error: Error;
|
|
296
|
+
} | {
|
|
297
|
+
/** The handshake did not grant `operation`; no call was made. */
|
|
298
|
+
readonly status: "refused";
|
|
299
|
+
readonly operation: HostOperationId2;
|
|
300
|
+
readonly message: string;
|
|
301
|
+
};
|
|
302
|
+
/** What a host query runs once the grant is confirmed. */
|
|
303
|
+
type HostQueryLoader2<T> = (host: QgisSdkHost2, options: {
|
|
304
|
+
readonly signal: AbortSignal;
|
|
305
|
+
}) => Promise<T>;
|
|
306
|
+
/**
|
|
307
|
+
* Read the curated host surface, grant first.
|
|
308
|
+
*
|
|
309
|
+
* `refresh` waits for the handshake, then - when `qgis.host.granted` lacks
|
|
310
|
+
* the operation the query needs - settles on `refused` without a call, so a
|
|
311
|
+
* page can show "ask the plugin author for `layers.read`" instead of a
|
|
312
|
+
* `not_authorized` fault. Otherwise the loader runs with latest-wins
|
|
313
|
+
* semantics like an operation store.
|
|
314
|
+
*/
|
|
315
|
+
declare class HostQueryStore2<T> extends BaseStore<HostQueryState2<T>> {
|
|
316
|
+
private readonly qgis;
|
|
317
|
+
readonly operation: HostOperationId2;
|
|
318
|
+
private readonly loader;
|
|
319
|
+
private generation;
|
|
320
|
+
private controller;
|
|
321
|
+
constructor(qgis: QgisSdkCore2<unknown, unknown>, operation: HostOperationId2, loader: HostQueryLoader2<T>);
|
|
322
|
+
readonly abort: () => void;
|
|
323
|
+
readonly reset: () => void;
|
|
324
|
+
readonly refresh: () => Promise<T | undefined>;
|
|
325
|
+
}
|
|
326
|
+
/** Options for {@link layersQuery}. */
|
|
327
|
+
interface LayersQueryOptions2 {
|
|
328
|
+
/** Items per page while following `next_cursor`; the host's default otherwise. */
|
|
329
|
+
readonly pageSize?: number;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Every vector layer of the project, following `layers.list` pages to the
|
|
333
|
+
* end: what a layer picker binds to. Needs the `layers.read` grant.
|
|
334
|
+
*/
|
|
335
|
+
declare function layersQuery2(qgis: QgisSdkCore2<unknown, unknown>, options?: LayersQueryOptions2): HostQueryStore2<readonly VectorLayerInfo2[]>;
|
|
336
|
+
/**
|
|
337
|
+
* The field names of one vector layer, for a `field` input whose `of` names
|
|
338
|
+
* a layer input: `layers.get` under the `layers.read` grant. A layer's CRS is
|
|
339
|
+
* on the same reply; a project CRS query is not on the wire yet.
|
|
340
|
+
*/
|
|
341
|
+
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 };
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { QgisSdkError2 } from "./chunk-pdj2fxjb.js";
|
|
2
|
+
declare const HOST_ID2 = "qgis.host";
|
|
3
|
+
declare const HOST_FINGERPRINT2 = "sha256:16790dc8c4d77ef5b5f22636702e913f3d6fb63275d0ae3e5a4ca6e8001a9abd";
|
|
4
|
+
declare const HOST_SCHEMA_VERSION2 = 1;
|
|
5
|
+
/** Every declared operation id, so a name can be checked, not guessed. */
|
|
6
|
+
declare const HOST_OPERATIONS2: readonly ["algorithms.describe", "algorithms.list", "algorithms.providers", "algorithms.run", "files.export", "layers.get", "layers.list", "layers.open_vector", "network.fetch", "notifications.info", "project.layer_ids", "settings.get", "styles.apply"];
|
|
7
|
+
type HostOperationId2 = (typeof HOST_OPERATIONS2)[number];
|
|
8
|
+
interface HostInvokeOptions2 {
|
|
9
|
+
readonly signal?: AbortSignal;
|
|
10
|
+
}
|
|
11
|
+
/** The client this module wraps: anything with a correlated invoke. */
|
|
12
|
+
interface HostClientLike2 {
|
|
13
|
+
invoke(operation: string, payload?: Readonly<Record<string, unknown>>, options?: HostInvokeOptions2): Promise<unknown>;
|
|
14
|
+
subscribe(operation: string, payload?: Readonly<Record<string, unknown>>, handlers?: HostStreamHandlers2<{
|
|
15
|
+
readonly kind: "data" | "progress" | "state";
|
|
16
|
+
readonly payload: unknown;
|
|
17
|
+
}>, options?: HostInvokeOptions2): Promise<HostStreamHandle2>;
|
|
18
|
+
}
|
|
19
|
+
/** How a stream ended; `dropped` is only present for a gap. */
|
|
20
|
+
interface HostStreamTerminal2 {
|
|
21
|
+
readonly kind: "complete" | "error" | "cancelled" | "gap" | "disposed";
|
|
22
|
+
readonly message?: string;
|
|
23
|
+
readonly dropped?: number;
|
|
24
|
+
}
|
|
25
|
+
/** What a stream reports: typed events, then exactly one end. */
|
|
26
|
+
interface HostStreamHandlers2<E> {
|
|
27
|
+
readonly onEvent?: (event: E) => void;
|
|
28
|
+
readonly onTerminal?: (terminal: HostStreamTerminal2) => void;
|
|
29
|
+
}
|
|
30
|
+
/** A live stream, as the caller holds it. */
|
|
31
|
+
interface HostStreamHandle2 {
|
|
32
|
+
readonly id: string;
|
|
33
|
+
readonly closed: boolean;
|
|
34
|
+
close(): void;
|
|
35
|
+
}
|
|
36
|
+
/** An argument or a response that does not match its declared schema. */
|
|
37
|
+
declare class QgisSdkHostContractError2 extends QgisSdkError2 {
|
|
38
|
+
readonly operation: string;
|
|
39
|
+
constructor(operation: string, message: string);
|
|
40
|
+
}
|
|
41
|
+
interface AlgorithmInfo2 {
|
|
42
|
+
readonly deprecated: boolean;
|
|
43
|
+
readonly group: string;
|
|
44
|
+
readonly group_id: string;
|
|
45
|
+
readonly help: string;
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly label: string;
|
|
48
|
+
readonly name: string;
|
|
49
|
+
readonly outputs: readonly OutputInfo2[];
|
|
50
|
+
readonly parameters: readonly ParameterInfo2[];
|
|
51
|
+
readonly provider: string;
|
|
52
|
+
}
|
|
53
|
+
interface AlgorithmListRequest2 {
|
|
54
|
+
readonly cursor?: string;
|
|
55
|
+
readonly limit?: number;
|
|
56
|
+
readonly provider?: string;
|
|
57
|
+
}
|
|
58
|
+
interface AlgorithmPage2 {
|
|
59
|
+
readonly items: readonly AlgorithmSummary2[];
|
|
60
|
+
readonly next_cursor?: string;
|
|
61
|
+
readonly truncated: boolean;
|
|
62
|
+
}
|
|
63
|
+
interface AlgorithmRequest2 {
|
|
64
|
+
readonly algorithm_id: string;
|
|
65
|
+
}
|
|
66
|
+
interface AlgorithmSummary2 {
|
|
67
|
+
readonly deprecated: boolean;
|
|
68
|
+
readonly group: string;
|
|
69
|
+
readonly id: string;
|
|
70
|
+
readonly label: string;
|
|
71
|
+
readonly name: string;
|
|
72
|
+
readonly provider: string;
|
|
73
|
+
}
|
|
74
|
+
interface ExportRequest2 {
|
|
75
|
+
readonly content: string;
|
|
76
|
+
readonly file: FileRef2;
|
|
77
|
+
}
|
|
78
|
+
interface ExportResult2 {
|
|
79
|
+
readonly bytes_written: number;
|
|
80
|
+
readonly name: string;
|
|
81
|
+
}
|
|
82
|
+
interface FetchRequest2 {
|
|
83
|
+
readonly auth_config?: string;
|
|
84
|
+
readonly body?: string;
|
|
85
|
+
readonly headers?: readonly HttpHeader2[];
|
|
86
|
+
readonly method?: "GET" | "HEAD" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS";
|
|
87
|
+
readonly timeout_seconds?: number;
|
|
88
|
+
readonly url: string;
|
|
89
|
+
}
|
|
90
|
+
interface FileRef2 {
|
|
91
|
+
readonly id: string;
|
|
92
|
+
readonly kind: "file" | "directory";
|
|
93
|
+
readonly name?: string;
|
|
94
|
+
readonly operations?: readonly ("read" | "write")[];
|
|
95
|
+
}
|
|
96
|
+
interface HttpHeader2 {
|
|
97
|
+
readonly name: string;
|
|
98
|
+
readonly value: string;
|
|
99
|
+
}
|
|
100
|
+
interface IdPage2 {
|
|
101
|
+
readonly items: readonly string[];
|
|
102
|
+
readonly next_cursor?: string;
|
|
103
|
+
readonly truncated: boolean;
|
|
104
|
+
}
|
|
105
|
+
interface LayerPage2 {
|
|
106
|
+
readonly items: readonly VectorLayerInfo2[];
|
|
107
|
+
readonly next_cursor?: string;
|
|
108
|
+
readonly truncated: boolean;
|
|
109
|
+
}
|
|
110
|
+
interface LayerRequest2 {
|
|
111
|
+
readonly layer_id: string;
|
|
112
|
+
}
|
|
113
|
+
interface NetworkFetchData2 {
|
|
114
|
+
readonly base64: string | null;
|
|
115
|
+
readonly headers: readonly HttpHeader2[];
|
|
116
|
+
readonly reason: string;
|
|
117
|
+
readonly status_code: number;
|
|
118
|
+
readonly text: string | null;
|
|
119
|
+
readonly url: string;
|
|
120
|
+
}
|
|
121
|
+
interface NotificationsInfoRequest2 {
|
|
122
|
+
readonly message: string;
|
|
123
|
+
}
|
|
124
|
+
interface OpenVectorRequest2 {
|
|
125
|
+
readonly file: FileRef2;
|
|
126
|
+
}
|
|
127
|
+
interface OutputInfo2 {
|
|
128
|
+
readonly kind: string;
|
|
129
|
+
readonly label: string;
|
|
130
|
+
readonly name: string;
|
|
131
|
+
}
|
|
132
|
+
interface PageRequest2 {
|
|
133
|
+
readonly cursor?: string;
|
|
134
|
+
readonly limit?: number;
|
|
135
|
+
}
|
|
136
|
+
interface ParameterInfo2 {
|
|
137
|
+
readonly advanced: boolean;
|
|
138
|
+
readonly default_json: string | null;
|
|
139
|
+
readonly description: string;
|
|
140
|
+
readonly destination: boolean;
|
|
141
|
+
readonly extension: string | null;
|
|
142
|
+
readonly hidden: boolean;
|
|
143
|
+
readonly kind: string;
|
|
144
|
+
readonly label: string;
|
|
145
|
+
readonly maximum: number | null;
|
|
146
|
+
readonly minimum: number | null;
|
|
147
|
+
readonly multiple: boolean;
|
|
148
|
+
readonly name: string;
|
|
149
|
+
readonly number_type: string | null;
|
|
150
|
+
readonly optional: boolean;
|
|
151
|
+
readonly options: readonly string[];
|
|
152
|
+
readonly required: boolean;
|
|
153
|
+
}
|
|
154
|
+
interface ProviderInfo2 {
|
|
155
|
+
readonly id: string;
|
|
156
|
+
readonly label: string;
|
|
157
|
+
readonly version: string;
|
|
158
|
+
}
|
|
159
|
+
interface ProviderPage2 {
|
|
160
|
+
readonly items: readonly ProviderInfo2[];
|
|
161
|
+
readonly next_cursor?: string;
|
|
162
|
+
readonly truncated: boolean;
|
|
163
|
+
}
|
|
164
|
+
interface RunAlgorithmRequest2 {
|
|
165
|
+
readonly algorithm_id: string;
|
|
166
|
+
readonly params: Record<string, unknown>;
|
|
167
|
+
}
|
|
168
|
+
interface RunOutput2 {
|
|
169
|
+
readonly file?: FileRef2;
|
|
170
|
+
readonly kind: "vector" | "file" | "value";
|
|
171
|
+
readonly layer?: VectorLayerInfo2;
|
|
172
|
+
readonly name: string;
|
|
173
|
+
readonly value?: string | number | boolean | null;
|
|
174
|
+
}
|
|
175
|
+
interface RunResult2 {
|
|
176
|
+
readonly algorithm: string;
|
|
177
|
+
readonly outputs: readonly RunOutput2[];
|
|
178
|
+
}
|
|
179
|
+
interface SettingsGetRequest2 {
|
|
180
|
+
readonly default?: string | null;
|
|
181
|
+
readonly key: string;
|
|
182
|
+
}
|
|
183
|
+
interface StylesApplyRequest2 {
|
|
184
|
+
readonly layer_id: string;
|
|
185
|
+
readonly style: string;
|
|
186
|
+
}
|
|
187
|
+
interface VectorLayerInfo2 {
|
|
188
|
+
readonly crs: string | null;
|
|
189
|
+
readonly field_names: readonly string[];
|
|
190
|
+
readonly geometry_type: "point" | "line" | "polygon" | "none";
|
|
191
|
+
readonly id: string;
|
|
192
|
+
readonly name: string;
|
|
193
|
+
}
|
|
194
|
+
declare function AlgorithmInfo2(value: unknown, strict?: boolean): value is AlgorithmInfo2;
|
|
195
|
+
declare function AlgorithmListRequest2(value: unknown, strict?: boolean): value is AlgorithmListRequest2;
|
|
196
|
+
declare function AlgorithmPage2(value: unknown, strict?: boolean): value is AlgorithmPage2;
|
|
197
|
+
declare function AlgorithmRequest2(value: unknown, strict?: boolean): value is AlgorithmRequest2;
|
|
198
|
+
declare function ExportRequest2(value: unknown, strict?: boolean): value is ExportRequest2;
|
|
199
|
+
declare function ExportResult2(value: unknown, strict?: boolean): value is ExportResult2;
|
|
200
|
+
declare function FetchRequest2(value: unknown, strict?: boolean): value is FetchRequest2;
|
|
201
|
+
declare function IdPage2(value: unknown, strict?: boolean): value is IdPage2;
|
|
202
|
+
declare function LayerPage2(value: unknown, strict?: boolean): value is LayerPage2;
|
|
203
|
+
declare function LayerRequest2(value: unknown, strict?: boolean): value is LayerRequest2;
|
|
204
|
+
declare function NetworkFetchData2(value: unknown, strict?: boolean): value is NetworkFetchData2;
|
|
205
|
+
declare function NotificationsInfoRequest2(value: unknown, strict?: boolean): value is NotificationsInfoRequest2;
|
|
206
|
+
declare function OpenVectorRequest2(value: unknown, strict?: boolean): value is OpenVectorRequest2;
|
|
207
|
+
declare function PageRequest2(value: unknown, strict?: boolean): value is PageRequest2;
|
|
208
|
+
declare function ProviderPage2(value: unknown, strict?: boolean): value is ProviderPage2;
|
|
209
|
+
declare function RunAlgorithmRequest2(value: unknown, strict?: boolean): value is RunAlgorithmRequest2;
|
|
210
|
+
declare function RunResult2(value: unknown, strict?: boolean): value is RunResult2;
|
|
211
|
+
declare function SettingsGetRequest2(value: unknown, strict?: boolean): value is SettingsGetRequest2;
|
|
212
|
+
declare function StylesApplyRequest2(value: unknown, strict?: boolean): value is StylesApplyRequest2;
|
|
213
|
+
/** One event of `network.fetch`, narrowed by its kind. */
|
|
214
|
+
type NetworkFetchEvent2 = {
|
|
215
|
+
readonly kind: "data";
|
|
216
|
+
readonly payload: NetworkFetchData2;
|
|
217
|
+
};
|
|
218
|
+
declare function NetworkFetchEvent2(value: unknown, strict?: boolean): value is NetworkFetchEvent2;
|
|
219
|
+
/** Every operation this surface declares, as callable methods. */
|
|
220
|
+
interface HostOperations2 {
|
|
221
|
+
readonly algorithms: {
|
|
222
|
+
readonly describe: (input: AlgorithmRequest2, options?: HostInvokeOptions2) => Promise<AlgorithmInfo2>;
|
|
223
|
+
readonly list: (input?: AlgorithmListRequest2, options?: HostInvokeOptions2) => Promise<AlgorithmPage2>;
|
|
224
|
+
readonly providers: (input?: PageRequest2, options?: HostInvokeOptions2) => Promise<ProviderPage2>;
|
|
225
|
+
readonly run: (input: RunAlgorithmRequest2, options?: HostInvokeOptions2) => Promise<RunResult2>;
|
|
226
|
+
};
|
|
227
|
+
readonly files: {
|
|
228
|
+
readonly export: (input: ExportRequest2, options?: HostInvokeOptions2) => Promise<ExportResult2>;
|
|
229
|
+
};
|
|
230
|
+
readonly layers: {
|
|
231
|
+
readonly get: (input: LayerRequest2, options?: HostInvokeOptions2) => Promise<VectorLayerInfo2>;
|
|
232
|
+
readonly list: (input?: PageRequest2, options?: HostInvokeOptions2) => Promise<LayerPage2>;
|
|
233
|
+
readonly open_vector: (input: OpenVectorRequest2, options?: HostInvokeOptions2) => Promise<VectorLayerInfo2>;
|
|
234
|
+
};
|
|
235
|
+
readonly network: {
|
|
236
|
+
readonly fetch: (input: FetchRequest2, handlers: HostStreamHandlers2<NetworkFetchEvent2>, options?: HostInvokeOptions2) => Promise<HostStreamHandle2>;
|
|
237
|
+
};
|
|
238
|
+
readonly notifications: {
|
|
239
|
+
readonly info: (input: NotificationsInfoRequest2, options?: HostInvokeOptions2) => Promise<null>;
|
|
240
|
+
};
|
|
241
|
+
readonly project: {
|
|
242
|
+
readonly layer_ids: (input?: PageRequest2, options?: HostInvokeOptions2) => Promise<IdPage2>;
|
|
243
|
+
};
|
|
244
|
+
readonly settings: {
|
|
245
|
+
readonly get: (input: SettingsGetRequest2, options?: HostInvokeOptions2) => Promise<string | null>;
|
|
246
|
+
};
|
|
247
|
+
readonly styles: {
|
|
248
|
+
readonly apply: (input: StylesApplyRequest2, options?: HostInvokeOptions2) => Promise<null>;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
declare function createHost2(client: HostClientLike2): HostOperations2;
|
|
252
|
+
export { HOST_ID2, HOST_FINGERPRINT2, HOST_SCHEMA_VERSION2, HOST_OPERATIONS2, HostOperationId2, HostInvokeOptions2, HostClientLike2, HostStreamTerminal2, HostStreamHandlers2, HostStreamHandle2, QgisSdkHostContractError2, AlgorithmInfo2, AlgorithmListRequest2, AlgorithmPage2, AlgorithmRequest2, AlgorithmSummary2, ExportRequest2, ExportResult2, FetchRequest2, FileRef2, HttpHeader2, IdPage2, LayerPage2, LayerRequest2, NetworkFetchData2, NotificationsInfoRequest2, OpenVectorRequest2, OutputInfo2, PageRequest2, ParameterInfo2, ProviderInfo2, ProviderPage2, RunAlgorithmRequest2, RunOutput2, RunResult2, SettingsGetRequest2, StylesApplyRequest2, VectorLayerInfo2, NetworkFetchEvent2, HostOperations2, createHost2 };
|