@arcgis/coding-components 4.29.0-beta.11 → 4.29.0-beta.111
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/LICENSE.md +1 -1
- package/README.md +6 -2
- package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +6 -1
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ar.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.bg.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.bs.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ca.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.cs.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.da.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.de.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.el.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.en.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.es.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.et.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.fi.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.fr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.he.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.hr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.hu.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.id.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.it.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ja.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ko.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.lt.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.lv.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.nb.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.nl.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.pl.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.pt-BR.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.pt-PT.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ro.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ru.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.sk.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.sl.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.sr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.sv.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.th.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.tr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.uk.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.vi.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.zh-CN.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.zh-HK.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.zh-TW.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ar.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.bg.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.bs.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ca.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.cs.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.da.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.de.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.el.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.en.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.es.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.et.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.fi.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.fr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.he.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.hr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.hu.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.id.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.it.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ja.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ko.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.lt.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.lv.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.nb.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.nl.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.pl.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.pt-BR.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.pt-PT.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ro.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ru.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.sk.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.sl.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.sr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.sv.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.th.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.tr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.uk.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.vi.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.zh-CN.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.zh-HK.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.zh-TW.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ar.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bg.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bs.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ca.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.cs.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.da.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.de.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.el.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.en.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.es.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.et.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fi.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fr.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.he.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hr.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hu.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.id.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.it.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ja.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ko.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lt.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lv.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nb.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nl.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pl.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-BR.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-PT.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ro.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ru.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sk.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sl.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sr.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sv.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.th.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.tr.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.uk.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.vi.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-CN.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-HK.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-TW.json +492 -27
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ar.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bg.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bs.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ca.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.cs.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.da.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.de.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.el.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.en.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.es.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.et.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fi.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fr.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.he.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hr.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hu.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.id.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.it.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ja.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ko.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lt.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lv.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nb.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nl.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pl.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-BR.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-PT.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ro.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ru.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sk.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sl.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sr.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sv.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.th.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.tr.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.uk.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.vi.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-CN.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-HK.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-TW.json +14 -2
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ar.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.bg.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.bs.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ca.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.cs.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.da.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.de.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.el.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.en.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.es.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.et.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.fi.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.fr.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.he.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.hr.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.hu.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.id.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.it.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ja.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ko.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.lt.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.lv.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.nb.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.nl.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.pl.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.pt-BR.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.pt-PT.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ro.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ru.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.sk.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.sl.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.sr.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.sv.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.th.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.tr.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.uk.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.vi.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.zh-CN.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.zh-HK.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.zh-TW.json +13 -13
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ar.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.bg.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.bs.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ca.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.cs.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.da.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.de.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.el.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.en.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.es.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.et.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.fi.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.fr.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.he.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.hr.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.hu.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.id.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.it.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ja.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ko.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.lt.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.lv.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.nb.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.nl.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.pl.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.pt-BR.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.pt-PT.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ro.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ru.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.sk.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.sl.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.sr.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.sv.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.th.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.tr.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.uk.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.vi.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.zh-CN.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.zh-HK.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.zh-TW.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ar.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.bg.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.bs.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ca.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.cs.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.da.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.de.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.el.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.en.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.es.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.et.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.fi.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.fr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.he.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.hr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.hu.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.id.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.it.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ja.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ko.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.lt.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.lv.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.nb.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.nl.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.pl.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.pt-BR.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.pt-PT.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ro.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ru.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.sk.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.sl.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.sr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.sv.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.th.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.tr.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.uk.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.vi.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.zh-CN.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.zh-HK.json +8 -8
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.zh-TW.json +8 -8
- package/dist/arcgis-coding-components/assets/code-editor/arcade.worker.js +30 -31
- package/dist/arcgis-coding-components/assets/code-editor/css.worker.js +30 -34
- package/dist/arcgis-coding-components/assets/code-editor/editor.worker.js +7 -8
- package/dist/arcgis-coding-components/assets/code-editor/html.worker.js +18 -20
- package/dist/arcgis-coding-components/assets/code-editor/json.worker.js +21 -22
- package/dist/arcgis-coding-components/assets/code-editor/ts.worker.js +79 -80
- package/dist/arcgis-coding-components/index.esm.js +6 -1
- package/dist/arcgis-coding-components/p-048612c6.js +7 -0
- package/dist/arcgis-coding-components/p-1d4f926f.js +6 -0
- package/dist/arcgis-coding-components/{p-443fe20e.js → p-4344b240.js} +7 -2
- package/dist/arcgis-coding-components/{p-9a164b63.js → p-43b95b3a.js} +8 -3
- package/dist/arcgis-coding-components/{p-cfff9500.js → p-5ca96f1c.js} +6 -1
- package/dist/arcgis-coding-components/{p-9dd33d3e.js → p-6f61a758.js} +7 -2
- package/dist/arcgis-coding-components/p-9c1279fa.js +68 -0
- package/dist/arcgis-coding-components/p-be21051e.entry.js +6 -0
- package/dist/arcgis-coding-components/{p-ff06e912.js → p-daef9c50.js} +7 -2
- package/dist/arcgis-coding-components/{p-b83db734.js → p-dfb57db2.js} +7 -2
- package/dist/arcgis-coding-components/{p-b3500466.js → p-e5c84ef0.js} +7 -2
- package/dist/arcgis-coding-components/{p-310f0408.js → p-e625cdc1.js} +7 -2
- package/dist/cjs/{arcade-defaults-e128d6d9.js → arcade-defaults-4a4ff48e.js} +13204 -11292
- package/dist/cjs/arcade-mode-e8a048dc.js +604 -0
- package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +1484 -1408
- package/dist/cjs/arcgis-coding-components.cjs.js +8 -3
- package/dist/cjs/{css-7229b372.js → css-66caa3cb.js} +6 -1
- package/dist/cjs/{cssMode-8c1d563a.js → cssMode-82651023.js} +8 -3
- package/dist/cjs/{html-ead03bbb.js → html-2c47fd86.js} +8 -3
- package/dist/cjs/{htmlMode-5e1a0115.js → htmlMode-9582a9b2.js} +8 -3
- package/dist/cjs/{index-f8a85eb8.js → index-7156ebfa.js} +395 -101
- package/dist/cjs/index.cjs.js +7 -2
- package/dist/cjs/{javascript-3fe2de06.js → javascript-f35b0dc5.js} +9 -4
- package/dist/cjs/{jsonMode-8b4b19f9.js → jsonMode-632b6048.js} +8 -3
- package/dist/cjs/loader.cjs.js +8 -12
- package/dist/cjs/{tsMode-b9491227.js → tsMode-c6f1ab1f.js} +8 -3
- package/dist/cjs/{typescript-524fddbc.js → typescript-9e1f35cb.js} +8 -3
- package/dist/components/arcade-api.js +170 -162
- package/dist/components/arcade-contribution.js +75 -65
- package/dist/components/arcade-defaults.js +1425 -1270
- package/dist/components/arcade-mode.js +521 -515
- package/dist/components/arcade-results.js +479 -426
- package/dist/components/arcade-suggestions.js +138 -131
- package/dist/components/arcade-variables.js +167 -153
- package/dist/components/arcgis-arcade-api.d.ts +2 -2
- package/dist/components/arcgis-arcade-api.js +5 -0
- package/dist/components/arcgis-arcade-editor.d.ts +2 -2
- package/dist/components/arcgis-arcade-editor.js +413 -387
- package/dist/components/arcgis-arcade-results.d.ts +2 -2
- package/dist/components/arcgis-arcade-results.js +5 -0
- package/dist/components/arcgis-arcade-suggestions.d.ts +2 -2
- package/dist/components/arcgis-arcade-suggestions.js +5 -0
- package/dist/components/arcgis-arcade-variables.d.ts +2 -2
- package/dist/components/arcgis-arcade-variables.js +5 -0
- package/dist/components/arcgis-code-editor.d.ts +2 -2
- package/dist/components/arcgis-code-editor.js +5 -0
- package/dist/components/code-editor.js +255 -250
- package/dist/components/fields.js +104 -77
- package/dist/components/functional-components.js +6 -1
- package/dist/components/index.d.ts +5 -8
- package/dist/components/index.js +6 -7
- package/dist/components/index2.js +7 -2
- package/dist/components/markdown.js +33 -28
- package/dist/components/utilities.js +26 -21
- package/dist/esm/{arcade-defaults-a34c2e51.js → arcade-defaults-0f350eac.js} +13196 -11284
- package/dist/esm/arcade-mode-e87281c6.js +600 -0
- package/dist/esm/arcgis-arcade-api_6.entry.js +1484 -1408
- package/dist/esm/arcgis-coding-components.js +9 -4
- package/dist/esm/{css-ff1e9f8c.js → css-368560db.js} +6 -1
- package/dist/esm/{cssMode-cb48c437.js → cssMode-9c59d807.js} +8 -3
- package/dist/esm/{html-e7c0bd60.js → html-1ffd663e.js} +8 -3
- package/dist/esm/{htmlMode-46638b7f.js → htmlMode-341ef75a.js} +8 -3
- package/dist/esm/{index-d4ec142a.js → index-585dc89e.js} +395 -101
- package/dist/esm/index.js +7 -2
- package/dist/esm/{javascript-2229cd63.js → javascript-91416769.js} +9 -4
- package/dist/esm/{jsonMode-08a2f0d2.js → jsonMode-ccf7e27b.js} +8 -3
- package/dist/esm/loader.js +8 -12
- package/dist/esm/{tsMode-46d0d8e8.js → tsMode-45a0fdf5.js} +8 -3
- package/dist/esm/{typescript-88a09694.js → typescript-7ab173c1.js} +8 -3
- package/dist/loader/cdn.js +5 -1
- package/dist/loader/index.cjs.js +5 -1
- package/dist/loader/index.d.ts +2 -2
- package/dist/loader/index.es2017.js +5 -1
- package/dist/loader/index.js +5 -1
- package/dist/types/components/arcade-api/arcade-api.d.ts +42 -41
- package/dist/types/components/arcade-api/t9n-types.d.ts +6 -6
- package/dist/types/components/arcade-editor/arcade-editor.d.ts +129 -133
- package/dist/types/components/arcade-editor/t9n-types.d.ts +6 -6
- package/dist/types/components/arcade-results/arcade-results.d.ts +46 -50
- package/dist/types/components/arcade-results/t9n-types.d.ts +11 -11
- package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +37 -36
- package/dist/types/components/arcade-suggestions/t9n-types.d.ts +4 -4
- package/dist/types/components/arcade-variables/arcade-variables.d.ts +42 -42
- package/dist/types/components/arcade-variables/t9n-types.d.ts +6 -6
- package/dist/types/components/code-editor/code-editor.d.ts +74 -74
- package/dist/types/components.d.ts +87 -12
- package/dist/types/index.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +61 -17
- package/dist/types/utils/arcade-executor.d.ts +89 -81
- package/dist/types/utils/arcade-monaco/arcade-contribution.d.ts +1 -1
- package/dist/types/utils/arcade-monaco/arcade-defaults.d.ts +69 -68
- package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +27 -26
- package/dist/types/utils/arcade-monaco/arcade-mode.d.ts +10 -10
- package/dist/types/utils/arcade-monaco/arcade-theme.d.ts +9 -8
- package/dist/types/utils/arcade-monaco/arcade-worker-manager.d.ts +11 -11
- package/dist/types/utils/arcade-monaco/arcade.worker.d.ts +16 -14
- package/dist/types/utils/arcade-monaco/types.d.ts +31 -33
- package/dist/types/utils/colorize.d.ts +1 -1
- package/dist/types/utils/editor-suggestions.d.ts +24 -24
- package/dist/types/utils/fields.d.ts +1 -0
- package/dist/types/utils/functional-components.d.ts +2 -2
- package/dist/types/utils/markdown.d.ts +1 -1
- package/dist/types/utils/profile/editor-profile.d.ts +187 -196
- package/dist/types/utils/profile/types.d.ts +230 -109
- package/dist/types/utils/profile/utils.d.ts +31 -14
- package/dist/types/utils/utilities.d.ts +2 -2
- package/package.json +26 -42
- package/dist/arcgis-coding-components/p-0fa0a06d.js +0 -2
- package/dist/arcgis-coding-components/p-1b0246cd.entry.js +0 -1
- package/dist/arcgis-coding-components/p-236ce4a1.js +0 -62
- package/dist/arcgis-coding-components/p-3664ab2a.js +0 -1
- package/dist/cjs/arcade-mode-8bf7a14b.js +0 -598
- package/dist/esm/arcade-mode-c5a69066.js +0 -594
- package/dist/esm/polyfills/css-shim.js +0 -1
|
@@ -1,403 +1,394 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
* See https://js.arcgis.com/4.29/esri/copyright.txt for details.
|
|
4
|
+
* v4.29.0-beta.111
|
|
5
|
+
*/
|
|
1
6
|
import { Emitter, Uri } from 'monaco-editor';
|
|
2
|
-
import {
|
|
3
|
-
import { i as
|
|
7
|
+
import { InsertTextMode, InsertTextFormat, CompletionItemKind } from 'vscode-languageserver-types';
|
|
8
|
+
import { i as importLayersFeatureLayer, a as importRequest, s as supportedFields, n as newPortalPortalItem, b as newWebScene, c as newWebMap, f as fieldAlias, d as fieldTypeToIconName, e as fieldTypeToArcadeType } from './fields.js';
|
|
4
9
|
import { p as portalItemPageUrl } from './utilities.js';
|
|
5
|
-
import {
|
|
10
|
+
import { Y, e as ee, Z, K, E, N } from './index2.js';
|
|
6
11
|
import { getAssetPath } from '@stencil/core/internal/client';
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
const PortalItem = await importPortalPortalItem();
|
|
10
|
-
return new PortalItem(definition);
|
|
11
|
-
}
|
|
13
|
+
//#region core adapter fix
|
|
12
14
|
async function newFeatureLayer(definition) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
async function newWebMap(definition) {
|
|
18
|
-
const WebMap = await importWebMap();
|
|
19
|
-
return new WebMap(definition);
|
|
15
|
+
const FeatureLayer = await importLayersFeatureLayer();
|
|
16
|
+
// Fix title for the layer. Instead of defaulting to the map viewer style.
|
|
17
|
+
return new FeatureLayer({ ...definition, sublayerTitleMode: "service-name" });
|
|
20
18
|
}
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region Type Guards
|
|
21
21
|
function isSupportedLayerInstance(item) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
return (!!item &&
|
|
23
|
+
typeof item === "object" &&
|
|
24
|
+
"declaredClass" in item &&
|
|
25
|
+
typeof item.declaredClass === "string" &&
|
|
26
|
+
item.declaredClass.startsWith("esri.layers."));
|
|
26
27
|
}
|
|
27
28
|
function isFeatureSetInstance(item) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
return (!!item &&
|
|
30
|
+
typeof item === "object" &&
|
|
31
|
+
"declaredClass" in item &&
|
|
32
|
+
typeof item.declaredClass === "string" &&
|
|
33
|
+
item.declaredClass === "esri.rest.support.FeatureSet");
|
|
34
|
+
}
|
|
35
|
+
function isQueryableLayerInstance(item) {
|
|
36
|
+
return (!!item &&
|
|
37
|
+
typeof item === "object" &&
|
|
38
|
+
"declaredClass" in item &&
|
|
39
|
+
typeof item.declaredClass === "string" &&
|
|
40
|
+
item.declaredClass.startsWith("esri.layers.") &&
|
|
41
|
+
"fields" in item &&
|
|
42
|
+
"queryFeatures" in item &&
|
|
43
|
+
typeof item.queryFeatures === "function");
|
|
32
44
|
}
|
|
33
|
-
function
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
function isSubtypeSublayerInstance(item) {
|
|
46
|
+
return (!!item &&
|
|
47
|
+
typeof item === "object" &&
|
|
48
|
+
"declaredClass" in item &&
|
|
49
|
+
typeof item.declaredClass === "string" &&
|
|
50
|
+
item.declaredClass === "esri.layers.support.SubtypeSublayer");
|
|
38
51
|
}
|
|
39
52
|
function isGroupLayerInstance(item) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
53
|
+
return (!!item &&
|
|
54
|
+
typeof item === "object" &&
|
|
55
|
+
"declaredClass" in item &&
|
|
56
|
+
typeof item.declaredClass === "string" &&
|
|
57
|
+
item.declaredClass === "esri.layers.GroupLayer");
|
|
44
58
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
59
|
+
function isMapInstance(item) {
|
|
60
|
+
return (!!item &&
|
|
61
|
+
typeof item === "object" &&
|
|
62
|
+
"declaredClass" in item &&
|
|
63
|
+
typeof item.declaredClass === "string" &&
|
|
64
|
+
(item.declaredClass === "esri.WebMap" || item.declaredClass === "esri.WebScene"));
|
|
47
65
|
}
|
|
48
66
|
function isPortalItemDefinition(item) {
|
|
49
|
-
|
|
67
|
+
return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
|
|
50
68
|
}
|
|
51
69
|
function isFeatureLayerItemDefinition(item) {
|
|
52
|
-
|
|
70
|
+
return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
|
|
53
71
|
}
|
|
54
72
|
function isFieldsDefinition(item) {
|
|
55
|
-
|
|
73
|
+
return (!!item && typeof item === "object" && "fields" in item && Array.isArray(item.fields) && !("declaredClass" in item));
|
|
56
74
|
}
|
|
57
75
|
function isUrlDefinition(item) {
|
|
58
|
-
|
|
76
|
+
return (!!item && typeof item === "object" && "url" in item && typeof item.url === "string" && !("declaredClass" in item));
|
|
77
|
+
}
|
|
78
|
+
function isSubtypeInstance(item) {
|
|
79
|
+
return (!!item &&
|
|
80
|
+
typeof item === "object" &&
|
|
81
|
+
"declaredClass" in item &&
|
|
82
|
+
item.declaredClass === "esri.layers.support.Subtype");
|
|
83
|
+
}
|
|
84
|
+
function isCodedValueDomainInstance(item) {
|
|
85
|
+
return (!!item &&
|
|
86
|
+
typeof item === "object" &&
|
|
87
|
+
"declaredClass" in item &&
|
|
88
|
+
item.declaredClass === "esri.layers.support.CodedValueDomain");
|
|
89
|
+
}
|
|
90
|
+
function isInheritedDomainInstance(item) {
|
|
91
|
+
return (!!item &&
|
|
92
|
+
typeof item === "object" &&
|
|
93
|
+
"declaredClass" in item &&
|
|
94
|
+
item.declaredClass === "esri.layers.support.InheritedDomain");
|
|
59
95
|
}
|
|
60
96
|
function isPredefinedProfile(item) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
97
|
+
return (!!item &&
|
|
98
|
+
typeof item === "object" &&
|
|
99
|
+
"id" in item &&
|
|
100
|
+
typeof item.id === "string" &&
|
|
101
|
+
"definitions" in item &&
|
|
102
|
+
typeof item.definitions === "object" &&
|
|
103
|
+
!Array.isArray(item.definitions));
|
|
66
104
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const pathSegments = path.split(".");
|
|
73
|
-
let pathSegment = pathSegments.shift();
|
|
74
|
-
let entry = dictionary;
|
|
75
|
-
while (entry && pathSegment) {
|
|
76
|
-
// @ts-expect-error
|
|
77
|
-
entry = entry[pathSegment];
|
|
78
|
-
pathSegment = pathSegments.shift();
|
|
79
|
-
}
|
|
80
|
-
return typeof entry === "string" ? entry : path;
|
|
105
|
+
function isTitleCapableSource(item) {
|
|
106
|
+
return !!item && typeof item === "object" && "title" in item && typeof item.title === "string";
|
|
107
|
+
}
|
|
108
|
+
function isUrlCapableSource(item) {
|
|
109
|
+
return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
|
|
81
110
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
111
|
+
function isLayerIdCapableSource(item) {
|
|
112
|
+
return !!item && typeof item === "object" && "layerId" in item && typeof item.layerId === "number";
|
|
113
|
+
}
|
|
114
|
+
function isFeatureTypesCapableLayer(item) {
|
|
115
|
+
return !!item && typeof item === "object" && "typeIdField" in item && "types" in item;
|
|
84
116
|
}
|
|
85
117
|
function isDomainsCapableLayer(item) {
|
|
86
|
-
|
|
118
|
+
return !!item && typeof item === "object" && "getFieldDomain" in item && typeof item.getFieldDomain === "function";
|
|
119
|
+
}
|
|
120
|
+
function isSubtypeFieldCapableLayer(item) {
|
|
121
|
+
return !!item && typeof item === "object" && "subtypeField" in item;
|
|
122
|
+
}
|
|
123
|
+
function isSubtypesCapableLayer(item) {
|
|
124
|
+
return isSubtypeFieldCapableLayer(item) && "subtypes" in item;
|
|
87
125
|
}
|
|
88
126
|
function isRelationshipsCapableLayer(item) {
|
|
89
|
-
|
|
127
|
+
return (isLayerIdCapableSource(item) &&
|
|
128
|
+
"relationships" in item &&
|
|
129
|
+
"url" in item &&
|
|
130
|
+
Array.isArray(item.relationships) &&
|
|
131
|
+
typeof item.url === "string");
|
|
90
132
|
}
|
|
91
133
|
function isTableCapableLayer(item) {
|
|
92
|
-
|
|
134
|
+
return !!item && typeof item === "object" && "isTable" in item && typeof item.isTable === "boolean";
|
|
93
135
|
}
|
|
94
136
|
function isLoadableSource(item) {
|
|
95
|
-
|
|
137
|
+
return !!item && typeof item === "object" && "load" in item && typeof item.load === "function";
|
|
96
138
|
}
|
|
97
139
|
//#endregion
|
|
98
|
-
//#region
|
|
99
|
-
async function
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
140
|
+
//#region Service Metadata
|
|
141
|
+
async function supportedSourceFromDefinition(definition) {
|
|
142
|
+
if (!definition) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
let source = null;
|
|
146
|
+
if (isSupportedLayerInstance(definition) || isFeatureSetInstance(definition) || isFieldsDefinition(definition)) {
|
|
147
|
+
source = definition;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
source = await newFeatureLayer(definition);
|
|
151
|
+
}
|
|
152
|
+
if (isLoadableSource(source)) {
|
|
153
|
+
await source.load();
|
|
154
|
+
}
|
|
155
|
+
return source;
|
|
109
156
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
if (secondField.name === layer.typeIdField) {
|
|
123
|
-
return 1;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return firstField.name.localeCompare(secondField.name, "en", { sensitivity: "base" });
|
|
127
|
-
};
|
|
157
|
+
async function serviceMetaData(url) {
|
|
158
|
+
url += "/layers";
|
|
159
|
+
const request = await importRequest();
|
|
160
|
+
const response = await request(url, { responseType: "json", query: { f: "json" } });
|
|
161
|
+
const data = {
|
|
162
|
+
layers: response.data?.layers ?? [],
|
|
163
|
+
tables: response.data?.tables ?? []
|
|
164
|
+
};
|
|
165
|
+
const queryCapability = url.endsWith("MapServer/layers") ? "data" : "query";
|
|
166
|
+
const layers = filterFeatureLayerInfos(data.layers, queryCapability);
|
|
167
|
+
const tables = filterFeatureLayerInfos(data.tables, queryCapability);
|
|
168
|
+
return { layers, tables };
|
|
128
169
|
}
|
|
129
|
-
function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
170
|
+
function filterFeatureLayerInfos(layers, queryCapability) {
|
|
171
|
+
return layers.filter((layer) => {
|
|
172
|
+
if (layer.type !== "Feature Layer" && layer.type !== "Table") {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
const capabilities = layer.capabilities
|
|
176
|
+
? layer.capabilities
|
|
177
|
+
.toLowerCase()
|
|
178
|
+
.split(",")
|
|
179
|
+
.map((value) => value.trim())
|
|
180
|
+
: [];
|
|
181
|
+
return capabilities.includes(queryCapability);
|
|
182
|
+
});
|
|
138
183
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
snippet: `"${v.code}"`,
|
|
148
|
-
filterDescription: true
|
|
149
|
-
}));
|
|
150
|
-
return new GroupOfVariables(profile, label, values);
|
|
184
|
+
//#endregion
|
|
185
|
+
|
|
186
|
+
//#endregion
|
|
187
|
+
//#region Support functions
|
|
188
|
+
async function getRelatedFeatureLayer(layer, relationship) {
|
|
189
|
+
const relatedFeatureLayer = await newFeatureLayer({ url: `${layer.url}/${relationship.relatedTableId}` });
|
|
190
|
+
await relatedFeatureLayer.load();
|
|
191
|
+
return relatedFeatureLayer;
|
|
151
192
|
}
|
|
152
|
-
function
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
193
|
+
function sortFields(layer) {
|
|
194
|
+
return (firstField, secondField) => {
|
|
195
|
+
if (firstField.type === "oid") {
|
|
196
|
+
return -1;
|
|
197
|
+
}
|
|
198
|
+
if (secondField.type === "oid") {
|
|
199
|
+
return 1;
|
|
200
|
+
}
|
|
201
|
+
if (isSubtypeSublayerInstance(layer)) {
|
|
202
|
+
if (firstField.name === layer.parent.subtypeField) {
|
|
203
|
+
return -1;
|
|
204
|
+
}
|
|
205
|
+
if (secondField.name === layer.parent.subtypeField) {
|
|
206
|
+
return 1;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (isSubtypeFieldCapableLayer(layer)) {
|
|
210
|
+
if (firstField.name === layer.subtypeField) {
|
|
211
|
+
return -1;
|
|
212
|
+
}
|
|
213
|
+
if (secondField.name === layer.subtypeField) {
|
|
214
|
+
return 1;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
if (isFeatureTypesCapableLayer(layer)) {
|
|
218
|
+
if (firstField.name === layer.typeIdField) {
|
|
219
|
+
return -1;
|
|
220
|
+
}
|
|
221
|
+
if (secondField.name === layer.typeIdField) {
|
|
222
|
+
return 1;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return firstField.name.localeCompare(secondField.name, "en", { sensitivity: "base" });
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
function areAllDomainsInherited(types, field) {
|
|
229
|
+
return types?.every((type) => type.domains?.[field.name]?.type === "inherited") ?? false;
|
|
183
230
|
}
|
|
184
231
|
// const validIdentifierExpr = new RegExp(/^[a-z_$][\w$]*$/gi);
|
|
185
|
-
const validIdentifierExpr =
|
|
232
|
+
const validIdentifierExpr = /^[a-z_$][a-z0-9_$]*$/giu;
|
|
186
233
|
function getMemberExpressionProperty(prop, includeDot = true) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
234
|
+
if (prop.match(validIdentifierExpr)) {
|
|
235
|
+
return `${includeDot ? "." : ""}${prop}`;
|
|
236
|
+
}
|
|
237
|
+
return `["${prop}"]`;
|
|
191
238
|
}
|
|
192
239
|
function assembleMemberExpression(obj, prop) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
//#endregion
|
|
199
|
-
//#region Sources
|
|
200
|
-
async function supportedSourceFromDefinition(definition) {
|
|
201
|
-
if (!definition) {
|
|
202
|
-
return null;
|
|
203
|
-
}
|
|
204
|
-
let source = null;
|
|
205
|
-
if (isSupportedLayerInstance(definition) || isFeatureSetInstance(definition) || isFieldsDefinition(definition)) {
|
|
206
|
-
source = definition;
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
source = await newFeatureLayer(definition);
|
|
210
|
-
if (!isFeatureLayerInstance(source)) {
|
|
211
|
-
console.error("Invalid FeatureSetDefinition", definition);
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
if (!source) {
|
|
216
|
-
console.error("Invalid FeatureSetDefinition", definition);
|
|
217
|
-
return null;
|
|
218
|
-
}
|
|
219
|
-
if (isLoadableSource(source)) {
|
|
220
|
-
await source.load();
|
|
221
|
-
}
|
|
222
|
-
return source;
|
|
223
|
-
}
|
|
224
|
-
async function serviceMetaData(url) {
|
|
225
|
-
url += "/layers";
|
|
226
|
-
const request = await importRequest();
|
|
227
|
-
const response = await request(url, { responseType: "json", query: { f: "json" } });
|
|
228
|
-
const data = {
|
|
229
|
-
layers: response.data?.layers ?? [],
|
|
230
|
-
tables: response.data?.tables ?? []
|
|
231
|
-
};
|
|
232
|
-
const queryCapability = url.endsWith("MapServer/layers") ? "data" : "query";
|
|
233
|
-
const layers = filterFeatureLayerInfos(data.layers, queryCapability);
|
|
234
|
-
const tables = filterFeatureLayerInfos(data.tables, queryCapability);
|
|
235
|
-
return { layers, tables };
|
|
236
|
-
}
|
|
237
|
-
function filterFeatureLayerInfos(layers, queryCapability) {
|
|
238
|
-
return layers.filter((layer) => {
|
|
239
|
-
if (layer.type !== "Feature Layer" && layer.type !== "Table") {
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
const capabilities = layer.capabilities
|
|
243
|
-
? layer.capabilities
|
|
244
|
-
.toLowerCase()
|
|
245
|
-
.split(",")
|
|
246
|
-
.map((value) => value.trim())
|
|
247
|
-
: [];
|
|
248
|
-
return capabilities.includes(queryCapability);
|
|
249
|
-
});
|
|
240
|
+
if (!obj) {
|
|
241
|
+
return prop;
|
|
242
|
+
}
|
|
243
|
+
return `${obj}${getMemberExpressionProperty(prop)}`;
|
|
250
244
|
}
|
|
251
245
|
//#endregion
|
|
252
|
-
//#region
|
|
246
|
+
//#region Editor Profile to Language Service Profile functions
|
|
253
247
|
async function variablesToLSVariable(editorVariables, kind = CompletionItemKind.Variable) {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
return variableToLSVariable(editorVariable, kind);
|
|
265
|
-
}
|
|
266
|
-
}));
|
|
267
|
-
return properties.filter((p) => p);
|
|
248
|
+
return await Promise.all(editorVariables.map(async (editorVariable) => {
|
|
249
|
+
switch (editorVariable.type) {
|
|
250
|
+
case "dictionary":
|
|
251
|
+
return await dictionaryToLSDictionary(editorVariable, kind);
|
|
252
|
+
case "feature":
|
|
253
|
+
return await featureToLSFeature(editorVariable, kind);
|
|
254
|
+
default:
|
|
255
|
+
return variableToLSVariable(editorVariable, kind);
|
|
256
|
+
}
|
|
257
|
+
}));
|
|
268
258
|
}
|
|
269
259
|
function variableToLSVariable(editorVariable, kind) {
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
260
|
+
const { name, type } = editorVariable;
|
|
261
|
+
const description = editorVariable.getDescription();
|
|
262
|
+
return {
|
|
263
|
+
name,
|
|
264
|
+
description,
|
|
265
|
+
type,
|
|
266
|
+
completion: {
|
|
267
|
+
label: name,
|
|
268
|
+
detail: name,
|
|
269
|
+
insertText: name,
|
|
270
|
+
insertTextMode: InsertTextMode.asIs,
|
|
271
|
+
insertTextFormat: InsertTextFormat.PlainText,
|
|
272
|
+
kind,
|
|
273
|
+
documentation: { kind: "markdown", value: description }
|
|
274
|
+
}
|
|
275
|
+
};
|
|
286
276
|
}
|
|
287
277
|
async function featureToLSFeature(editorFeature, kind) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
insertTextMode: InsertTextMode.asIs,
|
|
297
|
-
insertTextFormat: InsertTextFormat.PlainText,
|
|
298
|
-
kind
|
|
299
|
-
};
|
|
300
|
-
const result = {
|
|
301
|
-
name,
|
|
302
|
-
description,
|
|
303
|
-
type: "dictionary",
|
|
304
|
-
properties: [],
|
|
305
|
-
completion: resultCompletion
|
|
306
|
-
};
|
|
307
|
-
// No source definition, then it will be a feature without any known fields
|
|
308
|
-
if (!source) {
|
|
309
|
-
return result;
|
|
310
|
-
}
|
|
311
|
-
// Create properties for the fields and the aliases
|
|
312
|
-
// Also improve the feature completion documentation
|
|
313
|
-
let featureCompletionDescription = description;
|
|
314
|
-
const fieldProfileValues = [];
|
|
315
|
-
const aliasProfileValues = [];
|
|
316
|
-
supportedFields(source.fields).forEach((field) => {
|
|
317
|
-
let fieldCompletionDescription = `**${field.name}** \n${field.type}`;
|
|
318
|
-
if (field.description) {
|
|
319
|
-
fieldCompletionDescription += ` \n'${field.description}`;
|
|
320
|
-
}
|
|
321
|
-
if (featureCompletionDescription) {
|
|
322
|
-
featureCompletionDescription += " \n \n";
|
|
323
|
-
}
|
|
324
|
-
featureCompletionDescription += `**${field.name}** (${field.alias ?? field.name}) \n${field.type}`;
|
|
325
|
-
if (field.description) {
|
|
326
|
-
featureCompletionDescription += ` \n'${field.description}`;
|
|
327
|
-
}
|
|
328
|
-
// The property for the field
|
|
329
|
-
const type = fieldTypeToArcadeType(field);
|
|
330
|
-
const insertText = getMemberExpressionProperty(field.name, false);
|
|
331
|
-
fieldProfileValues.push({
|
|
332
|
-
name: field.name,
|
|
333
|
-
description: field.alias || field.name,
|
|
334
|
-
type,
|
|
335
|
-
completion: {
|
|
336
|
-
label: field.name,
|
|
337
|
-
detail: field.alias || field.name,
|
|
338
|
-
insertText,
|
|
278
|
+
// Get the source for the definition
|
|
279
|
+
const source = await editorFeature.loadSource();
|
|
280
|
+
const { name } = editorFeature;
|
|
281
|
+
const description = editorFeature.getDescription();
|
|
282
|
+
const resultCompletion = {
|
|
283
|
+
label: name,
|
|
284
|
+
detail: name,
|
|
285
|
+
insertText: name,
|
|
339
286
|
insertTextMode: InsertTextMode.asIs,
|
|
340
287
|
insertTextFormat: InsertTextFormat.PlainText,
|
|
341
|
-
kind
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
288
|
+
kind
|
|
289
|
+
};
|
|
290
|
+
const result = {
|
|
291
|
+
name,
|
|
292
|
+
description,
|
|
293
|
+
type: "dictionary",
|
|
294
|
+
properties: [],
|
|
295
|
+
completion: resultCompletion
|
|
296
|
+
};
|
|
297
|
+
// No source definition, then it will be a feature without any known fields
|
|
298
|
+
if (!source) {
|
|
299
|
+
return result;
|
|
300
|
+
}
|
|
301
|
+
// Create properties for the fields and the aliases
|
|
302
|
+
// Also improve the feature completion documentation
|
|
303
|
+
let featureCompletionDescription = description;
|
|
304
|
+
const fieldProfileValues = [];
|
|
305
|
+
const aliasProfileValues = [];
|
|
306
|
+
supportedFields(source.fields).forEach((field) => {
|
|
307
|
+
let fieldCompletionDescription = `**${field.name}** \n${field.type}`;
|
|
308
|
+
if (field.description) {
|
|
309
|
+
fieldCompletionDescription += ` \n'${field.description}`;
|
|
310
|
+
}
|
|
311
|
+
if (featureCompletionDescription) {
|
|
312
|
+
featureCompletionDescription += " \n \n";
|
|
313
|
+
}
|
|
314
|
+
featureCompletionDescription += `**${field.name}** (${fieldAlias(field)}) \n${field.type}`;
|
|
315
|
+
if (field.description) {
|
|
316
|
+
featureCompletionDescription += ` \n'${field.description}`;
|
|
317
|
+
}
|
|
318
|
+
// The property for the field
|
|
319
|
+
const type = fieldTypeToArcadeType(field);
|
|
320
|
+
const insertText = getMemberExpressionProperty(field.name, false);
|
|
321
|
+
const description = fieldAlias(field);
|
|
322
|
+
fieldProfileValues.push({
|
|
323
|
+
name: field.name,
|
|
324
|
+
description,
|
|
325
|
+
type,
|
|
326
|
+
completion: {
|
|
327
|
+
label: field.name,
|
|
328
|
+
detail: description,
|
|
329
|
+
insertText,
|
|
330
|
+
insertTextMode: InsertTextMode.asIs,
|
|
331
|
+
insertTextFormat: InsertTextFormat.PlainText,
|
|
332
|
+
kind: CompletionItemKind.Field,
|
|
333
|
+
documentation: { kind: "markdown", value: fieldCompletionDescription }
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
if (!field.alias || field.alias.toLowerCase() === field.name.toLowerCase()) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
// The property for the alias if different than the field name
|
|
340
|
+
let aliasCompletionDescription = `**${field.alias}** \n${field.type}`;
|
|
341
|
+
if (field.description) {
|
|
342
|
+
aliasCompletionDescription += ` \n'${field.description}`;
|
|
343
|
+
}
|
|
344
|
+
aliasProfileValues.push({
|
|
345
|
+
name: field.alias,
|
|
346
|
+
description: field.name,
|
|
347
|
+
type,
|
|
348
|
+
completion: {
|
|
349
|
+
label: field.alias,
|
|
350
|
+
detail: field.name,
|
|
351
|
+
insertText,
|
|
352
|
+
insertTextMode: InsertTextMode.asIs,
|
|
353
|
+
insertTextFormat: InsertTextFormat.PlainText,
|
|
354
|
+
kind: CompletionItemKind.Field,
|
|
355
|
+
documentation: { kind: "markdown", value: aliasCompletionDescription }
|
|
356
|
+
}
|
|
357
|
+
});
|
|
366
358
|
});
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
return result;
|
|
359
|
+
result.properties = [...fieldProfileValues, ...aliasProfileValues];
|
|
360
|
+
resultCompletion.documentation = { kind: "markdown", value: featureCompletionDescription };
|
|
361
|
+
return result;
|
|
371
362
|
}
|
|
372
363
|
async function dictionaryToLSDictionary(editorDictionary, kind) {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
364
|
+
const { name, dictionaryVariables: variables } = editorDictionary;
|
|
365
|
+
const description = editorDictionary.getDescription();
|
|
366
|
+
const completionDescription = variables.reduce((previous, p) => {
|
|
367
|
+
if (previous !== "") {
|
|
368
|
+
previous += " \n \n";
|
|
369
|
+
}
|
|
370
|
+
previous += `**${p.name}** \n${p.type}`;
|
|
371
|
+
const description = p.getDescription();
|
|
372
|
+
if (description) {
|
|
373
|
+
previous += ` \n${description}`;
|
|
374
|
+
}
|
|
375
|
+
return previous;
|
|
376
|
+
}, description);
|
|
377
|
+
return {
|
|
378
|
+
name,
|
|
379
|
+
description,
|
|
380
|
+
type: "dictionary",
|
|
381
|
+
properties: await variablesToLSVariable(variables, CompletionItemKind.Field),
|
|
382
|
+
completion: {
|
|
383
|
+
label: name,
|
|
384
|
+
detail: name,
|
|
385
|
+
insertText: name,
|
|
386
|
+
insertTextMode: InsertTextMode.asIs,
|
|
387
|
+
insertTextFormat: InsertTextFormat.PlainText,
|
|
388
|
+
kind,
|
|
389
|
+
documentation: { kind: "markdown", value: completionDescription }
|
|
390
|
+
}
|
|
391
|
+
};
|
|
401
392
|
}
|
|
402
393
|
/**
|
|
403
394
|
* Represents a item in the EditorProfile. The profile is converted into an optimized way for
|
|
@@ -405,107 +396,107 @@ async function dictionaryToLSDictionary(editorDictionary, kind) {
|
|
|
405
396
|
* structures are created such as groups.
|
|
406
397
|
*/
|
|
407
398
|
class ProfileItemBase {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
399
|
+
constructor(_profile, _label, description) {
|
|
400
|
+
this._profile = _profile;
|
|
401
|
+
this._label = _label;
|
|
402
|
+
this.description = description;
|
|
403
|
+
this.filterDescription = false;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Returns the label string.
|
|
407
|
+
*/
|
|
408
|
+
getLabel() {
|
|
409
|
+
if (this._label == null) {
|
|
410
|
+
return "";
|
|
411
|
+
}
|
|
412
|
+
if (typeof this._label === "string") {
|
|
413
|
+
// Some of our variables can start with a $ sign.
|
|
414
|
+
// If the component is under RTL, the string is messed up.
|
|
415
|
+
// It is converted from $feature to feature$, This is not acceptable since the label
|
|
416
|
+
// represents a variable name. We are adding in front of the $ sign a right to left mark.
|
|
417
|
+
return Z(this._label);
|
|
418
|
+
}
|
|
419
|
+
return K(this._profile?.intlStrings[this._label.code], this._label.formatValues);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Returns the description string.
|
|
423
|
+
*/
|
|
424
|
+
getDescription() {
|
|
425
|
+
if (this.description == null) {
|
|
426
|
+
return "";
|
|
427
|
+
}
|
|
428
|
+
if (typeof this.description === "string") {
|
|
429
|
+
return this.description;
|
|
430
|
+
}
|
|
431
|
+
return K(this._profile?.intlStrings[this.description.code], this.description.formatValues);
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Returns true if the item pass the filter test
|
|
435
|
+
*/
|
|
436
|
+
passFilter(filterExpression) {
|
|
437
|
+
if (!filterExpression) {
|
|
438
|
+
return true;
|
|
439
|
+
}
|
|
440
|
+
if (filterExpression.test(this.getLabel())) {
|
|
441
|
+
return true;
|
|
442
|
+
}
|
|
443
|
+
return this.filterDescription && filterExpression.test(this.getDescription());
|
|
444
|
+
}
|
|
454
445
|
}
|
|
455
446
|
/**
|
|
456
447
|
* The base class for profile variables representation in the EditorProfile.
|
|
457
448
|
*/
|
|
458
449
|
class VariableBase extends ProfileItemBase {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
450
|
+
constructor(props) {
|
|
451
|
+
super(props.profile, props.label, props.description ?? props.declaration?.description);
|
|
452
|
+
this.declaration = props.declaration ?? {};
|
|
453
|
+
this.name = props.declaration?.name ?? "";
|
|
454
|
+
this.snippet = props.snippet ?? "";
|
|
455
|
+
this.nonInteractive = props.nonInteractive ?? false;
|
|
456
|
+
this.filterDescription = props.filterDescription ?? false;
|
|
457
|
+
this.icon = props.icon;
|
|
458
|
+
}
|
|
468
459
|
}
|
|
469
460
|
/**
|
|
470
461
|
* Represents the IProfileValue.
|
|
471
462
|
*/
|
|
472
463
|
class ValueVariable extends VariableBase {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
464
|
+
constructor(props) {
|
|
465
|
+
super(props);
|
|
466
|
+
this.type = "text";
|
|
467
|
+
this.isCollection = false;
|
|
468
|
+
this.type = props.declaration?.type ?? "text";
|
|
469
|
+
}
|
|
470
|
+
getDescription() {
|
|
471
|
+
if (this.description == null) {
|
|
472
|
+
return this._profile?.intlStrings[this.type.toLowerCase()] ?? "";
|
|
473
|
+
}
|
|
474
|
+
return super.getDescription();
|
|
475
|
+
}
|
|
476
|
+
toProfileVariableDefinition() {
|
|
477
|
+
return { type: this.type, name: "", ...this.declaration };
|
|
478
|
+
}
|
|
488
479
|
}
|
|
489
480
|
/**
|
|
490
481
|
* Represents the IProfileArray. The main difference is that the IProfileValue type
|
|
491
482
|
* is used as valueType.
|
|
492
483
|
*/
|
|
493
484
|
class ArrayVariable extends VariableBase {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
485
|
+
constructor(props) {
|
|
486
|
+
super(props);
|
|
487
|
+
this.type = "array";
|
|
488
|
+
this.isCollection = false;
|
|
489
|
+
this.elementType = props.declaration?.elementType ?? { type: "number", name: "number" };
|
|
490
|
+
}
|
|
491
|
+
getDescription() {
|
|
492
|
+
if (this.description == null) {
|
|
493
|
+
return this._profile?.intlStrings[this.type.toLowerCase()] ?? "";
|
|
494
|
+
}
|
|
495
|
+
return super.getDescription();
|
|
496
|
+
}
|
|
497
|
+
toProfileVariableDefinition() {
|
|
498
|
+
return { type: this.type, elementType: this.elementType, name: "", ...this.declaration };
|
|
499
|
+
}
|
|
509
500
|
}
|
|
510
501
|
/**
|
|
511
502
|
* Represents a collection of items. The collection of items can be synchronous or
|
|
@@ -514,595 +505,762 @@ class ArrayVariable extends VariableBase {
|
|
|
514
505
|
* collection is ready or not.
|
|
515
506
|
*/
|
|
516
507
|
class CollectionBasedVariable extends VariableBase {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
508
|
+
constructor(owner, props) {
|
|
509
|
+
super(props);
|
|
510
|
+
this.owner = owner;
|
|
511
|
+
this.isCollection = true;
|
|
512
|
+
this._loaded = true;
|
|
513
|
+
/**
|
|
514
|
+
* The collection of items used to display the profile.
|
|
515
|
+
* If the collection is asynchronous, the 'load' function should
|
|
516
|
+
* be called first before using the items.
|
|
517
|
+
*/
|
|
518
|
+
this.variables = [];
|
|
519
|
+
}
|
|
520
|
+
get breadcrumb() {
|
|
521
|
+
// If there's an owner, prepend its breadcrumb and append the current name
|
|
522
|
+
if (this.owner) {
|
|
523
|
+
const ownerBreadcrumb = this.owner.breadcrumb;
|
|
524
|
+
return ownerBreadcrumb ? `${ownerBreadcrumb} / ${this.name}` : this.name;
|
|
525
|
+
}
|
|
526
|
+
// If there's no owner, this is the root element, so just return its name
|
|
527
|
+
return this.name;
|
|
528
|
+
}
|
|
521
529
|
/**
|
|
522
|
-
*
|
|
523
|
-
* If the collection is asynchronous, the 'load' function should
|
|
524
|
-
* be called first before using the items.
|
|
530
|
+
* Returns true if the collection has been loaded
|
|
525
531
|
*/
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
async loadSource() {
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
/**
|
|
542
|
-
* Returns an url to the associated information
|
|
543
|
-
*/
|
|
544
|
-
get informationUrl() {
|
|
545
|
-
return null;
|
|
546
|
-
}
|
|
547
|
-
get informationType() {
|
|
548
|
-
return "";
|
|
549
|
-
}
|
|
532
|
+
get loaded() {
|
|
533
|
+
return this._loaded;
|
|
534
|
+
}
|
|
535
|
+
/**
|
|
536
|
+
* Returns an url to the associated information
|
|
537
|
+
*/
|
|
538
|
+
get informationUrl() {
|
|
539
|
+
return null;
|
|
540
|
+
}
|
|
541
|
+
get informationType() {
|
|
542
|
+
return "";
|
|
543
|
+
}
|
|
550
544
|
}
|
|
551
545
|
class GroupOfVariables extends ProfileItemBase {
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
546
|
+
constructor(profile, label, variables = []) {
|
|
547
|
+
super(profile, label);
|
|
548
|
+
this.variables = variables;
|
|
549
|
+
this.type = "group";
|
|
550
|
+
this.isCollection = true;
|
|
551
|
+
}
|
|
552
|
+
passFilter() {
|
|
553
|
+
return true;
|
|
554
|
+
}
|
|
561
555
|
}
|
|
562
556
|
class DictionaryVariable extends CollectionBasedVariable {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
createVariableInstance(declaration) {
|
|
596
|
-
const snippet = assembleMemberExpression(this.snippet, declaration.name);
|
|
597
|
-
switch (declaration.type) {
|
|
598
|
-
case "number":
|
|
599
|
-
case "text":
|
|
600
|
-
case "boolean":
|
|
601
|
-
case "date":
|
|
602
|
-
case "geometry":
|
|
603
|
-
return new ValueVariable({ profile: this._profile, declaration, label: snippet, snippet });
|
|
604
|
-
case "feature":
|
|
605
|
-
return new FeatureVariable({ profile: this._profile, declaration, label: snippet, snippet });
|
|
606
|
-
case "featureSet":
|
|
607
|
-
return new FeatureSetVariable({ profile: this._profile, declaration, label: snippet, snippet }, [
|
|
608
|
-
new ValueVariable({ profile: this._profile, label: snippet, description: "", snippet })
|
|
609
|
-
]);
|
|
610
|
-
case "featureSetCollection":
|
|
611
|
-
return new FeatureSetCollectionVariable({
|
|
612
|
-
profile: this._profile,
|
|
613
|
-
declaration,
|
|
614
|
-
label: snippet,
|
|
615
|
-
snippet
|
|
616
|
-
});
|
|
617
|
-
case "dictionary":
|
|
618
|
-
return new DictionaryVariable({
|
|
619
|
-
profile: this._profile,
|
|
620
|
-
declaration,
|
|
621
|
-
label: snippet,
|
|
622
|
-
snippet
|
|
623
|
-
});
|
|
624
|
-
case "array":
|
|
625
|
-
return new ArrayVariable({
|
|
626
|
-
profile: this._profile,
|
|
627
|
-
declaration,
|
|
628
|
-
label: snippet,
|
|
629
|
-
snippet
|
|
557
|
+
constructor(owner, props) {
|
|
558
|
+
super(owner, props);
|
|
559
|
+
this.type = "dictionary";
|
|
560
|
+
/**
|
|
561
|
+
* The variables that the dictionary holds. It is different than the variables.
|
|
562
|
+
* The variables may contain grouping.
|
|
563
|
+
*/
|
|
564
|
+
this.dictionaryVariables = [];
|
|
565
|
+
this.loadPropertyDeclarations(props.declaration?.properties);
|
|
566
|
+
// If we have a snippet then wrap the properties in a group and use the snippet as the heading
|
|
567
|
+
// This is not applicable for root Dictionary such as Profile
|
|
568
|
+
if (this.snippet && this.dictionaryVariables.length) {
|
|
569
|
+
this.variables = [new GroupOfVariables(this._profile, this.snippet, this.dictionaryVariables)];
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
async loadSource() {
|
|
573
|
+
// No-op
|
|
574
|
+
}
|
|
575
|
+
loadPropertyDeclarations(declarations) {
|
|
576
|
+
this.dictionaryVariables = this.createVariableInstances(declarations);
|
|
577
|
+
this.variables = this.dictionaryVariables;
|
|
578
|
+
}
|
|
579
|
+
createVariableInstances(declarations) {
|
|
580
|
+
if (!Array.isArray(declarations)) {
|
|
581
|
+
return [];
|
|
582
|
+
}
|
|
583
|
+
const properties = [];
|
|
584
|
+
declarations.forEach((declaration) => {
|
|
585
|
+
const variable = this.createVariableInstance(declaration);
|
|
586
|
+
if (variable) {
|
|
587
|
+
properties.push(variable);
|
|
588
|
+
}
|
|
630
589
|
});
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
590
|
+
return properties;
|
|
591
|
+
}
|
|
592
|
+
createVariableInstance(declaration) {
|
|
593
|
+
const snippet = assembleMemberExpression(this.snippet, declaration.name);
|
|
594
|
+
switch (declaration.type) {
|
|
595
|
+
case "number":
|
|
596
|
+
case "text":
|
|
597
|
+
case "boolean":
|
|
598
|
+
case "date":
|
|
599
|
+
case "dateOnly":
|
|
600
|
+
case "time":
|
|
601
|
+
case "geometry":
|
|
602
|
+
case "knowledgeGraph":
|
|
603
|
+
return new ValueVariable({ profile: this._profile, declaration, label: snippet, snippet });
|
|
604
|
+
case "feature":
|
|
605
|
+
return new FeatureVariable(this, { profile: this._profile, declaration, label: snippet, snippet });
|
|
606
|
+
case "featureSet":
|
|
607
|
+
return new FeatureSetVariable(this, { profile: this._profile, declaration, label: snippet, snippet }, [
|
|
608
|
+
new ValueVariable({ profile: this._profile, label: snippet, description: "", snippet })
|
|
609
|
+
]);
|
|
610
|
+
case "featureSetCollection":
|
|
611
|
+
return new FeatureSetCollectionVariable(this, {
|
|
612
|
+
profile: this._profile,
|
|
613
|
+
declaration,
|
|
614
|
+
label: snippet,
|
|
615
|
+
snippet
|
|
616
|
+
});
|
|
617
|
+
case "dictionary":
|
|
618
|
+
return new DictionaryVariable(this, {
|
|
619
|
+
profile: this._profile,
|
|
620
|
+
declaration,
|
|
621
|
+
label: snippet,
|
|
622
|
+
snippet
|
|
623
|
+
});
|
|
624
|
+
case "array":
|
|
625
|
+
return new ArrayVariable({
|
|
626
|
+
profile: this._profile,
|
|
627
|
+
declaration,
|
|
628
|
+
label: snippet,
|
|
629
|
+
snippet
|
|
630
|
+
});
|
|
631
|
+
default:
|
|
632
|
+
console.error("Editor profile: Invalid profile variable", declaration);
|
|
633
|
+
return null;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
toProfileVariableDefinition() {
|
|
637
|
+
return {
|
|
638
|
+
type: this.type,
|
|
639
|
+
name: "",
|
|
640
|
+
...this.declaration,
|
|
641
|
+
properties: this.dictionaryVariables.map((variable) => variable.toProfileVariableDefinition())
|
|
642
|
+
};
|
|
634
643
|
}
|
|
635
|
-
}
|
|
636
|
-
toProfileVariableDefinition() {
|
|
637
|
-
return {
|
|
638
|
-
type: this.type,
|
|
639
|
-
name: "",
|
|
640
|
-
...this.declaration,
|
|
641
|
-
properties: this.dictionaryVariables.map((variable) => variable.toProfileVariableDefinition())
|
|
642
|
-
};
|
|
643
|
-
}
|
|
644
644
|
}
|
|
645
645
|
class SourceBasedVariable extends CollectionBasedVariable {
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
646
|
+
constructor(owner, props, relationshipsProperties) {
|
|
647
|
+
super(owner, props);
|
|
648
|
+
this.relationshipsProperties = relationshipsProperties;
|
|
649
|
+
this._source = null;
|
|
650
|
+
this._loaded = false;
|
|
651
|
+
this._definition = props.declaration?.definition;
|
|
652
|
+
}
|
|
653
|
+
get title() {
|
|
654
|
+
return isTitleCapableSource(this._source) ? this._source.title : "";
|
|
655
|
+
}
|
|
656
|
+
get url() {
|
|
657
|
+
return isUrlCapableSource(this._source) ? this._source.url : "";
|
|
658
|
+
}
|
|
659
|
+
get informationUrl() {
|
|
660
|
+
if (!this.loaded) {
|
|
661
|
+
return null;
|
|
662
|
+
}
|
|
663
|
+
if (!this.url) {
|
|
664
|
+
return null;
|
|
665
|
+
}
|
|
666
|
+
return isLayerIdCapableSource(this._source) ? `${this.url}/${this._source.layerId}` : this.url;
|
|
667
|
+
}
|
|
668
|
+
get informationType() {
|
|
669
|
+
return this._profile?.intlStrings.layer ?? "layer";
|
|
670
|
+
}
|
|
671
|
+
async loadSource() {
|
|
672
|
+
if (Y(this._loadPromise) && ee(this._loadPromise)) {
|
|
673
|
+
return await this._loadPromise;
|
|
674
|
+
}
|
|
675
|
+
this._loadPromise = this._loadSource();
|
|
676
|
+
return await this._loadPromise;
|
|
677
|
+
}
|
|
678
|
+
_getValueSnippet(field) {
|
|
679
|
+
// If the source is a feature, then we want to assemble the snippet ($feature) with the field name as a member expression
|
|
680
|
+
return this.type === "feature" ? assembleMemberExpression(this.snippet, field.name) : field.name;
|
|
681
|
+
}
|
|
682
|
+
_getSubtypeOrDomainNameSnippet(field) {
|
|
683
|
+
if (this.type !== "feature") {
|
|
684
|
+
return null;
|
|
685
|
+
}
|
|
686
|
+
if (isSubtypeFieldCapableLayer(this._source) && field.name === this._source.subtypeField) {
|
|
687
|
+
return `SubtypeName(${this.snippet})`;
|
|
688
|
+
}
|
|
689
|
+
return `DomainName(${this.snippet}, "${field.name}")`;
|
|
690
|
+
}
|
|
691
|
+
_getFieldProperty(field) {
|
|
692
|
+
// Check if the field is the type id field or of the field has a coded domain.
|
|
693
|
+
// If it has then the property will be an exanpdable property (dictionary).
|
|
694
|
+
// Otherwise just return a simple value property.
|
|
695
|
+
const subtypesOrDomainValuesDictionary = this._getDomainDictionary(field);
|
|
696
|
+
if (subtypesOrDomainValuesDictionary) {
|
|
697
|
+
return subtypesOrDomainValuesDictionary;
|
|
698
|
+
}
|
|
699
|
+
// Create the value property
|
|
700
|
+
const valueSnippet = this._getValueSnippet(field);
|
|
701
|
+
return new ValueVariable({
|
|
702
|
+
profile: this._profile,
|
|
703
|
+
label: valueSnippet,
|
|
704
|
+
description: fieldAlias(field),
|
|
705
|
+
snippet: valueSnippet,
|
|
706
|
+
icon: fieldTypeToIconName(field),
|
|
707
|
+
filterDescription: true
|
|
708
|
+
});
|
|
709
|
+
}
|
|
710
|
+
_getDomainDictionary(field) {
|
|
711
|
+
if (!isDomainsCapableLayer(this._source)) {
|
|
712
|
+
return null;
|
|
713
|
+
}
|
|
714
|
+
// Note we have multiple scenarios:
|
|
715
|
+
// - Layers without subtypes or feature types: We will check if the field has a domain
|
|
716
|
+
// - Layers with only subtypes: We will parse the subtypes metadata and create a dictionary
|
|
717
|
+
// - Layers with only feature types: We will parse the feature types metadata
|
|
718
|
+
// - Layers with both subtypes and feature types: we will actually use the subtypes metadata
|
|
719
|
+
// Summary, we will always use the subtypes metadata if available.
|
|
720
|
+
if (isSubtypeFieldCapableLayer(this._source) && !!this._source.subtypeField) {
|
|
721
|
+
return this._getSubtypeDomainDictionary(field);
|
|
722
|
+
}
|
|
723
|
+
if (isFeatureTypesCapableLayer(this._source) && !!this._source.typeIdField) {
|
|
724
|
+
return this._getFeatureTypeDomainDictionary(field);
|
|
725
|
+
}
|
|
726
|
+
return this._getFieldDomainDictionary(field);
|
|
727
|
+
}
|
|
728
|
+
_getSubtypeDomainDictionary(field) {
|
|
729
|
+
// Should be tested before calling this function
|
|
730
|
+
if (!isSubtypeFieldCapableLayer(this._source)) {
|
|
731
|
+
return null;
|
|
732
|
+
}
|
|
733
|
+
// If the source has a subtype field but doesn't have subtypes, it is certainly a subtype sublayer
|
|
734
|
+
if (!isSubtypesCapableLayer(this._source)) {
|
|
735
|
+
// For the subtype field there is no domain
|
|
736
|
+
if (field.name === this._source.subtypeField) {
|
|
737
|
+
return null;
|
|
738
|
+
}
|
|
739
|
+
// For the other fields, we will use the getFieldDomain function
|
|
740
|
+
return this._getFieldDomainDictionary(field);
|
|
741
|
+
}
|
|
742
|
+
// The code here shoud be executed for layers that have subtypes
|
|
743
|
+
// Sepcial case for the subtype field
|
|
744
|
+
if (field.name === this._source.subtypeField) {
|
|
745
|
+
const domainDictionary = this._createDomainDictionary(field);
|
|
746
|
+
domainDictionary.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.subtypes, field));
|
|
747
|
+
return domainDictionary;
|
|
748
|
+
}
|
|
749
|
+
// Check if all the domains for the field in the types are inherited.
|
|
750
|
+
// If it is we can simplify the structure by avoiding splitting in subtypes
|
|
751
|
+
if (areAllDomainsInherited(this._source.subtypes, field)) {
|
|
752
|
+
return this._getFieldDomainDictionary(field);
|
|
753
|
+
}
|
|
743
754
|
// We have domains per subtype
|
|
744
755
|
// We need to go thru each types and create a dictionary.
|
|
745
|
-
const domainValuesBySubtypeGroup =
|
|
756
|
+
const domainValuesBySubtypeGroup = this._getDomainValuesGroup(this._source.subtypes, field);
|
|
746
757
|
if (!domainValuesBySubtypeGroup) {
|
|
747
|
-
|
|
758
|
+
return null;
|
|
748
759
|
}
|
|
760
|
+
const domainDictionary = this._createDomainDictionary(field);
|
|
749
761
|
domainDictionary.variables.push(domainValuesBySubtypeGroup);
|
|
750
762
|
return domainDictionary;
|
|
751
|
-
}
|
|
752
763
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
764
|
+
_getFeatureTypeDomainDictionary(field) {
|
|
765
|
+
// SHould be tested before calling this function
|
|
766
|
+
if (!isFeatureTypesCapableLayer(this._source)) {
|
|
767
|
+
return null;
|
|
768
|
+
}
|
|
769
|
+
// Special case for the type id field
|
|
770
|
+
if (field.name === this._source.typeIdField) {
|
|
771
|
+
const domainDictionary = this._createDomainDictionary(field);
|
|
772
|
+
domainDictionary.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.types, field));
|
|
773
|
+
return domainDictionary;
|
|
774
|
+
}
|
|
775
|
+
// Check if all the domains for the field in the types are inherited.
|
|
776
|
+
// If it is we can simplify the structure by avoiding splitting in subtypes
|
|
777
|
+
if (areAllDomainsInherited(this._source.types, field)) {
|
|
778
|
+
return this._getFieldDomainDictionary(field);
|
|
779
|
+
}
|
|
780
|
+
// We have domains per feature type
|
|
781
|
+
// We need to go thru each types and create a dictionary.
|
|
782
|
+
const domainValuesByFeatureTypeGroup = this._getDomainValuesGroup(this._source.types, field);
|
|
783
|
+
if (!domainValuesByFeatureTypeGroup) {
|
|
784
|
+
return null;
|
|
785
|
+
}
|
|
786
|
+
const domainDictionary = this._createDomainDictionary(field);
|
|
787
|
+
domainDictionary.variables.push(domainValuesByFeatureTypeGroup);
|
|
788
|
+
return domainDictionary;
|
|
789
|
+
}
|
|
790
|
+
_getFieldDomainDictionary(field) {
|
|
791
|
+
// SHould be tested before calling this function
|
|
792
|
+
if (!isDomainsCapableLayer(this._source)) {
|
|
793
|
+
return null;
|
|
794
|
+
}
|
|
795
|
+
const fieldDomain = this._source.getFieldDomain(field.name);
|
|
796
|
+
if (!isCodedValueDomainInstance(fieldDomain)) {
|
|
797
|
+
return null;
|
|
798
|
+
}
|
|
799
|
+
const domainValuesGroup = this._getCodedValueDomainGroup(fieldDomain, {
|
|
800
|
+
code: "domainvalues"
|
|
801
|
+
});
|
|
802
|
+
const domainDictionary = this._createDomainDictionary(field);
|
|
803
|
+
domainDictionary.variables.push(domainValuesGroup);
|
|
804
|
+
return domainDictionary;
|
|
805
|
+
}
|
|
806
|
+
_getTypeOrSubtypeDomainGroup(types, field) {
|
|
807
|
+
// Try the coded domain first
|
|
808
|
+
if (isCodedValueDomainInstance(field.domain)) {
|
|
809
|
+
return this._getCodedValueDomainGroup(field.domain, { code: "subtypes" });
|
|
810
|
+
}
|
|
811
|
+
// No coded domain, we will manufacture it
|
|
812
|
+
const values = types?.map((t) => {
|
|
813
|
+
const label = isSubtypeInstance(t) ? t.code : t.id;
|
|
814
|
+
return new ValueVariable({
|
|
815
|
+
profile: this._profile,
|
|
816
|
+
label: `${label}`,
|
|
817
|
+
description: t.name,
|
|
818
|
+
snippet: `"${label}"`
|
|
819
|
+
});
|
|
820
|
+
}) ?? [];
|
|
821
|
+
return new GroupOfVariables(this._profile, { code: "subtypes" }, values);
|
|
822
|
+
}
|
|
823
|
+
_getCodedValueDomainGroup(domain, label) {
|
|
824
|
+
const values = domain.codedValues.map((v) => new ValueVariable({
|
|
825
|
+
profile: this._profile,
|
|
826
|
+
label: `${v.code}`,
|
|
827
|
+
description: v.name,
|
|
828
|
+
snippet: `"${v.code}"`,
|
|
829
|
+
filterDescription: true
|
|
830
|
+
}));
|
|
831
|
+
return new GroupOfVariables(this._profile, label, values);
|
|
832
|
+
}
|
|
833
|
+
_getDomainValuesGroup(types, field) {
|
|
834
|
+
const variables = [];
|
|
835
|
+
if (!types || types.length === 0) {
|
|
836
|
+
return null;
|
|
837
|
+
}
|
|
838
|
+
types.forEach((type) => {
|
|
839
|
+
let domain = type.domains?.[field.name];
|
|
840
|
+
if (!domain) {
|
|
841
|
+
return;
|
|
842
|
+
}
|
|
843
|
+
if (isInheritedDomainInstance(domain)) {
|
|
844
|
+
domain = field.domain;
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
if (!isCodedValueDomainInstance(domain)) {
|
|
848
|
+
return;
|
|
849
|
+
}
|
|
850
|
+
const alias = fieldAlias(field);
|
|
851
|
+
const domainValuesGroup = this._getCodedValueDomainGroup(domain, {
|
|
852
|
+
code: "domainvaluesfortypeformat",
|
|
853
|
+
formatValues: {
|
|
854
|
+
fieldName: alias,
|
|
855
|
+
typeName: type.name
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
const id = isSubtypeInstance(type) ? type.code : type.id;
|
|
859
|
+
const label = `${id}`;
|
|
860
|
+
const snippet = `"${id}""`;
|
|
861
|
+
const subtypeDictionary = new DictionaryVariable(this, {
|
|
862
|
+
profile: this._profile,
|
|
863
|
+
label,
|
|
864
|
+
snippet,
|
|
865
|
+
description: type.name,
|
|
866
|
+
declaration: { name: alias }
|
|
867
|
+
});
|
|
868
|
+
subtypeDictionary.variables = [domainValuesGroup];
|
|
869
|
+
variables.push(subtypeDictionary);
|
|
870
|
+
});
|
|
871
|
+
if (!variables.length) {
|
|
872
|
+
return null;
|
|
873
|
+
}
|
|
874
|
+
return new GroupOfVariables(this._profile, { code: "domainvaluesbysubtypes" }, variables);
|
|
875
|
+
}
|
|
876
|
+
_createDomainDictionary(field) {
|
|
877
|
+
// Create the domain dictionary.
|
|
878
|
+
// The dictionary will have a header group and a value group.
|
|
879
|
+
// At this point we are only creating the header group in the dictionary.
|
|
880
|
+
const valueSnippet = this._getValueSnippet(field);
|
|
881
|
+
const alias = fieldAlias(field);
|
|
882
|
+
const domainDictionary = new DictionaryVariable(this, {
|
|
883
|
+
profile: this._profile,
|
|
884
|
+
label: valueSnippet,
|
|
885
|
+
description: alias,
|
|
886
|
+
snippet: valueSnippet,
|
|
887
|
+
icon: "form-dropdown",
|
|
888
|
+
declaration: { name: field.name }
|
|
889
|
+
});
|
|
890
|
+
// Add the header group
|
|
891
|
+
const headerGroup = new GroupOfVariables(this._profile, alias, [
|
|
892
|
+
new ValueVariable({
|
|
893
|
+
profile: this._profile,
|
|
894
|
+
label: valueSnippet,
|
|
895
|
+
description: "",
|
|
896
|
+
snippet: valueSnippet
|
|
897
|
+
})
|
|
898
|
+
]);
|
|
899
|
+
domainDictionary.variables = [headerGroup];
|
|
900
|
+
// Add the SubtypeName or DomainName snippet if available
|
|
901
|
+
const subtypeOrDomainNameSnippet = this._getSubtypeOrDomainNameSnippet(field);
|
|
902
|
+
if (subtypeOrDomainNameSnippet) {
|
|
903
|
+
headerGroup.variables.push(new ValueVariable({
|
|
904
|
+
profile: this._profile,
|
|
905
|
+
label: subtypeOrDomainNameSnippet,
|
|
906
|
+
description: "",
|
|
907
|
+
snippet: subtypeOrDomainNameSnippet
|
|
908
|
+
}));
|
|
909
|
+
}
|
|
910
|
+
return domainDictionary;
|
|
911
|
+
}
|
|
912
|
+
async _getRelationshipsProperty() {
|
|
913
|
+
// We need the data store to find the relationship feature layers
|
|
914
|
+
if (!this.relationshipsProperties?.exposeRelationships || !this._profile?.supportFeatureSetFunctions) {
|
|
915
|
+
return null;
|
|
916
|
+
}
|
|
917
|
+
const source = this._source;
|
|
918
|
+
if (!isRelationshipsCapableLayer(source)) {
|
|
919
|
+
return null;
|
|
920
|
+
}
|
|
921
|
+
const relationshipsGroup = new GroupOfVariables(this._profile, { code: "relationships" });
|
|
922
|
+
const relationshipItems = await Promise.all(source.relationships.map(async (relationship) => {
|
|
923
|
+
const relatedLayer = await getRelatedFeatureLayer(source, relationship);
|
|
924
|
+
if (!isQueryableLayerInstance(relatedLayer)) {
|
|
925
|
+
return null;
|
|
926
|
+
}
|
|
927
|
+
if (relationship.relatedTableId === this.relationshipsProperties?.sourceTableId) {
|
|
928
|
+
// We don't want to show the reverse relationship
|
|
929
|
+
return null;
|
|
930
|
+
}
|
|
931
|
+
const snippet = `FeatureSetByRelationshipName(${this.snippet}, "${relationship.name}")`;
|
|
932
|
+
return new FeatureSetVariable(this, {
|
|
933
|
+
profile: this._profile,
|
|
934
|
+
declaration: { definition: relatedLayer },
|
|
935
|
+
label: relatedLayer.title,
|
|
936
|
+
description: "",
|
|
937
|
+
nonInteractive: true
|
|
938
|
+
}, [new ValueVariable({ profile: this._profile, label: snippet, description: "", snippet })], { exposeRelationships: true, sourceTableId: source.layerId });
|
|
939
|
+
}));
|
|
940
|
+
relationshipsGroup.variables = relationshipItems.filter(Y);
|
|
941
|
+
if (!relationshipsGroup.variables.length) {
|
|
942
|
+
return null;
|
|
943
|
+
}
|
|
944
|
+
return relationshipsGroup;
|
|
794
945
|
}
|
|
795
|
-
return relationshipsGroup;
|
|
796
|
-
}
|
|
797
946
|
}
|
|
798
947
|
class FeatureVariable extends SourceBasedVariable {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
948
|
+
constructor(owner, props) {
|
|
949
|
+
super(owner, props, { exposeRelationships: true });
|
|
950
|
+
this.type = "feature";
|
|
951
|
+
}
|
|
952
|
+
get title() {
|
|
953
|
+
if (isSupportedLayerInstance(this._source)) {
|
|
954
|
+
return this._source.title;
|
|
955
|
+
}
|
|
956
|
+
return { code: "feature" };
|
|
957
|
+
}
|
|
958
|
+
async _loadSource() {
|
|
959
|
+
if (this.loaded) {
|
|
960
|
+
return this._source;
|
|
961
|
+
}
|
|
962
|
+
try {
|
|
963
|
+
this._source = await supportedSourceFromDefinition(this._definition);
|
|
964
|
+
if (!this._source) {
|
|
965
|
+
throw new Error("Invalid definition");
|
|
966
|
+
}
|
|
967
|
+
// The title group and snippet
|
|
968
|
+
const title = isSupportedLayerInstance(this._source) ? this._source.title : "";
|
|
969
|
+
this.variables.push(new GroupOfVariables(this._profile, title, [
|
|
970
|
+
new ValueVariable({
|
|
971
|
+
profile: this._profile,
|
|
972
|
+
label: this.snippet,
|
|
973
|
+
description: "",
|
|
974
|
+
snippet: this.snippet
|
|
975
|
+
})
|
|
976
|
+
]));
|
|
977
|
+
// The collection of feature attribute values
|
|
978
|
+
const valuesGroup = new GroupOfVariables(this._profile, { code: "values" });
|
|
979
|
+
this.variables.push(valuesGroup);
|
|
980
|
+
// Add the geometry if it's a feature layer and not a table
|
|
981
|
+
if (isTableCapableLayer(this._source) && !this._source.isTable) {
|
|
982
|
+
const snippet = `Geometry(${this.snippet})`;
|
|
983
|
+
const geometryProperty = new ValueVariable({
|
|
984
|
+
profile: this._profile,
|
|
985
|
+
declaration: { name: snippet },
|
|
986
|
+
label: snippet,
|
|
987
|
+
description: "Geometry",
|
|
988
|
+
snippet,
|
|
989
|
+
icon: "shapes",
|
|
990
|
+
filterDescription: true
|
|
991
|
+
});
|
|
992
|
+
valuesGroup.variables.push(geometryProperty);
|
|
993
|
+
}
|
|
994
|
+
this._source.fields.sort(sortFields(this._source)).forEach((field) => {
|
|
995
|
+
valuesGroup.variables.push(this._getFieldProperty(field));
|
|
996
|
+
});
|
|
997
|
+
// The relatonships
|
|
998
|
+
const relationshipsGroup = await this._getRelationshipsProperty();
|
|
999
|
+
if (relationshipsGroup) {
|
|
1000
|
+
this.variables.push(relationshipsGroup);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
catch (e) {
|
|
1004
|
+
console.error("Loading issue", e, this);
|
|
1005
|
+
this._source = null;
|
|
1006
|
+
}
|
|
1007
|
+
finally {
|
|
1008
|
+
this._loaded = true;
|
|
1009
|
+
}
|
|
1010
|
+
return this._source;
|
|
1011
|
+
}
|
|
1012
|
+
toProfileVariableDefinition() {
|
|
1013
|
+
return { type: this.type, name: "", ...this.declaration, definition: this._definition };
|
|
812
1014
|
}
|
|
813
|
-
try {
|
|
814
|
-
this._source = await supportedSourceFromDefinition(this._definition);
|
|
815
|
-
if (!this._source) {
|
|
816
|
-
throw new Error("Invalid definition");
|
|
817
|
-
}
|
|
818
|
-
// The title group and snippet
|
|
819
|
-
const title = isSupportedLayerInstance(this._source) ? this._source.title : "";
|
|
820
|
-
this.variables.push(new GroupOfVariables(this._profile, title, [
|
|
821
|
-
new ValueVariable({
|
|
822
|
-
profile: this._profile,
|
|
823
|
-
label: this.snippet,
|
|
824
|
-
description: "",
|
|
825
|
-
snippet: this.snippet
|
|
826
|
-
})
|
|
827
|
-
]));
|
|
828
|
-
// The collection of feature attribute values
|
|
829
|
-
const valuesGroup = new GroupOfVariables(this._profile, { code: "values" });
|
|
830
|
-
this.variables.push(valuesGroup);
|
|
831
|
-
// Add the geometry if it's a feature layer and not a table
|
|
832
|
-
if (isTableCapableLayer(this._source) && !this._source.isTable) {
|
|
833
|
-
const snippet = `Geometry(${this.snippet})`;
|
|
834
|
-
const geometryProperty = new ValueVariable({
|
|
835
|
-
profile: this._profile,
|
|
836
|
-
declaration: { name: snippet },
|
|
837
|
-
label: snippet,
|
|
838
|
-
description: "Geometry",
|
|
839
|
-
snippet,
|
|
840
|
-
icon: "shapes",
|
|
841
|
-
filterDescription: true
|
|
842
|
-
});
|
|
843
|
-
valuesGroup.variables.push(geometryProperty);
|
|
844
|
-
}
|
|
845
|
-
this._source.fields.sort(sortFields(this._source)).forEach((field) => {
|
|
846
|
-
valuesGroup.variables.push(this._getFieldProperty(field));
|
|
847
|
-
});
|
|
848
|
-
// The relatonships
|
|
849
|
-
const relationshipsGroup = await this._getRelationshipsProperty();
|
|
850
|
-
if (relationshipsGroup) {
|
|
851
|
-
this.variables.push(relationshipsGroup);
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
catch (e) {
|
|
855
|
-
console.error("Loading issue", e, this);
|
|
856
|
-
this._source = null;
|
|
857
|
-
}
|
|
858
|
-
finally {
|
|
859
|
-
this._loaded = true;
|
|
860
|
-
}
|
|
861
|
-
return this._source;
|
|
862
|
-
}
|
|
863
|
-
toProfileVariableDefinition() {
|
|
864
|
-
return { type: this.type, name: "", ...this.declaration, definition: this._definition };
|
|
865
|
-
}
|
|
866
1015
|
}
|
|
867
1016
|
class FeatureSetVariable extends SourceBasedVariable {
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
1017
|
+
constructor(owner, props, featureSetSnippets = [],
|
|
1018
|
+
// Relationships for feature set if only supported if the feature set is actually
|
|
1019
|
+
// representing a relationsip feature layer for a feature source.
|
|
1020
|
+
relationshipProps) {
|
|
1021
|
+
super(owner, props, relationshipProps);
|
|
1022
|
+
this.featureSetSnippets = featureSetSnippets;
|
|
1023
|
+
this.type = "featureSet";
|
|
1024
|
+
}
|
|
1025
|
+
get title() {
|
|
1026
|
+
if (isSupportedLayerInstance(this._source)) {
|
|
1027
|
+
return this._source.title;
|
|
1028
|
+
}
|
|
1029
|
+
return { code: "featureset" };
|
|
1030
|
+
}
|
|
1031
|
+
async _loadSource() {
|
|
1032
|
+
if (this.loaded) {
|
|
1033
|
+
return this._source;
|
|
1034
|
+
}
|
|
1035
|
+
try {
|
|
1036
|
+
this._source = await supportedSourceFromDefinition(this._definition);
|
|
1037
|
+
if (!this._source) {
|
|
1038
|
+
throw new Error("Invalid definition");
|
|
1039
|
+
}
|
|
1040
|
+
// The title group and snippet
|
|
1041
|
+
this.variables.push(new GroupOfVariables(this._profile, this.title, this.featureSetSnippets));
|
|
1042
|
+
// Add the fields
|
|
1043
|
+
const fieldsGroup = new GroupOfVariables(this._profile, { code: "fields" });
|
|
1044
|
+
this.variables.push(fieldsGroup);
|
|
1045
|
+
fieldsGroup.variables = this._source.fields
|
|
1046
|
+
.sort(sortFields(this._source))
|
|
1047
|
+
.map((field) => this._getFieldProperty(field));
|
|
1048
|
+
// Add the relationships if enabled
|
|
1049
|
+
const relationshipsGroup = await this._getRelationshipsProperty();
|
|
1050
|
+
if (relationshipsGroup) {
|
|
1051
|
+
this.variables.push(relationshipsGroup);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
catch (e) {
|
|
1055
|
+
console.error("Loading issue", e, this);
|
|
1056
|
+
this._source = null;
|
|
1057
|
+
}
|
|
1058
|
+
finally {
|
|
1059
|
+
this._loaded = true;
|
|
1060
|
+
}
|
|
1061
|
+
return this._source;
|
|
1062
|
+
}
|
|
1063
|
+
toProfileVariableDefinition() {
|
|
1064
|
+
return { type: this.type, name: "", ...this.declaration, definition: this._definition };
|
|
885
1065
|
}
|
|
886
|
-
try {
|
|
887
|
-
this._source = await supportedSourceFromDefinition(this._definition);
|
|
888
|
-
if (!this._source) {
|
|
889
|
-
throw new Error("Invalid definition");
|
|
890
|
-
}
|
|
891
|
-
// The title group and snippet
|
|
892
|
-
this.variables.push(new GroupOfVariables(this._profile, this.title, this.featureSetSnippets));
|
|
893
|
-
// Add the fields
|
|
894
|
-
const fieldsGroup = new GroupOfVariables(this._profile, { code: "fields" });
|
|
895
|
-
this.variables.push(fieldsGroup);
|
|
896
|
-
fieldsGroup.variables = this._source.fields
|
|
897
|
-
.sort(sortFields(this._source))
|
|
898
|
-
.map((field) => this._getFieldProperty(field));
|
|
899
|
-
// Add the relationships if enabled
|
|
900
|
-
const relationshipsGroup = await this._getRelationshipsProperty();
|
|
901
|
-
if (relationshipsGroup) {
|
|
902
|
-
this.variables.push(relationshipsGroup);
|
|
903
|
-
}
|
|
904
|
-
}
|
|
905
|
-
catch (e) {
|
|
906
|
-
console.error("Loading issue", e, this);
|
|
907
|
-
this._source = null;
|
|
908
|
-
}
|
|
909
|
-
finally {
|
|
910
|
-
this._loaded = true;
|
|
911
|
-
}
|
|
912
|
-
return this._source;
|
|
913
|
-
}
|
|
914
|
-
toProfileVariableDefinition() {
|
|
915
|
-
return { type: this.type, name: "", ...this.declaration, definition: this._definition };
|
|
916
|
-
}
|
|
917
1066
|
}
|
|
918
1067
|
class FeatureSetCollectionVariable extends CollectionBasedVariable {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
}
|
|
939
|
-
get informationType() {
|
|
940
|
-
if (!this.loaded || !this._featureSetCollections) {
|
|
941
|
-
return "";
|
|
942
|
-
}
|
|
943
|
-
if (typeof this._featureSetCollections.source !== "string") {
|
|
944
|
-
return this._profile?.intlStrings?.webmap ?? "webmap";
|
|
945
|
-
}
|
|
946
|
-
return this._profile?.intlStrings?.featureservice ?? "featureservice";
|
|
947
|
-
}
|
|
948
|
-
async loadSource() {
|
|
949
|
-
if (Q(this._loadPromise) && G(this._loadPromise)) {
|
|
950
|
-
return this._loadPromise;
|
|
951
|
-
}
|
|
952
|
-
this._loadPromise = this._loadSource();
|
|
953
|
-
return this._loadPromise;
|
|
954
|
-
}
|
|
955
|
-
async _loadSource() {
|
|
956
|
-
if (this.loaded) {
|
|
957
|
-
return this._featureSetCollections;
|
|
1068
|
+
constructor(owner, props) {
|
|
1069
|
+
super(owner, props);
|
|
1070
|
+
this.type = "featureSetCollection";
|
|
1071
|
+
this._featureSetCollections = null;
|
|
1072
|
+
this._loaded = false;
|
|
1073
|
+
this._definition = props.declaration?.definition;
|
|
1074
|
+
}
|
|
1075
|
+
get informationUrl() {
|
|
1076
|
+
if (!this.loaded || !this._featureSetCollections) {
|
|
1077
|
+
return null;
|
|
1078
|
+
}
|
|
1079
|
+
if (typeof this._featureSetCollections.source !== "string") {
|
|
1080
|
+
return portalItemPageUrl(this._featureSetCollections.source.portalItem);
|
|
1081
|
+
}
|
|
1082
|
+
// const firstLayer = this._featureSetCollection.layers[0] ?? this._featureSetCollection.tables[0];
|
|
1083
|
+
// if (!firstLayer) {
|
|
1084
|
+
return null;
|
|
1085
|
+
// }
|
|
1086
|
+
// return `${firstLayer.url}`;
|
|
958
1087
|
}
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
return this._featureSetCollectionFromUrl(portalItem.url);
|
|
1035
|
-
default:
|
|
1036
|
-
console.error("Unsupported portal item", definition);
|
|
1088
|
+
get informationType() {
|
|
1089
|
+
if (!this.loaded || !this._featureSetCollections) {
|
|
1090
|
+
return "";
|
|
1091
|
+
}
|
|
1092
|
+
if (typeof this._featureSetCollections.source !== "string") {
|
|
1093
|
+
return this._profile?.intlStrings.webmap ?? "webmap";
|
|
1094
|
+
}
|
|
1095
|
+
return this._profile?.intlStrings.featureservice ?? "featureservice";
|
|
1096
|
+
}
|
|
1097
|
+
async loadSource() {
|
|
1098
|
+
if (Y(this._loadPromise) && ee(this._loadPromise)) {
|
|
1099
|
+
return await this._loadPromise;
|
|
1100
|
+
}
|
|
1101
|
+
this._loadPromise = this._loadSource();
|
|
1102
|
+
return await this._loadPromise;
|
|
1103
|
+
}
|
|
1104
|
+
async _loadSource() {
|
|
1105
|
+
if (this.loaded) {
|
|
1106
|
+
return this._featureSetCollections;
|
|
1107
|
+
}
|
|
1108
|
+
try {
|
|
1109
|
+
this._featureSetCollections = await this._featureSetCollectionsFromDefinition();
|
|
1110
|
+
if (!this._featureSetCollections) {
|
|
1111
|
+
throw new Error("Invalid definition");
|
|
1112
|
+
}
|
|
1113
|
+
// Create the group for the header
|
|
1114
|
+
const groupLabel = typeof this._featureSetCollections.source === "string"
|
|
1115
|
+
? { code: this._featureSetCollections.source.endsWith("FeatureServer") ? "featureservice" : "mapservice" }
|
|
1116
|
+
: {
|
|
1117
|
+
code: "webmapformat",
|
|
1118
|
+
formatValues: {
|
|
1119
|
+
webMapTitle: this._featureSetCollections.source.portalItem.title || "Untitled map"
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
const headerGroup = new GroupOfVariables(this._profile, groupLabel, [
|
|
1123
|
+
new ValueVariable({
|
|
1124
|
+
profile: this._profile,
|
|
1125
|
+
label: this.snippet,
|
|
1126
|
+
description: "",
|
|
1127
|
+
snippet: this.snippet
|
|
1128
|
+
})
|
|
1129
|
+
]);
|
|
1130
|
+
// Creates the groups for the layer and tables
|
|
1131
|
+
const layersGroup = new GroupOfVariables(this._profile, { code: "layers" }, this._featureSetCollections.layers);
|
|
1132
|
+
const tablesGroup = new GroupOfVariables(this._profile, { code: "tables" }, this._featureSetCollections.tables);
|
|
1133
|
+
this.variables.push(headerGroup, layersGroup, tablesGroup);
|
|
1134
|
+
}
|
|
1135
|
+
catch (e) {
|
|
1136
|
+
console.error("Loading issue", e, this);
|
|
1137
|
+
this._featureSetCollections = null;
|
|
1138
|
+
}
|
|
1139
|
+
finally {
|
|
1140
|
+
this._loaded = true;
|
|
1141
|
+
}
|
|
1142
|
+
return this._featureSetCollections;
|
|
1143
|
+
}
|
|
1144
|
+
async _featureSetCollectionsFromDefinition() {
|
|
1145
|
+
if (!this._definition) {
|
|
1146
|
+
return null;
|
|
1147
|
+
}
|
|
1148
|
+
if (isMapInstance(this._definition)) {
|
|
1149
|
+
return await this._featureSetCollectionFromMap(this._definition);
|
|
1150
|
+
}
|
|
1151
|
+
if (isSupportedLayerInstance(this._definition)) {
|
|
1152
|
+
return await this._featureSetCollectionFromUrl(this._definition.url);
|
|
1153
|
+
}
|
|
1154
|
+
if (isPortalItemDefinition(this._definition)) {
|
|
1155
|
+
// Preload the portal item so we can discover if are dealing with a Web Map
|
|
1156
|
+
// or Feature Service
|
|
1157
|
+
return await this._featureSetCollectionFromPortalItem(this._definition.portalItem);
|
|
1158
|
+
}
|
|
1159
|
+
if (isUrlDefinition(this._definition)) {
|
|
1160
|
+
// Assume that the url is pointing to a feature server
|
|
1161
|
+
return await this._featureSetCollectionFromUrl(this._definition.url);
|
|
1162
|
+
}
|
|
1037
1163
|
return null;
|
|
1038
1164
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
}));
|
|
1050
|
-
const tablesPromise = Promise.all(metadata.tables.map(async (layerInfo) => {
|
|
1051
|
-
const fl = await newFeatureLayer({ url: `${url}/${layerInfo.id}` });
|
|
1052
|
-
await fl.load();
|
|
1053
|
-
return this._createFeatureSetVariable(fl);
|
|
1054
|
-
}));
|
|
1055
|
-
const [layers, tables] = await Promise.all([layersPromise, tablesPromise]);
|
|
1056
|
-
return { layers, tables, source: url };
|
|
1057
|
-
}
|
|
1058
|
-
_convertWebMapLayersToVariables(layers, filteringTables = false) {
|
|
1059
|
-
const layerVariables = [];
|
|
1060
|
-
layers
|
|
1061
|
-
.toArray()
|
|
1062
|
-
.reverse()
|
|
1063
|
-
.forEach((layer) => {
|
|
1064
|
-
if (isFeatureLayerInstance(layer)) {
|
|
1065
|
-
layerVariables.push(this._createFeatureSetVariable(layer, true));
|
|
1066
|
-
return;
|
|
1067
|
-
}
|
|
1068
|
-
if (isGroupLayerInstance(layer)) {
|
|
1069
|
-
const groupLayerVariables = filteringTables
|
|
1070
|
-
? this._convertWebMapLayersToVariables(layer.allTables, true)
|
|
1071
|
-
: this._convertWebMapLayersToVariables(layer.allLayers);
|
|
1072
|
-
layerVariables.push(...groupLayerVariables);
|
|
1073
|
-
}
|
|
1074
|
-
});
|
|
1075
|
-
return layerVariables;
|
|
1076
|
-
}
|
|
1077
|
-
_createFeatureSetVariable(featureLayer, isFromWebMap = false) {
|
|
1078
|
-
return new FeatureSetVariable({
|
|
1079
|
-
profile: this._profile,
|
|
1080
|
-
declaration: { definition: featureLayer },
|
|
1081
|
-
label: featureLayer.title,
|
|
1082
|
-
description: "",
|
|
1083
|
-
nonInteractive: true
|
|
1084
|
-
}, this._makeFeatureSetSnippets(featureLayer, isFromWebMap));
|
|
1085
|
-
}
|
|
1086
|
-
_makeFeatureSetSnippets(featureLayer, isFromWebMap = false) {
|
|
1087
|
-
if (!this._profile?.supportFeatureSetFunctions) {
|
|
1088
|
-
return [];
|
|
1089
|
-
}
|
|
1090
|
-
if (isFromWebMap) {
|
|
1091
|
-
const snippetById = `FeatureSetById(${this.snippet}, "${featureLayer.id}")`;
|
|
1092
|
-
const snippetByName = `FeatureSetByName(${this.snippet}, "${featureLayer.title}")`;
|
|
1093
|
-
return [
|
|
1094
|
-
new ValueVariable({ profile: this._profile, label: snippetById, description: "", snippet: snippetById }),
|
|
1095
|
-
new ValueVariable({ profile: this._profile, label: snippetByName, description: "", snippet: snippetByName })
|
|
1096
|
-
];
|
|
1165
|
+
async _featureSetCollectionFromMap(map) {
|
|
1166
|
+
// Make sure the map is loaded
|
|
1167
|
+
await map.loadAll();
|
|
1168
|
+
// Until jsapi fix a bug we have to load the table separately
|
|
1169
|
+
await Promise.all(map.tables.map(async (t) => (await t.load())));
|
|
1170
|
+
return {
|
|
1171
|
+
layers: this._convertWebMapLayersToVariables(map.layers),
|
|
1172
|
+
tables: this._convertWebMapLayersToVariables(map.tables, true),
|
|
1173
|
+
source: map
|
|
1174
|
+
};
|
|
1097
1175
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1176
|
+
async _featureSetCollectionFromPortalItem(definition) {
|
|
1177
|
+
const portalItem = await newPortalPortalItem(definition);
|
|
1178
|
+
await portalItem.load();
|
|
1179
|
+
switch (portalItem.type) {
|
|
1180
|
+
case "Web Map": {
|
|
1181
|
+
const webMap = await newWebMap({ portalItem });
|
|
1182
|
+
return await this._featureSetCollectionFromMap(webMap);
|
|
1183
|
+
}
|
|
1184
|
+
case "Web Scene": {
|
|
1185
|
+
const webScene = await newWebScene({ portalItem });
|
|
1186
|
+
return await this._featureSetCollectionFromMap(webScene);
|
|
1187
|
+
}
|
|
1188
|
+
case "Feature Service":
|
|
1189
|
+
return await this._featureSetCollectionFromUrl(portalItem.url);
|
|
1190
|
+
default:
|
|
1191
|
+
console.error("Unsupported portal item", definition);
|
|
1192
|
+
return null;
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
async _featureSetCollectionFromUrl(url) {
|
|
1196
|
+
let processedUrl = url.replace(/\/featureserver\/[0-9]*/iu, "/FeatureServer");
|
|
1197
|
+
processedUrl = processedUrl.replace(/\/mapserver\/[0-9]*/iu, "/MapServer");
|
|
1198
|
+
processedUrl = processedUrl.split("?")[0];
|
|
1199
|
+
if (!processedUrl) {
|
|
1200
|
+
return null;
|
|
1201
|
+
}
|
|
1202
|
+
const metadata = await serviceMetaData(processedUrl);
|
|
1203
|
+
const layersPromise = Promise.all(metadata.layers.map(async (layerInfo) => {
|
|
1204
|
+
const featureLayer = await newFeatureLayer({ url: `${processedUrl}/${layerInfo.id}` });
|
|
1205
|
+
await featureLayer.load();
|
|
1206
|
+
return this._createFeatureSetVariable(featureLayer);
|
|
1207
|
+
}));
|
|
1208
|
+
const tablesPromise = Promise.all(metadata.tables.map(async (layerInfo) => {
|
|
1209
|
+
const table = await newFeatureLayer({ url: `${processedUrl}/${layerInfo.id}` });
|
|
1210
|
+
await table.load();
|
|
1211
|
+
return this._createFeatureSetVariable(table);
|
|
1212
|
+
}));
|
|
1213
|
+
const [layers, tables] = await Promise.all([layersPromise, tablesPromise]);
|
|
1214
|
+
return { layers, tables, source: processedUrl };
|
|
1215
|
+
}
|
|
1216
|
+
_convertWebMapLayersToVariables(layers, filteringTables = false) {
|
|
1217
|
+
const layerVariables = [];
|
|
1218
|
+
layers
|
|
1219
|
+
.toArray()
|
|
1220
|
+
.reverse()
|
|
1221
|
+
.forEach((layer) => {
|
|
1222
|
+
if (isQueryableLayerInstance(layer)) {
|
|
1223
|
+
layerVariables.push(this._createFeatureSetVariable(layer, true));
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
if (isGroupLayerInstance(layer)) {
|
|
1227
|
+
const groupLayerVariables = filteringTables
|
|
1228
|
+
? this._convertWebMapLayersToVariables(layer.allTables, true)
|
|
1229
|
+
: this._convertWebMapLayersToVariables(layer.allLayers);
|
|
1230
|
+
layerVariables.push(...groupLayerVariables);
|
|
1231
|
+
}
|
|
1232
|
+
});
|
|
1233
|
+
return layerVariables;
|
|
1234
|
+
}
|
|
1235
|
+
_createFeatureSetVariable(featureLayer, isFromWebMap = false) {
|
|
1236
|
+
return new FeatureSetVariable(this, {
|
|
1237
|
+
profile: this._profile,
|
|
1238
|
+
declaration: { name: featureLayer.title, definition: featureLayer },
|
|
1239
|
+
label: featureLayer.title,
|
|
1240
|
+
description: "",
|
|
1241
|
+
nonInteractive: true
|
|
1242
|
+
}, this._makeFeatureSetSnippets(featureLayer, isFromWebMap));
|
|
1243
|
+
}
|
|
1244
|
+
_makeFeatureSetSnippets(featureLayer, isFromWebMap = false) {
|
|
1245
|
+
if (!this._profile?.supportFeatureSetFunctions) {
|
|
1246
|
+
return [];
|
|
1247
|
+
}
|
|
1248
|
+
if (isFromWebMap) {
|
|
1249
|
+
const snippetById = `FeatureSetById(${this.snippet}, "${featureLayer.id}")`;
|
|
1250
|
+
const snippetByName = `FeatureSetByName(${this.snippet}, "${featureLayer.title}")`;
|
|
1251
|
+
return [
|
|
1252
|
+
new ValueVariable({ profile: this._profile, label: snippetById, description: "", snippet: snippetById }),
|
|
1253
|
+
new ValueVariable({ profile: this._profile, label: snippetByName, description: "", snippet: snippetByName })
|
|
1254
|
+
];
|
|
1255
|
+
}
|
|
1256
|
+
else {
|
|
1257
|
+
const snippetById = `FeatureSetById(${this.snippet}, "${featureLayer.layerId}")`;
|
|
1258
|
+
return [new ValueVariable({ profile: this._profile, label: snippetById, description: "", snippet: snippetById })];
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
toProfileVariableDefinition() {
|
|
1262
|
+
return { type: this.type, name: "", ...this.declaration, definition: this._definition };
|
|
1101
1263
|
}
|
|
1102
|
-
}
|
|
1103
|
-
toProfileVariableDefinition() {
|
|
1104
|
-
return { type: this.type, name: "", ...this.declaration, definition: this._definition };
|
|
1105
|
-
}
|
|
1106
1264
|
}
|
|
1107
1265
|
/**
|
|
1108
1266
|
* The EditorProfile is an object that represents an Arcade Profile.
|
|
@@ -1113,64 +1271,64 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
|
|
|
1113
1271
|
* They need to be loaded asynchronously to get the metadata necessary for validation and completion.
|
|
1114
1272
|
*/
|
|
1115
1273
|
class EditorProfile extends DictionaryVariable {
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1274
|
+
constructor(definition, intlStrings, locale = "en") {
|
|
1275
|
+
// Delay the load of the variable declarations so we have a `this`
|
|
1276
|
+
super(undefined, {
|
|
1277
|
+
profile: null,
|
|
1278
|
+
declaration: { properties: [] }
|
|
1279
|
+
});
|
|
1280
|
+
this.definition = definition;
|
|
1281
|
+
this.intlStrings = intlStrings;
|
|
1282
|
+
this.locale = locale;
|
|
1283
|
+
this.variables = [];
|
|
1284
|
+
// We are the root
|
|
1285
|
+
this._profile = this;
|
|
1286
|
+
// Now that `this` is defined, we can load the variables
|
|
1287
|
+
this.loadPropertyDeclarations(definition?.variables);
|
|
1288
|
+
}
|
|
1289
|
+
/**
|
|
1290
|
+
* Returns true if the profile supports feature set functions for snippets.
|
|
1291
|
+
*/
|
|
1292
|
+
get supportFeatureSetFunctions() {
|
|
1293
|
+
return this.definition?.bundles?.includes("data-access") ?? false;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Returns the language service profile. It is different than the editor profile as it is optimized for Monaco.
|
|
1297
|
+
*/
|
|
1298
|
+
async toLSProfile() {
|
|
1299
|
+
const { apiVersion, bundles, hiddenApiItems } = this.definition ?? {};
|
|
1300
|
+
const variables = await variablesToLSVariable(this.dictionaryVariables);
|
|
1301
|
+
return { apiVersion, bundles, variables, hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()) };
|
|
1302
|
+
}
|
|
1303
|
+
/**
|
|
1304
|
+
* Returns the EditorProfile as a json. The EditorProfile may have been updated. This function allows to
|
|
1305
|
+
* get the new json representing mutations.
|
|
1306
|
+
*/
|
|
1307
|
+
toEditorProfileDefinition() {
|
|
1308
|
+
return {
|
|
1309
|
+
...this.definition,
|
|
1310
|
+
variables: this.dictionaryVariables.map((variable) => variable.toProfileVariableDefinition())
|
|
1311
|
+
};
|
|
1312
|
+
}
|
|
1155
1313
|
}
|
|
1156
1314
|
//#endregion
|
|
1157
1315
|
|
|
1158
1316
|
function isFeatureDefinition(item) {
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1317
|
+
return (isSupportedLayerInstance(item) ||
|
|
1318
|
+
isFeatureSetInstance(item) ||
|
|
1319
|
+
isUrlDefinition(item) ||
|
|
1320
|
+
isFieldsDefinition(item) ||
|
|
1321
|
+
isFeatureLayerItemDefinition(item));
|
|
1164
1322
|
}
|
|
1165
1323
|
function isFeatureSetDefinition(item) {
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1324
|
+
return (isQueryableLayerInstance(item) ||
|
|
1325
|
+
isFeatureSetInstance(item) ||
|
|
1326
|
+
isUrlDefinition(item) ||
|
|
1327
|
+
isFieldsDefinition(item) ||
|
|
1328
|
+
isFeatureLayerItemDefinition(item));
|
|
1171
1329
|
}
|
|
1172
1330
|
function isFeatureSetCollectionDefinition(item) {
|
|
1173
|
-
|
|
1331
|
+
return isPortalItemDefinition(item) || isMapInstance(item) || isFeatureSetDefinition(item);
|
|
1174
1332
|
}
|
|
1175
1333
|
/**
|
|
1176
1334
|
* Get a PredefinedProfile for a locale. If not already loaded then fetch it.
|
|
@@ -1178,26 +1336,26 @@ function isFeatureSetCollectionDefinition(item) {
|
|
|
1178
1336
|
* the english version of the profile.
|
|
1179
1337
|
*/
|
|
1180
1338
|
async function getSdkPredefinedProfiles(locale = "en") {
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1339
|
+
const profiles = sdkPredefinedProfilesMap.get(locale);
|
|
1340
|
+
if (profiles) {
|
|
1341
|
+
return profiles;
|
|
1342
|
+
}
|
|
1343
|
+
if (!E.has(locale)) {
|
|
1344
|
+
return await getSdkPredefinedProfiles("en");
|
|
1345
|
+
}
|
|
1346
|
+
try {
|
|
1347
|
+
const response = await fetch(getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
|
|
1348
|
+
if (response.ok) {
|
|
1349
|
+
return cacheSdkPredefinedProfiles(locale, (await response.json()));
|
|
1350
|
+
}
|
|
1351
|
+
if (locale === "en") {
|
|
1352
|
+
return null;
|
|
1353
|
+
}
|
|
1354
|
+
return await getSdkPredefinedProfiles("en");
|
|
1355
|
+
}
|
|
1356
|
+
catch {
|
|
1357
|
+
return null;
|
|
1358
|
+
}
|
|
1201
1359
|
}
|
|
1202
1360
|
const sdkPredefinedProfilesMap = new Map();
|
|
1203
1361
|
/**
|
|
@@ -1205,237 +1363,234 @@ const sdkPredefinedProfilesMap = new Map();
|
|
|
1205
1363
|
* Map of profiles per locale.
|
|
1206
1364
|
*/
|
|
1207
1365
|
function cacheSdkPredefinedProfiles(locale, profiles) {
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1366
|
+
const map = new Map();
|
|
1367
|
+
profiles.forEach((profile) => {
|
|
1368
|
+
map.set(profile.id, profile);
|
|
1369
|
+
});
|
|
1370
|
+
sdkPredefinedProfilesMap.set(locale, map);
|
|
1371
|
+
return map;
|
|
1214
1372
|
}
|
|
1215
1373
|
async function getSdkPredefinedProfile(id, locale = "en") {
|
|
1216
|
-
|
|
1217
|
-
|
|
1374
|
+
const profiles = await getSdkPredefinedProfiles(locale);
|
|
1375
|
+
return profiles?.get(id) ?? null;
|
|
1218
1376
|
}
|
|
1219
|
-
function isExtendedPredefinedProfileDefinition(
|
|
1220
|
-
|
|
1377
|
+
function isExtendedPredefinedProfileDefinition(item) {
|
|
1378
|
+
return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
|
|
1221
1379
|
}
|
|
1222
1380
|
function convertApiVariables(variables) {
|
|
1223
|
-
|
|
1224
|
-
return [];
|
|
1225
|
-
}
|
|
1226
|
-
return variables.map(convertApiVariable);
|
|
1381
|
+
return variables.map(convertApiVariable);
|
|
1227
1382
|
}
|
|
1228
1383
|
function convertApiVariable(variable) {
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1384
|
+
switch (variable.type) {
|
|
1385
|
+
case "dictionary":
|
|
1386
|
+
return {
|
|
1387
|
+
...variable,
|
|
1388
|
+
type: variable.type,
|
|
1389
|
+
properties: convertApiVariables(variable.properties)
|
|
1390
|
+
};
|
|
1391
|
+
case "array": {
|
|
1392
|
+
return {
|
|
1393
|
+
...variable,
|
|
1394
|
+
type: variable.type,
|
|
1395
|
+
elementType: { type: "number", name: "number" }
|
|
1396
|
+
};
|
|
1397
|
+
}
|
|
1398
|
+
default:
|
|
1399
|
+
return { ...variable, type: variable.type };
|
|
1400
|
+
}
|
|
1246
1401
|
}
|
|
1247
1402
|
async function convertToEditorProfileDefinition(predefinedProfile, locale = "en") {
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1403
|
+
if (!isPredefinedProfile(predefinedProfile)) {
|
|
1404
|
+
return undefined;
|
|
1405
|
+
}
|
|
1406
|
+
const sdkPredefinedProfile = await getSdkPredefinedProfile(predefinedProfile.id, locale);
|
|
1407
|
+
if (!sdkPredefinedProfile) {
|
|
1408
|
+
return undefined;
|
|
1409
|
+
}
|
|
1410
|
+
const editorProfile = {
|
|
1411
|
+
bundles: [...sdkPredefinedProfile.bundles],
|
|
1412
|
+
variables: [],
|
|
1413
|
+
hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase())
|
|
1414
|
+
};
|
|
1415
|
+
// Merge the SDK variables' definitions/properties with the predefined profile definitions.
|
|
1416
|
+
sdkPredefinedProfile.variables.forEach((sdkVariable) => {
|
|
1417
|
+
// Don't include disabled variables
|
|
1418
|
+
if (predefinedProfile.disabledVariables?.includes(sdkVariable.name)) {
|
|
1419
|
+
return;
|
|
1420
|
+
}
|
|
1421
|
+
// Try to get a definition from the predefined profile.
|
|
1422
|
+
const definition = predefinedProfile.definitions[sdkVariable.name];
|
|
1423
|
+
// Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
|
|
1424
|
+
// despite the type checking from the switch statement.
|
|
1425
|
+
switch (sdkVariable.type) {
|
|
1426
|
+
case "dictionary":
|
|
1427
|
+
// For dictionary, we support properties overrride
|
|
1428
|
+
return editorProfile.variables.push(convertApiVariable({
|
|
1429
|
+
...sdkVariable,
|
|
1430
|
+
type: sdkVariable.type,
|
|
1431
|
+
properties: Array.isArray(definition) ? [...definition] : sdkVariable.properties
|
|
1432
|
+
}));
|
|
1433
|
+
case "feature":
|
|
1434
|
+
if (isFeatureDefinition(definition)) {
|
|
1435
|
+
return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type, definition });
|
|
1436
|
+
}
|
|
1437
|
+
return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type });
|
|
1438
|
+
case "featureSet":
|
|
1439
|
+
if (isFeatureSetDefinition(definition)) {
|
|
1440
|
+
return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type, definition });
|
|
1441
|
+
}
|
|
1442
|
+
return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type });
|
|
1443
|
+
case "featureSetCollection":
|
|
1444
|
+
if (isFeatureSetCollectionDefinition(definition)) {
|
|
1445
|
+
return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type, definition });
|
|
1446
|
+
}
|
|
1447
|
+
return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type });
|
|
1448
|
+
default:
|
|
1449
|
+
return editorProfile.variables.push(convertApiVariable(sdkVariable));
|
|
1450
|
+
}
|
|
1451
|
+
});
|
|
1452
|
+
if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
|
|
1453
|
+
editorProfile.variables.push(...(predefinedProfile.additionalVariables ?? []));
|
|
1454
|
+
}
|
|
1455
|
+
return editorProfile;
|
|
1301
1456
|
}
|
|
1302
1457
|
|
|
1303
1458
|
const arcadeLanguageId = "arcade";
|
|
1304
1459
|
const defaultContext = {
|
|
1305
|
-
|
|
1460
|
+
locale: "en"
|
|
1306
1461
|
};
|
|
1307
1462
|
class ArcadeLanguageServiceDefaults {
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1463
|
+
constructor() {
|
|
1464
|
+
this._languageId = arcadeLanguageId;
|
|
1465
|
+
this._languageOptions = {};
|
|
1466
|
+
this._onDidChange = new Emitter();
|
|
1467
|
+
this._profileMap = new Map();
|
|
1468
|
+
this._apiContextMap = new Map();
|
|
1469
|
+
this._onModelContextDidChange = new Emitter();
|
|
1470
|
+
this._onDidModelContextChangeTimeout = -1;
|
|
1471
|
+
}
|
|
1472
|
+
get onDidChange() {
|
|
1473
|
+
return this._onDidChange.event;
|
|
1474
|
+
}
|
|
1475
|
+
get onModelContextDidChange() {
|
|
1476
|
+
return this._onModelContextDidChange.event;
|
|
1477
|
+
}
|
|
1478
|
+
get languageId() {
|
|
1479
|
+
return this._languageId;
|
|
1480
|
+
}
|
|
1481
|
+
get languageOptions() {
|
|
1482
|
+
return this._languageOptions;
|
|
1483
|
+
}
|
|
1484
|
+
_fireModelContextDidChange(key) {
|
|
1485
|
+
if (this._onDidModelContextChangeTimeout !== -1) {
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
this._onDidModelContextChangeTimeout = window.setTimeout(() => {
|
|
1489
|
+
this._onDidModelContextChangeTimeout = -1;
|
|
1490
|
+
this._onModelContextDidChange.fire(key);
|
|
1491
|
+
}, 0);
|
|
1492
|
+
}
|
|
1493
|
+
_getApiKey(modelId) {
|
|
1494
|
+
if (!Uri.isUri(modelId)) {
|
|
1495
|
+
modelId = Uri.parse(modelId);
|
|
1496
|
+
}
|
|
1497
|
+
return modelId.toString();
|
|
1498
|
+
}
|
|
1499
|
+
/**
|
|
1500
|
+
* Create an EditorProfile for the given model id using the given definition and locale.
|
|
1501
|
+
* The EditorProfile is used by the the Arcade Language service as well by the cosing components.
|
|
1502
|
+
* The definition can be a pre-defined profile or an editor profile definition.
|
|
1503
|
+
* If the locale is not provided then the 'en' locale is used.
|
|
1504
|
+
* @param modelId The model id for which to create the context.
|
|
1505
|
+
* @param definition The definition to use for the model context.
|
|
1506
|
+
* @param locale The locale to use for the model context.
|
|
1507
|
+
* @returns The EditorProfile for the model.
|
|
1508
|
+
*/
|
|
1509
|
+
async setProfileForModel(modelId, definition, apiContext = { locale: "en" }) {
|
|
1510
|
+
// Convert pre-defined profile to a runtime profile
|
|
1511
|
+
if (isPredefinedProfile(definition)) {
|
|
1512
|
+
definition = await convertToEditorProfileDefinition(definition, apiContext.locale);
|
|
1513
|
+
}
|
|
1514
|
+
const intlStrings = await N(apiContext.locale, getAssetPath("./assets/arcade-language/t9n"), "profile.t9n.");
|
|
1515
|
+
if (!intlStrings) {
|
|
1516
|
+
throw new Error(`Failed to load the language bundle for ${apiContext.locale}`);
|
|
1517
|
+
}
|
|
1518
|
+
this.disposeEditorProfileForModel(modelId);
|
|
1519
|
+
const key = this._getApiKey(modelId);
|
|
1520
|
+
const editorProfile = new EditorProfile(definition, intlStrings);
|
|
1521
|
+
this._profileMap.set(key, editorProfile);
|
|
1522
|
+
const apiProfile = await editorProfile.toLSProfile();
|
|
1523
|
+
this.updateApiContextForModel(modelId, {
|
|
1524
|
+
locale: apiContext.locale,
|
|
1525
|
+
profile: apiProfile,
|
|
1526
|
+
snippets: apiContext.snippets
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
/**
|
|
1530
|
+
* Dispose the editor profile for the given model id.
|
|
1531
|
+
* It is the responsibility of the caller that created the editor profile to dispose it.
|
|
1532
|
+
* @param modelId The model id for which to dispose the editor profile.
|
|
1533
|
+
*/
|
|
1534
|
+
disposeEditorProfileForModel(modelId) {
|
|
1535
|
+
const key = this._getApiKey(modelId);
|
|
1536
|
+
this._profileMap.delete(key);
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* Dispose the api context for the given model id.
|
|
1540
|
+
* @param modelId The model id for which to dispose the api context.
|
|
1541
|
+
*/
|
|
1542
|
+
disposeApiContextForModel(modelId) {
|
|
1543
|
+
const key = this._getApiKey(modelId);
|
|
1544
|
+
if (this._apiContextMap.delete(key)) {
|
|
1545
|
+
this._fireModelContextDidChange(key);
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
/**
|
|
1549
|
+
* Returns the editor profile for the given model id.
|
|
1550
|
+
* @param modelId The model id for which to get the editor profile.
|
|
1551
|
+
* @returns The editor profile for the model.
|
|
1552
|
+
*/
|
|
1553
|
+
getEditorProfileForModel(modelId) {
|
|
1554
|
+
return this._profileMap.get(this._getApiKey(modelId));
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* Returns the API context for the given model id.
|
|
1558
|
+
* Returns the default context if the model has no context.
|
|
1559
|
+
* @param modelId The model id for which to get the API context.
|
|
1560
|
+
* @returns The API context for the model.
|
|
1561
|
+
*/
|
|
1562
|
+
getApiContextForModel(contextId) {
|
|
1563
|
+
return this._apiContextMap.get(this._getApiKey(contextId)) ?? defaultContext;
|
|
1564
|
+
}
|
|
1565
|
+
/**
|
|
1566
|
+
* Set or update api context for the given model id.
|
|
1567
|
+
* @param modelId The model id for which to set the context.
|
|
1568
|
+
* @param apiContext The api context to set.
|
|
1569
|
+
*/
|
|
1570
|
+
updateApiContextForModel(modelId, apiContext) {
|
|
1571
|
+
const key = this._getApiKey(modelId);
|
|
1572
|
+
const currentApiContext = this._apiContextMap.get(key) ?? {};
|
|
1573
|
+
this._apiContextMap.set(key, { ...currentApiContext, ...apiContext });
|
|
1574
|
+
this._fireModelContextDidChange(key);
|
|
1575
|
+
}
|
|
1576
|
+
/**
|
|
1577
|
+
* Set or update the Arcade language service options.
|
|
1578
|
+
* @param languageOptions The language options to set.
|
|
1579
|
+
*/
|
|
1580
|
+
setLanguageOptions(languageOptions = {}) {
|
|
1581
|
+
// Check if options have actually changed.
|
|
1582
|
+
// Avoid restarting the worker when no updates.
|
|
1583
|
+
// Today we only have the 'assetsPath' as a property
|
|
1584
|
+
if (this._languageOptions.assetsPath === languageOptions.assetsPath) {
|
|
1585
|
+
return;
|
|
1586
|
+
}
|
|
1587
|
+
this._languageOptions = { ...this._languageOptions, ...languageOptions };
|
|
1588
|
+
this._onDidChange.fire(this);
|
|
1589
|
+
}
|
|
1435
1590
|
}
|
|
1436
1591
|
const arcadeDefaults = new ArcadeLanguageServiceDefaults();
|
|
1437
1592
|
const arcade = {
|
|
1438
|
-
|
|
1593
|
+
setProfileForModel: arcadeDefaults.setProfileForModel.bind(arcadeDefaults)
|
|
1439
1594
|
};
|
|
1440
1595
|
|
|
1441
1596
|
export { arcade as a, arcadeDefaults as b };
|