• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

jumpinjackie / mapguide-react-layout / 15165370206

21 May 2025 02:48PM UTC coverage: 22.447%. Remained the same
15165370206

push

github

jumpinjackie
#1555: More internalization of things that shouldn't be in the API documentation.

Also dd merge-modules plugin for typedoc which flattens our public symbol list, which makes better sense as our node module usage story is to import from a flat barrel "mapguide-react-layout" module.

878 of 1206 branches covered (72.8%)

4975 of 22163 relevant lines covered (22.45%)

6.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/api/request-builder.ts
1
import { SelectionVariant } from './common';
2
import { ResourceIdentifier, ResourceBase, SiteVersionResponse } from './contracts/common';
3
import { RuntimeMap } from './contracts/runtime-map';
4
import { QueryMapFeaturesResponse } from './contracts/query';
5

6
/**
7
 * Describes a request that takes either a session or username/password pair
8
 *
9
 *
10
 * @interface IAuthenticatedRequest
11
 */
12
export interface IAuthenticatedRequest {
13
    /**
14
     * The session id
15
     *
16
     * @type {string}
17
     *
18
     */
19
    session?: string;
20
    /**
21
     * The username
22
     *
23
     * @type {string}
24
     *
25
     */
26
    username?: string;
27
    /**
28
     * The password
29
     *
30
     * @type {string}
31
     *
32
     */
33
    password?: string;
34
}
35

36
/**
37
 * Bitmask describing what data to return when creating a runtime map
38
 *
39
 *
40
 * @enum {number}
41
 */
42
export enum RuntimeMapFeatureFlags {
1✔
43
    /**
44
     * Include data about layers and groups
45
     */
46
    LayersAndGroups = 1,
1✔
47
    /**
48
     * Include layer icons
49
     */
50
    LayerIcons = 2,
1✔
51
    /**
52
     * Include data about layer feature sources
53
     */
54
    LayerFeatureSources = 4
1✔
55
}
56

57
/**
58
 * Describes options for creating a runtime map
59
 *
60
 *
61
 * @interface ICreateRuntimeMapOptions
62
 * @extends {IAuthenticatedRequest}
63
 */
64
export interface ICreateRuntimeMapOptions extends IAuthenticatedRequest {
65
    /**
66
     * The map definition id
67
     *
68
     * @type {ResourceIdentifier}
69
     *
70
     */
71
    mapDefinition: ResourceIdentifier;
72
    /**
73
     * A bitmask indicating what data to return
74
     *
75
     * @type {(number | RuntimeMapFeatureFlags)}
76
     *
77
     */
78
    requestedFeatures: number | RuntimeMapFeatureFlags;
79
    /**
80
     * If requesting icons, the number of icons per scale range
81
     *
82
     * @type {number}
83
     *
84
     */
85
    iconsPerScaleRange?: number;
86
    /**
87
     * The image format for requested icons
88
     *
89
     * @type {("PNG" | "PNG8" | "GIF" | "JPG")}
90
     *
91
     */
92
    iconFormat?: "PNG" | "PNG8" | "GIF" | "JPG";
93
    /**
94
     * The width of requested icons
95
     *
96
     * @type {number}
97
     *
98
     */
99
    iconWidth?: number;
100
    /**
101
     * The height of requested icons
102
     *
103
     * @type {number}
104
     *
105
     */
106
    iconHeight?: number;
107
    /**
108
     * The target map name to assign. Otherwise the map name will be computed from the map definition id
109
     *
110
     * @type {string}
111
     *
112
     */
113
    targetMapName?: string;
114
}
115

116
/**
117
 * Describes operations requiring a session id
118
 *
119
 *
120
 * @interface ISessionBasedRequest
121
 */
122
export interface ISessionBasedRequest {
123
    /**
124
     * The session id
125
     *
126
     * @type {string}
127
     */
128
    session: string;
129
}
130

131
/**
132
 * Describes operations against a runtime map
133
 *
134
 *
135
 * @interface IRuntimeMapRequest
136
 * @extends {ISessionBasedRequest}
137
 */
138
export interface IRuntimeMapRequest extends ISessionBasedRequest {
139
    /**
140
     * The name of the runtime map
141
     *
142
     * @type {string}
143
     */
144
    mapname: string;
145
}
146

147
/**
148
 * A bitmask indicating what to return when querying map features
149
 *
150
 *
151
 * @enum {number}
152
 */
153
export enum QueryFeaturesSet {
1✔
154
    /**
155
     * Include attributes of selected features
156
     */
157
    Attributes = 1,
1✔
158
    /**
159
     * Include an inline image of the selected features
160
     */
161
    InlineSelection = 2,
1✔
162
    /**
163
     * Include tooltips for the first matching feature
164
     */
165
    Tooltip = 4,
1✔
166
    /**
167
     * Include hyperlink for the first matching feature
168
     */
169
    Hyperlink = 8
1✔
170
}
171

172

173

174
/**
175
 * Options for querying map features
176
 *
177
 *
178
 * @interface IQueryMapFeaturesOptions
179
 * @extends {IRuntimeMapRequest}
180
 */
181
export interface IQueryMapFeaturesOptions extends IRuntimeMapRequest {
182
    /**
183
     * A comma-seperated list of layer name to restrict the query on. Omit to
184
     * cover all selectable layers
185
     *
186
     * @type {string}
187
     */
188
    layernames?: string;
189
    /**
190
     * The WKT of the query geometry
191
     *
192
     * @type {string}
193
     */
194
    geometry?: string;
195
    /**
196
     * The spatial query operator to use with the input geometry
197
     *
198
     * @type {SelectionVariant}
199
     */
200
    selectionvariant?: SelectionVariant;
201
    /**
202
     * A bitmask containing what features to ask for
203
     *
204
     * @type {QueryFeaturesSet}
205
     */
206
    requestdata?: QueryFeaturesSet;
207
    /**
208
     * The color of the selection
209
     *
210
     * @type {string}
211
     */
212
    selectioncolor?: string;
213
    /**
214
     * The image format of the requested selection image
215
     *
216
     * @type {("PNG" | "JPG" | "GIF" | "PNG8")}
217
     */
218
    selectionformat?: "PNG" | "JPG" | "GIF" | "PNG8";
219
    /**
220
     * The maximum number of features to select. Use -1 for no limit.
221
     *
222
     * @type {number}
223
     */
224
    maxfeatures?: number;
225
    /**
226
     * 1 = Persist the query selection changes to the current selection set
227
     * 0 = The query selection does not modify the current selection set
228
     *
229
     * @type {number}
230
     */
231
    persist?: number;
232
    /**
233
     * An optional selection XML string. If specified, the rendering/query will be based off of
234
     * a selection initialized with this selection XML
235
     */
236
    featurefilter?: string;
237
    layerattributefilter?: number;
238
}
239

240
/**
241
 * Options for describing a runtime map
242
 *
243
 *
244
 * @interface IDescribeRuntimeMapOptions
245
 * @extends {IRuntimeMapRequest}
246
 */
247
export interface IDescribeRuntimeMapOptions extends IRuntimeMapRequest {
248
    /**
249
     * A bitmask of data to return about a runtime map
250
     *
251
     * @type {(number | RuntimeMapFeatureFlags)}
252
     *
253
     */
254
    requestedFeatures?: number | RuntimeMapFeatureFlags;
255
    /**
256
     * If requesting icons, the number of icons per scale range
257
     *
258
     * @type {number}
259
     *
260
     */
261
    iconsPerScaleRange?: number;
262
    /**
263
     * The image format for requested icons
264
     *
265
     * @type {("PNG" | "PNG8" | "GIF" | "JPG")}
266
     *
267
     */
268
    iconFormat?: "PNG" | "PNG8" | "GIF" | "JPG";
269
    /**
270
     * The width of requested icons
271
     *
272
     * @type {number}
273
     *
274
     */
275
    iconWidth?: number;
276
    /**
277
     * The height of requested icons
278
     *
279
     * @type {number}
280
     *
281
     */
282
    iconHeight?: number;
283
}
284

285
/**
286
 * Provides client services for a MapGuide map viewer
287
 *
288
 *
289
 * @interface IMapGuideClient
290
 */
291
export interface IMapGuideClient {
292
    /**
293
     * Creates a new MapGuide session
294
     *
295
     * @param {string} username
296
     * @param {string} password
297
     * @returns {Promise<string>}
298
     */
299
    createSession(username: string, password: string): Promise<string>;
300

301
    /**
302
     * Retrieves the requested resource
303
     *
304
     * @abstract
305
     * @template T
306
     * @param {string} resourceId
307
     * @returns {PromiseLike<T>}
308
     */
309
    getResource<T extends ResourceBase>(resourceId: ResourceIdentifier, args?: any): Promise<T>;
310

311
    /**
312
     * Creates a runtime map from the specified map definition
313
     *
314
     * @abstract
315
     * @param {ICreateRuntimeMapOptions} options
316
     * @returns {PromiseLike<RuntimeMap>}
317
     */
318
    createRuntimeMap(options: ICreateRuntimeMapOptions): Promise<RuntimeMap>;
319

320
    /**
321
     * Performs a map selection query on the current map
322
     *
323
     * @abstract
324
     * @param {IQueryMapFeaturesOptions} options
325
     * @returns {PromiseLike<QueryMapFeaturesResponse>}
326
     */
327
    queryMapFeatures(options: IQueryMapFeaturesOptions): Promise<QueryMapFeaturesResponse>;
328

329
    /**
330
     * Performs a map selection query on the current map. Only applicable for use with MapGuide
331
     * Open Source 4.0 and higher
332
     *
333
     * @abstract
334
     * @param {IQueryMapFeaturesOptions} options
335
     * @returns {PromiseLike<QueryMapFeaturesResponse>}
336
     */
337
    queryMapFeatures_v4(options: IQueryMapFeaturesOptions): Promise<QueryMapFeaturesResponse>;
338

339
    /**
340
     * Describes a runtime map
341
     *
342
     * @abstract
343
     * @param {IDescribeRuntimeMapOptions} options
344
     * @returns {PromiseLike<RuntimeMap>}
345
     */
346
    describeRuntimeMap(options: IDescribeRuntimeMapOptions): Promise<RuntimeMap>;
347

348
    /**
349
     * Gets the tile template URL used by the viewer to send tile requests
350
     *
351
     * @param {string} resourceId
352
     * @param {string} groupName
353
     * @param {string} xPlaceholder
354
     * @param {string} yPlaceholder
355
     * @param {string} zPlaceholder
356
     * @param {boolean} isXYZ
357
     * @returns {string}
358
     * 
359
     * @since 0.14.8 added isXYZ parameter
360
     */
361
    getTileTemplateUrl(resourceId: string, groupName: string, xPlaceholder: string, yPlaceholder: string, zPlaceholder: string, isXYZ: boolean): string;
362
}
363

364
/**
365
 * An abstract MapGuide service client
366
 *
367
 *
368
 * @abstract
369
 * @class RequestBuilder
370
 */
371
export abstract class RequestBuilder implements IMapGuideClient {
1✔
372
    protected agentUri: string;
373
    constructor(agentUri: string) {
1✔
374
        this.agentUri = agentUri;
×
375
    }
×
376

377
    public abstract createSession(username: string, password: string): Promise<string>;
378

379
    public abstract getServerSessionTimeout(session: string): Promise<number>;
380

381
    public abstract getResource<T extends ResourceBase>(resourceId: ResourceIdentifier, args?: any): Promise<T>;
382

383
    public abstract createRuntimeMap(options: ICreateRuntimeMapOptions): Promise<RuntimeMap>;
384

385
    public abstract createRuntimeMap_v4(options: ICreateRuntimeMapOptions): Promise<RuntimeMap>;
386

387
    public abstract queryMapFeatures(options: IQueryMapFeaturesOptions): Promise<QueryMapFeaturesResponse>;
388

389
    public abstract queryMapFeatures_v4(options: IQueryMapFeaturesOptions): Promise<QueryMapFeaturesResponse>;
390

391
    public abstract describeRuntimeMap(options: IDescribeRuntimeMapOptions): Promise<RuntimeMap>;
392

393
    public abstract describeRuntimeMap_v4(options: IDescribeRuntimeMapOptions): Promise<RuntimeMap>;
394

395
    public abstract getTileTemplateUrl(resourceId: string, groupName: string, xPlaceholder: string, yPlaceholder: string, zPlaceholder: string, isXYZ: boolean): string;
396

397
    public abstract getSiteVersion(): Promise<SiteVersionResponse>;
398
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc