jmapcloud-types 0.0.1

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/das.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ export interface JAttributeStatistics {
2
+ id: string
3
+ name: string
4
+ uniqueValues?: Array<JUniqueValue>
5
+ average?: number
6
+ standardDeviation?: number
7
+ minimum?: number
8
+ maximum?: number
9
+ }
10
+
11
+ export type JUniqueValue = string | number | null
package/geography.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export type JMAP_SERVER_DISTANCE_UNITS = "MILLIMETER" | "CENTIMETER" | "METER" | "KILOMETER" | "INCH" | "FOOT" | "YARD" | "MILE" | "NAUTICAL_MILE" | "DEGREE_ANGLE"
2
+
3
+ export interface JServerExtent {
4
+ x1: number
5
+ y1: number
6
+ x2: number
7
+ y2: number
8
+ }
package/index.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from "./das"
2
+ export * from "./geography"
3
+ export * from "./language"
4
+ export * from "./mcs"
5
+ export * from "./theme"
6
+
7
+ export {}
package/language.d.ts ADDED
@@ -0,0 +1,65 @@
1
+ export type LOCALES = "fr" | "en" | "es"
2
+
3
+ export type JMultiLocaleTranslationValue = {
4
+ [key in LOCALES]?: string
5
+ }
6
+
7
+ export type LocaleSubscriber = (locale: LOCALES) => void
8
+
9
+ export interface JLanguageService {
10
+ addBundle(bundle: JTranslationBundle): void
11
+ // new methods to implement
12
+ //
13
+ // bundleExitsById(bundleId: string): boolean
14
+ // getBundleById(bundleId: string): JTranslationBundle
15
+ // getAllBundleIds(): string[]
16
+ // getBundles(): JTranslationBundleById
17
+ //
18
+ subscribeToLocaleChange(callback: LocaleSubscriber): () => void
19
+ getLocales(): LOCALES[]
20
+ getLocale(): LOCALES
21
+ getDateFnsLocale(displayTime?: boolean): any
22
+ getDefaultLocale(): LOCALES
23
+ setLocale(locale: LOCALES): void
24
+ translate(params: JTranslateParams): string
25
+ is12HoursTimeFormat(): boolean
26
+ isValidLocale(locale: LOCALES): boolean
27
+ getDateFnsDateFormat(displayTime?: boolean, longFormat?: boolean): string
28
+ compare(a: any, b: any, order?: CompareSortOrder): number
29
+ }
30
+
31
+ declare type CompareSortOrder = "asc" | "desc"
32
+
33
+ declare interface JTranslationItem {
34
+ key: string
35
+ bundleId: string
36
+ }
37
+
38
+ export interface JTranslateParams extends JTranslationItem {
39
+ values?: JTranslateParamValues
40
+ locale?: LOCALES
41
+ }
42
+
43
+ export interface JTranslateParamValues {
44
+ [key: string]: PrimitiveType
45
+ }
46
+
47
+ export type PrimitiveType = string | number | boolean | null | undefined | Date
48
+
49
+ declare interface JTranslationBundle {
50
+ id: string
51
+ translationsByLocale: JTranslationsByLocale
52
+ defaultLocale?: LOCALES
53
+ }
54
+
55
+ declare type JTranslationsByLocale = {
56
+ [key in LOCALES]?: JLocaleTranslation
57
+ }
58
+
59
+ declare interface JLocaleTranslation {
60
+ [key: string]: string
61
+ }
62
+
63
+ declare interface JTranslationBundleById {
64
+ [bundleId: string]: JTranslationBundle
65
+ }
package/mcs.d.ts ADDED
@@ -0,0 +1,814 @@
1
+ import { JMultiLocaleTranslationValue, LOCALES } from "."
2
+ import { JMAP_SERVER_DISTANCE_UNITS, JServerExtent } from "./geography"
3
+ import { JTranslateParamValues } from "./language"
4
+ declare type JLAYER_ELEMENT_TYPES = "POINT" | "LINE" | "POLYGON" | "TEXT" | "IMAGE" | "LABEL" | "ELLIPSE" | "MIXED"
5
+ declare type JLAYER_LAYER_TYPES = "VECTOR" | "RASTER" | "OGC_API_FEATURES" | "WMS" | "WMTS"
6
+ declare type JTYPEFACE = "AVERIA_SANS_LIBRE" | "BARLOW" | "IBM_PLEX_MONO" | "NOTO_SERIF" | "OPEN_SANS" | "ROBOTO"
7
+ export interface JProject extends JCreationInfo {
8
+ id: string
9
+ defaultLanguage: LOCALES
10
+ name: JMultiLocaleTranslationValue
11
+ description: JMultiLocaleTranslationValue
12
+ organizationId: string
13
+ mapCrs: string
14
+ measurementCrs: string
15
+ mapUnit: JMAP_SERVER_DISTANCE_UNITS
16
+ distanceUnit: JMAP_SERVER_DISTANCE_UNITS
17
+ displayUnit: JMAP_SERVER_DISTANCE_UNITS
18
+ initialExtent: JServerExtent | null
19
+ maximumExtent: JServerExtent | null
20
+ backgroundColor: string
21
+ defaultSelectionColor: string
22
+ rotation: number
23
+ tags: JTag[]
24
+ public: boolean
25
+ layerCount: number
26
+ }
27
+
28
+ export type JMapUnit = "MILLIMETER" | "CENTIMETER" | "METER" | "FOOT" | "INCH" | "KILOMETER" | "MILE" | "NAUTICAL_MILE" | "YARD" | "DEGREE"
29
+
30
+ interface JCreationInfo {
31
+ createdBy: string
32
+ creationDate: string
33
+ lastModifiedBy: string
34
+ lastModificationDate: string
35
+ }
36
+
37
+ export type JGeneralizationLevel = "HIGH" | "MEDIUM" | "LOW" | "NONE"
38
+
39
+ export type JElementType = "POINT" | "LINE" | "POLYGON" | "TEXT" | "IMAGE"
40
+
41
+ interface JAttribute {
42
+ id: string
43
+ name: string
44
+ title: JMultiLocaleTranslationValue
45
+ indexed: boolean
46
+ type: JAttributeType
47
+ valueDomain?: JValueDomain
48
+ }
49
+
50
+ export type JValueDomain = JValueDomainEntry[]
51
+ export type JValueDomainEntry =
52
+ | {
53
+ value: string | number
54
+ title: JMultiLocaleTranslationValue
55
+ }
56
+ | {
57
+ nullValue: true
58
+ title: JMultiLocaleTranslationValue
59
+ }
60
+
61
+ interface JMouseOver {
62
+ active: boolean
63
+ text: JMultiLocaleTranslationValue
64
+ preventDuplication: Boolean
65
+ backgroundColor: string
66
+ minimumZoom: number
67
+ maximumZoom: number
68
+ url: string
69
+ }
70
+
71
+ interface JLabel {
72
+ text: JMultiLocaleTranslationValue
73
+ active: boolean
74
+ minimumZoom: number
75
+ maximumZoom: number
76
+ anchor: LabelAnchors
77
+ offset:
78
+ | stringOffset
79
+ | {
80
+ y: number
81
+ x: number
82
+ }
83
+ allowOverlapping: boolean
84
+ rotationAttribute: string | null
85
+ rotationDirection: RotationDirection
86
+ rotationUnit: string
87
+ rotationOrigin: string
88
+ followMapRotation: boolean
89
+ transparency: number
90
+ outlined: boolean
91
+ outlineColor: string
92
+ textSize: number
93
+ referenceZoom?: number
94
+ textColor: string
95
+ textBold: boolean
96
+ textItalic: boolean
97
+ typeface: JTYPEFACE
98
+ backgroundSymbolActive: boolean
99
+ backgroundSymbolData: string
100
+ backgroundSymbolMimeType: string
101
+ backgroundSymbolOffset:
102
+ | stringOffset
103
+ | {
104
+ y: number
105
+ x: number
106
+ }
107
+ frameActive: boolean
108
+ frameFillColor: string
109
+ frameBorderColor: string
110
+ frameTransparency: number
111
+ labelSpacing: number
112
+ }
113
+
114
+ interface JLabelUpdate extends Omit<JLabel, "rotationUnit" | "rotationOrigin" | "backgroundSymbolOffset"> {
115
+ offset: { x: number; y: number }
116
+ }
117
+
118
+ export type RotationDirection = "CW" | "CCW"
119
+
120
+ export type LabelAnchors = "CENTER" | "LEFT" | "RIGHT" | "TOP" | "BOTTOM" | "TOP_LEFT" | "TOP_RIGHT" | "BOTTOM_LEFT" | "BOTTOM_RIGHT"
121
+
122
+ export type stringOffset = `POINT (${number} ${number})`
123
+
124
+ export type JAttributeType = "BIT" | "BOOLEAN" | "SMALLINT" | "INTEGER" | "TINYINT" | "BIGINT" | "DECIMAL" | "FLOAT" | "DOUBLE" | "VARCHAR" | "DATE" | "TIME" | "TIMESTAMP"
125
+
126
+ export type JDBCType = "numeric" | "string" | "datetime" | "boolean" | "object"
127
+
128
+ export type JLayerType = "VECTOR" | "RASTER" | "OGC_API_FEATURES" | "WMS" | "WMTS"
129
+
130
+ export type JLayerOrTable = JLayer | JTable
131
+
132
+ interface JLayer extends JCreationInfo {
133
+ id: string
134
+ organizationId: string
135
+ projectId: string
136
+ name: JMultiLocaleTranslationValue
137
+ description: JMultiLocaleTranslationValue
138
+ spatialDataSourceId: string
139
+ elementType: JElementType
140
+ visible: boolean
141
+ listed: boolean
142
+ maximumZoom: number
143
+ minimumZoom: number
144
+ defaultStyleId: string
145
+ attributes: JAttribute[]
146
+ allowClientSideEditing: boolean
147
+ type: JLayerType
148
+ rotationAttribute?: string
149
+ rotationDirection?: RotationDirection
150
+ labellingConfiguration?: JLabel
151
+ mouseOverConfiguration?: JMouseOver
152
+ generalizationLevel: JGeneralizationLevel
153
+ filter?: string
154
+ baseFilter?: JAnyFilterCondition
155
+ }
156
+
157
+ interface WMSJLayer extends JLayer {
158
+ layers: string[]
159
+ styles: string[]
160
+ imageFormat: string
161
+ type: "WMS"
162
+ }
163
+
164
+ interface WMTSJLayer extends JLayer {
165
+ layer: string
166
+ style: string
167
+ imageFormat: string
168
+ type: "WMTS"
169
+ }
170
+
171
+ interface JTable extends JCreationInfo {
172
+ id: string
173
+ organizationId: string
174
+ projectId: string
175
+ name: JMultiLocaleTranslationValue
176
+ description: JMultiLocaleTranslationValue
177
+ dataSourceId: string
178
+ allowClientSideEditing: boolean
179
+ filter?: string
180
+ listed: boolean
181
+ attributes: JAttribute[]
182
+ baseFilter?: JAnyFilterCondition
183
+ }
184
+
185
+ declare interface JLanguageOptions {
186
+ fr: string
187
+ en: string
188
+ es: string
189
+ }
190
+
191
+ export type JSpatialDataSourceType = "FileDataSource" | "VectorDataSource" | "RasterDataSource" | "ApiFeaturesDataSource" | "WmsWmtsDataSource" | "CustomViewDataSource"
192
+
193
+ export type JTabularDataSourceType = "TabularDataSource"
194
+
195
+ export type JDataSourceType = JSpatialDataSourceType | JTabularDataSourceType
196
+
197
+ export type JStyleType = "POINT" | "LINE" | "POLYGON" | "TEXT" | "IMAGE" | "COMPOUND"
198
+
199
+ export interface JTag {
200
+ id: string
201
+ organizationId: string
202
+ name: string
203
+ }
204
+
205
+ export type JAllStyleDTO = JCompoundStyleDTO | JPolygonStyle | JPointStyleDTO | JLineStyle | JImageStyle
206
+
207
+ export type JAllStyleParams = JCompoundStyleParams | JPolygonStyleParams | JPointStyleParams | JLineStyleParams | JImageStyleParams | JTextAnnotationStyleParams
208
+
209
+ export type JAllStyle = JCompoundStyle | JPolygonStyle | JPointStyle | JLineStyle | JImageStyle | JTextAnnotationStyle
210
+
211
+ export interface JStyleBase {
212
+ id: string
213
+ organizationId: string
214
+ name: string
215
+ description?: string
216
+ transparency: number
217
+ tags: JTag[]
218
+ }
219
+
220
+ export interface JStyleParamsBase {
221
+ id?: string
222
+ organizationId?: string
223
+ name: string
224
+ description?: string
225
+ transparency: number
226
+ tags: string[]
227
+ }
228
+
229
+ export interface JCompoundStyleDTO extends JCreationInfo {
230
+ type: "COMPOUND"
231
+ id: string
232
+ organizationId: string
233
+ name: string
234
+ description: string
235
+ styles: Array<JPointStyleDTO | JLineStyle>
236
+ }
237
+
238
+ export interface JCompoundStyleParams {
239
+ type: "COMPOUND"
240
+ id: string
241
+ organizationId: string
242
+ name: string
243
+ description: string
244
+ styles: string[]
245
+ }
246
+
247
+ export interface JCompoundStyle extends JCreationInfo {
248
+ type: "COMPOUND"
249
+ id: string
250
+ organizationId: string
251
+ name: string
252
+ description: string
253
+ styles: Array<JPointStyle | JLineStyle>
254
+ }
255
+
256
+ interface JTextAnnotationStyle extends JStyleBase, JCreationInfo {
257
+ type: "TEXT"
258
+ bold: boolean
259
+ italic: boolean
260
+ typeface: JTYPEFACE
261
+ textColor: string
262
+ outlineColor: string | undefined
263
+ }
264
+
265
+ interface JTextAnnotationStyleParams extends JStyleParamsBase {
266
+ type: "TEXT"
267
+ bold: boolean
268
+ italic: boolean
269
+ textColor: string
270
+ outlineColor: string | undefined
271
+ tags: string[]
272
+ }
273
+
274
+ interface JPolygonStyle extends JStyleBase, JCreationInfo {
275
+ type: "POLYGON"
276
+ fillColor: string
277
+ borderColor: string
278
+ transparentFill: boolean
279
+ borderThickness: number
280
+ borderTransparency: number
281
+ patternData: string
282
+ borderDashPattern?: number[]
283
+ borderPatternData: string
284
+ }
285
+
286
+ interface JPolygonStyleParams extends JStyleParamsBase {
287
+ type: "POLYGON"
288
+ fillColor: string
289
+ borderColor: string
290
+ transparentFill: boolean
291
+ borderThickness: number
292
+ borderTransparency: number
293
+ patternData: string
294
+ borderDashPattern?: number[]
295
+ borderPatternData: string
296
+ tags: string[]
297
+ }
298
+
299
+ interface JLineStyle extends JStyleBase, JCreationInfo {
300
+ type: "LINE"
301
+ lineThickness: number
302
+ lineColor: string
303
+ arrowType: JArrowType
304
+ arrowPosition: number
305
+ lineCap: JLineCap
306
+ lineJoin: JLineJoin
307
+ lineMiterLimit: number
308
+ lineRoundLimit: number
309
+ dashPattern?: number[]
310
+ patternData: string
311
+ }
312
+
313
+ interface JLineStyleParams extends JStyleParamsBase {
314
+ type: "LINE"
315
+ lineThickness: number
316
+ lineColor: string
317
+ arrowType: JArrowType
318
+ arrowPosition: number
319
+ lineCap: JLineCap
320
+ lineJoin: JLineJoin
321
+ lineMiterLimit: number
322
+ lineRoundLimit: number
323
+ dashPattern?: number[]
324
+ patternData?: string
325
+ tags: string[]
326
+ }
327
+
328
+ interface JPointStyle extends JStyleBase, JCreationInfo {
329
+ type: "POINT"
330
+ size: number
331
+ rotation: number
332
+ rotationLocked: boolean
333
+ proportional: boolean
334
+ proportionalScale: number
335
+ symbolOffset: { x: number; y: number }
336
+ symbolData: string
337
+ symbolMimeType: string
338
+ }
339
+
340
+ interface JPointStyleParams extends JStyleParamsBase {
341
+ type: "POINT"
342
+ size: number
343
+ rotation: number
344
+ rotationLocked: boolean
345
+ proportional: boolean
346
+ proportionalScale: number
347
+ symbolOffset: { x: number; y: number }
348
+ symbolData: string
349
+ symbolMimeType?: string
350
+ tags: string[]
351
+ }
352
+
353
+ interface JPointStyleDTO extends JStyleBase, JCreationInfo {
354
+ type: "POINT"
355
+ size: number
356
+ rotation: number
357
+ rotationLocked: boolean
358
+ proportional: boolean
359
+ proportionalScale: number
360
+ symbolOffset: string
361
+ symbolData: string
362
+ symbolMimeType: string
363
+ }
364
+
365
+ interface JImageStyle extends JStyleBase, JCreationInfo {
366
+ type: "IMAGE"
367
+ transparency: number
368
+ }
369
+
370
+ interface JImageStyleParams extends JStyleParamsBase {
371
+ type: "IMAGE"
372
+ tags: string[]
373
+ }
374
+
375
+ export type JLineJoin = "BEVEL" | "ROUND" | "MITER"
376
+
377
+ export type JArrowType = "NONE" | "FORWARD" | "BACKWARD"
378
+
379
+ export type JLineCap = "BUTT" | "ROUND" | "SQUARE"
380
+
381
+ export type JDataSource = JSpatialDataSource | JTabularDataSource
382
+
383
+ export type JSpatialDataSource = JRasterDataSource | JWmsWmtsDataSource | JFileDataSource | JVectorDataSource | JApiFeaturesDataSource | JCustomViewDataSource
384
+
385
+ interface JDataSourceBase extends JCreationInfo {
386
+ id: string
387
+ organizationId: string
388
+ name: string
389
+ description: string
390
+ status: JStatus
391
+ attributes: JAttribute[]
392
+ tags: JTag[]
393
+ type: JDataSourceType
394
+ additionalInfo?: JDataSourceAdditionalInfo
395
+ }
396
+
397
+ interface JApiFeaturesDataSource extends JDataSourceBase {
398
+ type: "ApiFeaturesDataSource"
399
+ crs: string
400
+ landingPageUrl: string
401
+ collectionId: string
402
+ }
403
+
404
+ interface JRasterDataSource extends JDataSourceBase {
405
+ type: "RasterDataSource"
406
+ crs: string
407
+ fileIds: string[]
408
+ rasterInfo: any
409
+ }
410
+
411
+ interface JWmsWmtsDataSource extends JDataSourceBase {
412
+ type: "WmsWmtsDataSource"
413
+ crs: string
414
+ capabilitiesUrl: string
415
+ }
416
+
417
+ interface JFileDataSource extends JDataSourceBase {
418
+ type: "FileDataSource"
419
+ crs: string
420
+ linkAttribute?: JAttribute
421
+ }
422
+
423
+ interface JCustomViewDataSource extends JDataSourceBase {
424
+ type: "CustomViewDataSource"
425
+ crs: string
426
+ linkAttribute?: JAttribute
427
+ }
428
+
429
+ interface JVectorDataSource extends JDataSourceBase {
430
+ type: "VectorDataSource"
431
+ crs: string
432
+ linkAttribute?: JAttribute
433
+ }
434
+
435
+ interface JTabularDataSource extends JDataSourceBase {
436
+ type: "TabularDataSource"
437
+ linkAttribute?: JAttribute
438
+ }
439
+
440
+ export interface JDataSourceAdditionalInfo {
441
+ featureCount?: number
442
+ references?: JDataSourceReference
443
+ geometryTypes?: JGEOMETRY_TYPES[]
444
+ }
445
+
446
+ export interface JDataSourceReference {
447
+ projects: {
448
+ [key: string]: {
449
+ layers: string[]
450
+ tables: string[]
451
+ }
452
+ }
453
+ }
454
+
455
+ export type JGEOMETRY_TYPES = "POINT" | "CURVE" | "SURFACE" | "ANNOTATION" | "COMPLEX" | "NONE"
456
+
457
+ export type JStatus = "NOT_READY" | "READY" | "ERROR" | "UPDATING"
458
+
459
+ interface JStyleRule extends JCreationInfo {
460
+ id: string
461
+ name: JMultiLocaleTranslationValue
462
+ active: boolean
463
+ defaultRule: boolean
464
+ conditions: JRuleCondition[]
465
+ }
466
+
467
+ interface JRuleCondition {
468
+ id: string
469
+ name: JMultiLocaleTranslationValue
470
+ conditionExpressions: JConditionExpression[]
471
+ styleMapScales: JStyleMapScale[]
472
+ }
473
+
474
+ interface JConditionExpression {
475
+ id: string
476
+ attribute: JAttribute
477
+ operator: JLogicalOperator
478
+ value: any
479
+ }
480
+
481
+ export type JLogicalOperator = "EMPTY" | "NOT_EMPTY" | "IS_NULL" | "IS_NOT_NULL" | "EQUALS" | "NOT_EQUALS" | "GREATER_THAN" | "GREATER_OR_EQUALS_TO" | "LOWER_THAN" | "LOWER_OR_EQUALS_TO"
482
+
483
+ interface JStyleMapScale {
484
+ id: string
485
+ minimumZoom: number
486
+ maximumZoom: number
487
+ styleId: string
488
+ }
489
+
490
+ export type JCardinality = "ONE_TO_ONE" | "ONE_TO_MANY"
491
+
492
+ declare interface JExtent {
493
+ x1: number
494
+ y1: number
495
+ x2: number
496
+ y2: number
497
+ }
498
+ declare interface JRelationshipParams {
499
+ referencedAttributeName: string
500
+ referencingDataSourceId: string
501
+ referencingAttributeName: string
502
+ cardinality: JCardinality
503
+ referencingPrefix: string
504
+ referencingAttributes?: string[]
505
+ }
506
+
507
+ declare interface JRelationship {
508
+ id: string
509
+ referencedDataSourceId: string
510
+ referencedAttributeName: string
511
+ referencingDataSourceId: string
512
+ referencingAttributeName: string
513
+ cardinality: JCardinality
514
+ referencingPrefix: string
515
+ referencingAttributes?: JAttribute[]
516
+ }
517
+
518
+ /**
519
+ *
520
+ * Forms
521
+ *
522
+ */
523
+
524
+ export type FormComponentKeys = "Label" | "Text" | "Number" | "Boolean" | "Date" | "List" | "Column" | "Row" | "Group" | "Tabs" | "Tab" | "Space" | "Attachment"
525
+
526
+ export interface FormSchema {
527
+ type: "object"
528
+ properties: {
529
+ [key: string]: FormSchemaProperty
530
+ }
531
+ required: string[]
532
+ }
533
+
534
+ export interface FormSchemaProperty {
535
+ type: FORMSCHEMA_TYPES | FORMSCHEMA_TYPES[]
536
+ format?: string
537
+ title?: string
538
+ default?: any
539
+ minimum?: number
540
+ maximum?: number
541
+ oneOf?: Array<{ const: string | number | null; title?: string }>
542
+ }
543
+
544
+ export interface JDragPosition {
545
+ overNode: FormNode | null
546
+ index: number
547
+ }
548
+
549
+ interface FormNodeBase {
550
+ type: string
551
+ designComponent: FormComponentKeys
552
+ id: string
553
+ }
554
+
555
+ export interface FormNodeControl extends FormNodeBase {
556
+ type: "Control"
557
+ title?: string
558
+ scope: string
559
+ options: {
560
+ readonly: boolean
561
+ }
562
+ }
563
+
564
+ export interface FormNodeAttachment extends FormNodeBase {
565
+ designComponent: "Attachment"
566
+ type: "Attachment"
567
+ title?: string
568
+ }
569
+
570
+ export interface FormNodeLabel extends FormNodeBase {
571
+ designComponent: "Label"
572
+ type: "Label"
573
+ text?: string
574
+ }
575
+
576
+ export interface FormNodeText extends FormNodeControl {
577
+ designComponent: "Text"
578
+ options: FormNodeControl["options"] & {
579
+ multi: boolean
580
+ }
581
+ }
582
+ export interface FormNodeNumber extends FormNodeControl {
583
+ designComponent: "Number"
584
+ options: FormNodeControl["options"] & {
585
+ slider: boolean
586
+ }
587
+ }
588
+ export interface FormNodeBoolean extends FormNodeControl {
589
+ designComponent: "Boolean"
590
+ options: FormNodeControl["options"] & {
591
+ toggle: boolean
592
+ asBoolean: boolean
593
+ checkedValue: string | number | null
594
+ uncheckedValue: string | number | null
595
+ }
596
+ }
597
+ export interface FormNodeDate extends FormNodeControl {
598
+ designComponent: "Date"
599
+ }
600
+ export interface FormNodeList extends FormNodeControl {
601
+ designComponent: "List"
602
+ options: FormNodeControl["options"] & {
603
+ format?: string
604
+ }
605
+ }
606
+
607
+ export interface FormNodeLayout extends FormNodeBase {
608
+ type: string
609
+ elements: FormNode[]
610
+ }
611
+
612
+ export interface FormNodeVertical extends FormNodeLayout {
613
+ type: "VerticalLayout"
614
+ designComponent: "Column"
615
+ isRoot?: boolean
616
+ translations?: JFormTranslations
617
+ }
618
+
619
+ export type JFormTranslations = {
620
+ [L in LOCALES]: Record<string, string>
621
+ }
622
+
623
+ export interface FormNodeHorizontal extends FormNodeLayout {
624
+ type: "HorizontalLayout"
625
+ designComponent: "Row"
626
+ }
627
+ export interface FormNodeGroup extends FormNodeLayout {
628
+ type: "Group"
629
+ designComponent: "Group"
630
+ label?: string
631
+ }
632
+
633
+ export interface FormNodeTabs extends FormNodeLayout {
634
+ type: "Categorization"
635
+ designComponent: "Tabs"
636
+ }
637
+
638
+ export interface FormNodeTab extends FormNodeLayout {
639
+ type: "Category"
640
+ designComponent: "Tab"
641
+ label?: string
642
+ }
643
+
644
+ export interface FormNodeSpace extends FormNodeLayout {
645
+ type: "Space"
646
+ designComponent: "Space"
647
+ }
648
+
649
+ export type FormNodesControl = FormNodeText | FormNodeNumber | FormNodeBoolean | FormNodeDate | FormNodeList
650
+ export type FormNodesLayout = FormNodeVertical | FormNodeHorizontal | FormNodeGroup | FormNodeTabs | FormNodeTab | FormNodeSpace
651
+
652
+ export type FormNode = FormNodesControl | FormNodesLayout | FormNodeLabel | FormNodeAttachment
653
+
654
+ export interface JForm extends JCreationInfo {
655
+ id: string
656
+ name: JTranslateParamValues
657
+ organizationId: string
658
+ uiSchema: FormNodeVertical
659
+ formSchema: FormSchema
660
+ tags: JTag[]
661
+ dataSourceId: string
662
+ }
663
+
664
+ /**
665
+ *
666
+
667
+ *
668
+ */
669
+
670
+ export type FORMSCHEMA_TYPES = "string" | "integer" | "number" | "boolean" | "array" | "null"
671
+ /**
672
+ *
673
+ * Base filters
674
+ *
675
+ */
676
+
677
+ // -----------------------------------------------------------------------------
678
+ // Operators
679
+ // -----------------------------------------------------------------------------
680
+ // "or" not supported for now
681
+ export type JBaseFilterConditionOperator = "and" | "not" | "=" | "in" | ">" | ">=" | "<" | "<=" | "isNull" | "between" | "like" | "contains" | "startsWith" | "endsWith" // | "pattern" /* "pattern" not supported yet */
682
+
683
+ // Helper to strictly enforce allowed operators
684
+ type RequireOperator<Op extends string> = Op extends JBaseFilterConditionOperator ? Op : never
685
+
686
+ // -----------------------------------------------------------------------------
687
+ // Properties
688
+ // -----------------------------------------------------------------------------
689
+ export interface JBaseFilterConditionProperty {
690
+ property: string
691
+ }
692
+
693
+ export type FilterValue = string | number | boolean | null
694
+
695
+ // -----------------------------------------------------------------------------
696
+ // Argument shapes
697
+ // -----------------------------------------------------------------------------
698
+ export type JBaseFilterConditionSingleValueArgument = [JBaseFilterConditionProperty, FilterValue]
699
+
700
+ export type JBaseFilterConditionTwoValuesArgument = [JBaseFilterConditionProperty, FilterValue, FilterValue]
701
+
702
+ export type JBaseFilterConditionMultipleValuesArgument = [JBaseFilterConditionProperty, FilterValue[] | null]
703
+
704
+ export type JBaseFilterConditionNoValueArgument = [JBaseFilterConditionProperty]
705
+
706
+ // -----------------------------------------------------------------------------
707
+ // Base filter
708
+ // -----------------------------------------------------------------------------
709
+ export interface JBaseFilterConditionBase<Op extends JBaseFilterConditionOperator, Args> {
710
+ id: string
711
+ op: RequireOperator<Op> // strict enforcement
712
+ args: Args
713
+ }
714
+
715
+ // -----------------------------------------------------------------------------
716
+ // No value filters
717
+ // -----------------------------------------------------------------------------
718
+ export type JBaseFilterConditionIsNull = JBaseFilterConditionBase<"isNull", JBaseFilterConditionNoValueArgument>
719
+
720
+ // -----------------------------------------------------------------------------
721
+ // Single value filters
722
+ // -----------------------------------------------------------------------------
723
+ export type JBaseFilterConditionEquals = JBaseFilterConditionBase<"=", JBaseFilterConditionSingleValueArgument>
724
+ export type JBaseFilterConditionGreater = JBaseFilterConditionBase<">", JBaseFilterConditionSingleValueArgument>
725
+ export type JBaseFilterConditionGreaterOrEqual = JBaseFilterConditionBase<">=", JBaseFilterConditionSingleValueArgument>
726
+ export type JBaseFilterConditionSmaller = JBaseFilterConditionBase<"<", JBaseFilterConditionSingleValueArgument>
727
+ export type JBaseFilterConditionSmallerOrEqual = JBaseFilterConditionBase<"<=", JBaseFilterConditionSingleValueArgument>
728
+ export type JBaseFilterConditionLike = JBaseFilterConditionBase<"like", JBaseFilterConditionSingleValueArgument>
729
+ export type JBaseFilterConditionContains = JBaseFilterConditionBase<"contains", JBaseFilterConditionSingleValueArgument>
730
+ export type JBaseFilterConditionStartsWith = JBaseFilterConditionBase<"startsWith", JBaseFilterConditionSingleValueArgument>
731
+ export type JBaseFilterConditionEndsWith = JBaseFilterConditionBase<"endsWith", JBaseFilterConditionSingleValueArgument>
732
+
733
+ // -----------------------------------------------------------------------------
734
+ // Two values filters
735
+ // -----------------------------------------------------------------------------
736
+ export type JBaseFilterConditionBetween = JBaseFilterConditionBase<"between", JBaseFilterConditionTwoValuesArgument>
737
+
738
+ // -----------------------------------------------------------------------------
739
+ // Multiple values filters
740
+ // -----------------------------------------------------------------------------
741
+ export type JBaseFilterConditionIn = JBaseFilterConditionBase<"in", JBaseFilterConditionMultipleValuesArgument>
742
+
743
+ // -----------------------------------------------------------------------------
744
+ // Logical / grouping filters
745
+ // -----------------------------------------------------------------------------
746
+ export type JBaseFilterConditionAnd = JBaseFilterConditionBase<RequireOperator<"and">, JAnyFilterCondition[]>
747
+ export type JBaseFilterConditionNot = JBaseFilterConditionBase<RequireOperator<"not">, [JAnyFilterCondition]>
748
+
749
+ // ❌ Unsupported condition for now
750
+ // export type JBaseFilterConditionOr = JBaseFilterConditionBase<RequireOperator<"or">, JAnyFilterCondition[]>
751
+
752
+ // -----------------------------------------------------------------------------
753
+ // Discriminated union of all filter conditions
754
+ // -----------------------------------------------------------------------------
755
+ export type JAnyFilterCondition =
756
+ | JBaseFilterConditionIsNull
757
+ | JBaseFilterConditionEquals
758
+ | JBaseFilterConditionGreater
759
+ | JBaseFilterConditionGreaterOrEqual
760
+ | JBaseFilterConditionSmaller
761
+ | JBaseFilterConditionSmallerOrEqual
762
+ | JBaseFilterConditionLike
763
+ | JBaseFilterConditionContains
764
+ | JBaseFilterConditionStartsWith
765
+ | JBaseFilterConditionEndsWith
766
+ | JBaseFilterConditionBetween
767
+ | JBaseFilterConditionIn
768
+ | JBaseFilterConditionAnd
769
+ | JBaseFilterConditionNot
770
+
771
+ // -----------------------------------------------------------------------------
772
+ // Filter composition
773
+ // -----------------------------------------------------------------------------
774
+ export type JNotComposition<TChild> = JBaseFilterConditionNot & {
775
+ args: [TChild]
776
+ }
777
+ // IS NOT NULL
778
+ export type JNotIsNullComposition = JNotComposition<JBaseFilterConditionIsNull>
779
+ // NOT EQUALS
780
+ export type JNotEqualsComposition = JNotComposition<JBaseFilterConditionEquals>
781
+ // NOT IN
782
+ export type JNotInComposition = JNotComposition<JBaseFilterConditionIn>
783
+ // NOT BETWEEN
784
+ export type JNotBetweenComposition = JNotComposition<JBaseFilterConditionBetween>
785
+ // NOT LIKE
786
+ export type JNotLikeComposition = JNotComposition<JBaseFilterConditionLike>
787
+ // NOT CONTAINS
788
+ export type JNotContainsComposition = JNotComposition<JBaseFilterConditionContains>
789
+ // NOT STARTS WITH
790
+ export type JNotStartsWithComposition = JNotComposition<JBaseFilterConditionStartsWith>
791
+ // NOT ENDS WITH
792
+ export type JNotEndsWithComposition = JNotComposition<JBaseFilterConditionEndsWith>
793
+
794
+ // -----------------------------------------------------------------------------
795
+ // Dynamic filter
796
+ // -----------------------------------------------------------------------------
797
+
798
+ export type JDynamicFilterType = "layer" | "table"
799
+
800
+ export interface JDynamicFilterParams {
801
+ id: string
802
+ active: boolean
803
+ name: JMultiLocaleTranslationValue
804
+ filter: JAnyFilterCondition
805
+ }
806
+
807
+ export interface JDynamicFilterBase<Type extends JDynamicFilterType = JDynamicFilterType> extends JDynamicFilterParams {
808
+ type: Type
809
+ }
810
+
811
+ export type JLayerDynamicFilter = JDynamicFilterBase<"layer">
812
+ export type JTableDynamicFilter = JDynamicFilterBase<"table">
813
+
814
+ export type JAnyDynamicFilter = JLayerDynamicFilter | JTableDynamicFilter
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "jmapcloud-types",
3
+ "version": "0.0.1",
4
+ "description": "TypeScript definitions for Jmap Cloud",
5
+ "license": "MIT",
6
+ "main": "",
7
+ "types": "index.d.ts",
8
+ "scripts": {},
9
+ "dependencies": {}
10
+ }
package/theme.ts ADDED
@@ -0,0 +1,21 @@
1
+ import type { PaletteMode, Theme } from "@mui/material/styles"
2
+ import { LOCALES } from "./language"
3
+
4
+ export type ThemeSubscriber = (theme: Theme) => void
5
+ export type JPaletteMode = PaletteMode | "default"
6
+ export type JThemeType = "portal" | "ng"
7
+
8
+ export type JSetThemeParams = {
9
+ locale: LOCALES
10
+ mode: JPaletteMode
11
+ type: JThemeType
12
+ }
13
+
14
+ export interface JThemeService {
15
+ setCurrentThemeDarkActive(isDarkThemeActive: boolean, locale: LOCALES): void
16
+ setCurrentTheme(params: JSetThemeParams): void
17
+ getThemeImplementation(params: JSetThemeParams): Theme
18
+ isCurrentThemeDark(): boolean
19
+ getCurrentTheme(): Theme
20
+ subscribeToThemeChange(callback: ThemeSubscriber): () => void
21
+ }