jmapcloud-ng-core-types 0.0.4
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/.prettierrc +10 -0
- package/.vscode/settings.json +24 -0
- package/README.md +12 -0
- package/_config.yml +1 -0
- package/all-enums.ts +286 -0
- package/index.ts +1003 -0
- package/package.json +42 -0
- package/public/core.d.ts +12255 -0
- package/public/jmap/ajax.d.ts +31 -0
- package/public/jmap/date.d.ts +17 -0
- package/public/jmap/extension.d.ts +216 -0
- package/public/jmap/features.d.ts +32 -0
- package/public/jmap/form.d.ts +590 -0
- package/public/jmap/geocoding.d.ts +33 -0
- package/public/jmap/geometry.d.ts +44 -0
- package/public/jmap/language.d.ts +38 -0
- package/public/jmap/layer.d.ts +591 -0
- package/public/jmap/main.d.ts +30 -0
- package/public/jmap/map-context.d.ts +197 -0
- package/public/jmap/map.d.ts +622 -0
- package/public/jmap/mouseover.d.ts +62 -0
- package/public/jmap/photos.d.ts +43 -0
- package/public/jmap/project.d.ts +45 -0
- package/public/jmap/query.d.ts +41 -0
- package/public/jmap/selection.d.ts +25 -0
- package/public/jmap/server.d.ts +79 -0
- package/public/jmap/startup-options.d.ts +500 -0
- package/public/jmap/ui.d.ts +13 -0
- package/public/jmap/user.d.ts +96 -0
- package/tsconfig.json +25 -0
- package/tslint.json +86 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
declare interface JRequestConfig {
|
|
2
|
+
/**
|
|
3
|
+
* The url to request.
|
|
4
|
+
*/
|
|
5
|
+
url: string
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Body params, that will be passed in the request.
|
|
9
|
+
*/
|
|
10
|
+
params?: { [key: string]: any } | string
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* For request on JMap servers only.
|
|
14
|
+
*/
|
|
15
|
+
accessToken?: string
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* If true will return the header in the response.
|
|
19
|
+
*/
|
|
20
|
+
includeHeadersInResponse?: boolean
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* If true will ignore the JMap authorization headers.
|
|
24
|
+
*/
|
|
25
|
+
ignoreJMapAuthorizationHeaderParam?: boolean
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* To specify custom headers (Authorization, Content-type, etc) that you might want to use for external ressources.
|
|
29
|
+
*/
|
|
30
|
+
headers?: { [key: string]: any }
|
|
31
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare type JDateLike = number | Date | string
|
|
2
|
+
|
|
3
|
+
// ALL_TIME_UNITS in all-enum.ts
|
|
4
|
+
declare const enum JTIME_UNITS {
|
|
5
|
+
SECONDS = "seconds",
|
|
6
|
+
MINUTES = "minutes",
|
|
7
|
+
HOURS = "hours",
|
|
8
|
+
DAYS = "days",
|
|
9
|
+
WEEKS = "weeks",
|
|
10
|
+
MONTHS = "months",
|
|
11
|
+
YEARS = "years"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare interface JDateFormatParams {
|
|
15
|
+
displayTime?: boolean
|
|
16
|
+
prefix?: string
|
|
17
|
+
}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
declare interface JExtensionEventParams {
|
|
2
|
+
extensionId: string
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
declare interface JExtensionServerOverride {
|
|
6
|
+
/**
|
|
7
|
+
* The extension's override unique identifier.
|
|
8
|
+
*
|
|
9
|
+
* For JMap CLoud, this would be the [[JCoreExtension.jmapCloudExtensionUrn]] property of your extension
|
|
10
|
+
*
|
|
11
|
+
* For JMap Server, this would be the [[JCoreExtension.serverExtensionId]] property of your extension
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
extensionUniqueIdentifier: string
|
|
15
|
+
jsUrl: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare interface JCoreServerExtensionInfo {
|
|
19
|
+
/**
|
|
20
|
+
* The extension server id. The server extension id could be different of the JS version.
|
|
21
|
+
*/
|
|
22
|
+
id: string
|
|
23
|
+
/**
|
|
24
|
+
* The extension server version. The server extension version could be different of the JS version.
|
|
25
|
+
*/
|
|
26
|
+
version: string
|
|
27
|
+
/**
|
|
28
|
+
* The data depends on the extension. Some extensions could have an empty params object.
|
|
29
|
+
*/
|
|
30
|
+
data: any
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare interface JCoreExtensionParams {
|
|
34
|
+
serverInfo?: JCoreServerExtensionInfo
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* We introduce the notion of extension in order to let you adding you own JMap plugin.
|
|
39
|
+
*
|
|
40
|
+
* Your plugin is an object that has to implement this interface.
|
|
41
|
+
*
|
|
42
|
+
* Then you have to register your extension like that :
|
|
43
|
+
*
|
|
44
|
+
* @example ```ts
|
|
45
|
+
* // This a minimal model
|
|
46
|
+
* // You need to provide an id and an initFn function at least
|
|
47
|
+
* // This model is useless, but just for the example
|
|
48
|
+
* JMap.Extension.register({
|
|
49
|
+
* id: "MyExtension", // Unique id
|
|
50
|
+
* initFn: () => {
|
|
51
|
+
* // here you can start your UI component if needed
|
|
52
|
+
* console.log("JMap is started and my extension has been successfuly started")
|
|
53
|
+
* }
|
|
54
|
+
* })
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
declare interface JCoreExtension {
|
|
58
|
+
/**
|
|
59
|
+
* The unique extension identifier
|
|
60
|
+
*/
|
|
61
|
+
id: string
|
|
62
|
+
/**
|
|
63
|
+
* By default an extension is "application" scoped. But you can set the extension as "project" scoped.
|
|
64
|
+
*
|
|
65
|
+
* If an extension is application scoped, it will be loaded one time, and never destroyed.
|
|
66
|
+
*
|
|
67
|
+
* If it's set as project scoped :
|
|
68
|
+
* - The extension will be registered each time a project is activated (= initFn will be called).
|
|
69
|
+
* - When a project is deactivated, the extension function destroyFn is called (if defined), then the
|
|
70
|
+
* extension is unregistered (redux store, service, etc... will be destroyed).
|
|
71
|
+
*/
|
|
72
|
+
isProjectExtension?: boolean
|
|
73
|
+
/**
|
|
74
|
+
* If your extensions is depending on a server extension, you have to set this parameter.
|
|
75
|
+
*
|
|
76
|
+
* This parameter is used to determine if an extension is a backend extension or not, and also used
|
|
77
|
+
* in order to provide the parameter to the extension (initFn params).
|
|
78
|
+
*
|
|
79
|
+
* It should be the same id as the JS extension id, it but could be different.
|
|
80
|
+
*/
|
|
81
|
+
serverExtensionId?: string
|
|
82
|
+
/**
|
|
83
|
+
* If your extensions is available for JMap Cloud, you have to set this parameter.
|
|
84
|
+
*
|
|
85
|
+
* This parameter is used to uniquely identify your extension among all other JMap Cloud extensions.
|
|
86
|
+
*
|
|
87
|
+
* This parameter can be set alongside [[JCoreExtension.serverExtensionId]] if your extension is also available for JMap Server.
|
|
88
|
+
*
|
|
89
|
+
* If set, this parameter ***must*** be a {@link https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)|UUID v4 string}. Each Jmap Cloud extension must have a unique identifier, so you have to make sure that each of your extensions defines a unique `jmapCloudExtensionUrn`.
|
|
90
|
+
*
|
|
91
|
+
* JMap Cloud ***only*** supports [[JCoreExtension.isProjectExtension|Project extensions]]
|
|
92
|
+
*
|
|
93
|
+
*/
|
|
94
|
+
jmapCloudExtensionUrn?: string
|
|
95
|
+
/**
|
|
96
|
+
* If you want you can expose a service.
|
|
97
|
+
*
|
|
98
|
+
* If your extension id is "MyExtension", your service will be accessible like that :
|
|
99
|
+
* ```ts
|
|
100
|
+
* JMap.Extension.MyExtension.doSomething()
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
serviceToExpose?: any
|
|
104
|
+
/**
|
|
105
|
+
* By default :
|
|
106
|
+
* - "application" scoped extensions are initialized (= initFn called) the first time the map is loaded
|
|
107
|
+
* - "project" scoped extensions are initialized after a project has changed and the new map is loaded
|
|
108
|
+
*
|
|
109
|
+
* If you set this parameter to true :
|
|
110
|
+
* - "application" scoped extensions will be initialized as soon the extension is registered
|
|
111
|
+
* - "project" scoped extensions will be initialized as soon the project has changed
|
|
112
|
+
*/
|
|
113
|
+
startBeforeMapIsReady?: boolean
|
|
114
|
+
/**
|
|
115
|
+
* You can provide a translation bundle for your extesion. All translations will be handled by the JMap Cloud NG
|
|
116
|
+
* translation engine. See [[JMap.Language.addBundle]] for more details on bundles
|
|
117
|
+
*/
|
|
118
|
+
translationBundle?: JTranslationBundle
|
|
119
|
+
/**
|
|
120
|
+
* The init function of your extension.
|
|
121
|
+
*
|
|
122
|
+
* Here you can start initialize your extension.
|
|
123
|
+
*
|
|
124
|
+
* By default param is an empty object, but for project server extensions only, a parameter "serverInfo" is passed,
|
|
125
|
+
* fetched from the project configuration that is defined in the admininistration.
|
|
126
|
+
*/
|
|
127
|
+
initFn: (params: JCoreExtensionParams) => void
|
|
128
|
+
/**
|
|
129
|
+
* The destroy function.
|
|
130
|
+
*
|
|
131
|
+
* Only used for "project" scoped extensions (useless for "application" scoped extension).
|
|
132
|
+
*
|
|
133
|
+
* For "project" scoped extensions, when a project will be deactivated, all project's extensions are unregistered.
|
|
134
|
+
*
|
|
135
|
+
* Before unregister those extensions, this function is called.
|
|
136
|
+
*
|
|
137
|
+
* For example, when this function is called you should clean all your event listeners.
|
|
138
|
+
*
|
|
139
|
+
* Don't mind about cleaning the redux state, because it will be destroyed by the register function.
|
|
140
|
+
*
|
|
141
|
+
* Then the redux state will be created again when the next project will be loaded,
|
|
142
|
+
* and the extension will be registered again.
|
|
143
|
+
*/
|
|
144
|
+
destroyFn?: () => void
|
|
145
|
+
/**
|
|
146
|
+
* You can provide your own Redux store reducer : https://redux.js.org/basics/reducers.
|
|
147
|
+
*
|
|
148
|
+
* Like that you can develop UI component that react to the redux state changes.
|
|
149
|
+
*
|
|
150
|
+
* You can get the data store using this function : [[JMap.getDataStore]], and then dispatch
|
|
151
|
+
* your own actions.
|
|
152
|
+
*
|
|
153
|
+
* A redux reducer is a pure JS function that take the current reducer state (can be undefined first time)
|
|
154
|
+
* and an action, and return the new state (the same if no changes has been made for the action).
|
|
155
|
+
*/
|
|
156
|
+
storeReducer?: (currentReducerState: any, action: any) => any
|
|
157
|
+
/**
|
|
158
|
+
* You can provide a renderMouseOver function.
|
|
159
|
+
*
|
|
160
|
+
* If set, this function has to return a [[JExtensionMouseOver]], and it will be displayed
|
|
161
|
+
* at the end of the standard mouseover.
|
|
162
|
+
*
|
|
163
|
+
* @param layer The JMap layer object
|
|
164
|
+
* @param feature The mouseovered feature (having all its properties filled)
|
|
165
|
+
*/
|
|
166
|
+
renderMouseOver?: (layer: JLayer, feature: any) => JExtensionMouseOver | undefined
|
|
167
|
+
/**
|
|
168
|
+
* The registration function.
|
|
169
|
+
*
|
|
170
|
+
* Triggered when this extension has been registered.
|
|
171
|
+
*/
|
|
172
|
+
onRegistrationDone?: () => void
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* An optional handler that returns a Mapbox GL JS RequestParameters object
|
|
176
|
+
*
|
|
177
|
+
* Provide this handler if your extentions needs to add something special in MapBox map requests,
|
|
178
|
+
* like providing credentials, adding headers, etc.
|
|
179
|
+
*
|
|
180
|
+
* Great care must be taken to not blindly modify every request passed to this handler. You should only modify requests known to your extension. This can usually
|
|
181
|
+
* be determined by looking at the url received by the handler.
|
|
182
|
+
*
|
|
183
|
+
* See Mapbox documentation for reference:
|
|
184
|
+
*
|
|
185
|
+
* https://docs.mapbox.com/mapbox-gl-js/api/map/#map-parameters
|
|
186
|
+
*
|
|
187
|
+
* https://docs.mapbox.com/mapbox-gl-js/api/properties/#requestparameters
|
|
188
|
+
*
|
|
189
|
+
* @example ```ts
|
|
190
|
+
* JMap.Extension.register({
|
|
191
|
+
* id: "MyExtension", // Unique id
|
|
192
|
+
* initFn: () => {
|
|
193
|
+
* // here you can start your UI component if needed
|
|
194
|
+
* console.log("JMap is started and my extension has been successfuly started")
|
|
195
|
+
* },
|
|
196
|
+
* injectMapRequestParameters: (url, resourceType) => {
|
|
197
|
+
* if (resourceType === 'Source' && url.indexOf('http://myHost') > -1) {
|
|
198
|
+
* return {
|
|
199
|
+
* url,
|
|
200
|
+
* headers: {'my-custom-header': true},
|
|
201
|
+
* credentials: 'include' // Include cookies for cross-origin requests
|
|
202
|
+
* }
|
|
203
|
+
* }
|
|
204
|
+
* return { url }
|
|
205
|
+
* }
|
|
206
|
+
* })
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
*/
|
|
210
|
+
injectMapRequestParameters?: mapboxgl.TransformRequestFunction
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
declare interface JExtensionMouseOver {
|
|
214
|
+
html: string // static html content
|
|
215
|
+
js?: string // javascript that will be evaluated after html rendered
|
|
216
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare interface JAttributeValueByName {
|
|
2
|
+
[attributeName: string]: any
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
declare interface JFeatureGeometryUpdateParams {
|
|
6
|
+
layerId: JId
|
|
7
|
+
featureId: JId
|
|
8
|
+
geometry: GeoJSON.Geometry
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare interface JFeatureEventGeometryUpdateParams {
|
|
12
|
+
layerId: JId
|
|
13
|
+
updatedFeature: GeoJSON.Feature
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
declare interface JFeatureEventDeleteParams {
|
|
17
|
+
layerId: JId
|
|
18
|
+
deletedFeatures: GeoJSON.Feature[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
declare interface JFeatureDeleteByIdsResult {
|
|
22
|
+
layerId: JId
|
|
23
|
+
inSuccessIds: JId[]
|
|
24
|
+
inErrorIds: JId[]
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
declare interface JFeatureEventCreateParams {
|
|
28
|
+
layerId: JId
|
|
29
|
+
featureId: JId
|
|
30
|
+
featureGeometry: GeoJSON.Geometry
|
|
31
|
+
featureProperties: JAttributeValueByName
|
|
32
|
+
}
|