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

jumpinjackie / mapguide-react-layout / 15160437878

21 May 2025 11:00AM UTC coverage: 21.631% (-42.6%) from 64.24%
15160437878

Pull #1552

github

web-flow
Merge 8b7153d9e into 236e2ea07
Pull Request #1552: Feature/package updates 2505

839 of 1165 branches covered (72.02%)

11 of 151 new or added lines in 25 files covered. (7.28%)

1332 existing lines in 50 files now uncovered.

4794 of 22163 relevant lines covered (21.63%)

6.89 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
 * @export
10
 * @interface IAuthenticatedRequest
11
 */
12
export interface IAuthenticatedRequest {
13
    /**
14
     * The session id
15
     *
16
     * @type {string}
17
     * @memberOf IAuthenticatedRequest
18
     */
19
    session?: string;
20
    /**
21
     * The username
22
     *
23
     * @type {string}
24
     * @memberOf IAuthenticatedRequest
25
     */
26
    username?: string;
27
    /**
28
     * The password
29
     *
30
     * @type {string}
31
     * @memberOf IAuthenticatedRequest
32
     */
33
    password?: string;
34
}
35

36
/**
37
 * Bitmask describing what data to return when creating a runtime map
38
 *
39
 * @export
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
 * @export
61
 * @interface ICreateRuntimeMapOptions
62
 * @extends {IAuthenticatedRequest}
63
 */
64
export interface ICreateRuntimeMapOptions extends IAuthenticatedRequest {
65
    /**
66
     * The map definition id
67
     *
68
     * @type {ResourceIdentifier}
69
     * @memberOf ICreateRuntimeMapOptions
70
     */
71
    mapDefinition: ResourceIdentifier;
72
    /**
73
     * A bitmask indicating what data to return
74
     *
75
     * @type {(number | RuntimeMapFeatureFlags)}
76
     * @memberOf ICreateRuntimeMapOptions
77
     */
78
    requestedFeatures: number | RuntimeMapFeatureFlags;
79
    /**
80
     * If requesting icons, the number of icons per scale range
81
     *
82
     * @type {number}
83
     * @memberOf ICreateRuntimeMapOptions
84
     */
85
    iconsPerScaleRange?: number;
86
    /**
87
     * The image format for requested icons
88
     *
89
     * @type {("PNG" | "PNG8" | "GIF" | "JPG")}
90
     * @memberOf ICreateRuntimeMapOptions
91
     */
92
    iconFormat?: "PNG" | "PNG8" | "GIF" | "JPG";
93
    /**
94
     * The width of requested icons
95
     *
96
     * @type {number}
97
     * @memberOf ICreateRuntimeMapOptions
98
     */
99
    iconWidth?: number;
100
    /**
101
     * The height of requested icons
102
     *
103
     * @type {number}
104
     * @memberOf ICreateRuntimeMapOptions
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
     * @memberOf ICreateRuntimeMapOptions
112
     */
113
    targetMapName?: string;
114
}
115

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

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

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

174

175

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

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

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

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

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

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

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

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

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

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

380
    public abstract createSession(username: string, password: string): Promise<string>;
381

382
    public abstract getServerSessionTimeout(session: string): Promise<number>;
383

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

386
    public abstract createRuntimeMap(options: ICreateRuntimeMapOptions): Promise<RuntimeMap>;
387

388
    public abstract createRuntimeMap_v4(options: ICreateRuntimeMapOptions): Promise<RuntimeMap>;
389

390
    public abstract queryMapFeatures(options: IQueryMapFeaturesOptions): Promise<QueryMapFeaturesResponse>;
391

392
    public abstract queryMapFeatures_v4(options: IQueryMapFeaturesOptions): Promise<QueryMapFeaturesResponse>;
393

394
    public abstract describeRuntimeMap(options: IDescribeRuntimeMapOptions): Promise<RuntimeMap>;
395

396
    public abstract describeRuntimeMap_v4(options: IDescribeRuntimeMapOptions): Promise<RuntimeMap>;
397

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

400
    public abstract getSiteVersion(): Promise<SiteVersionResponse>;
401
}
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