@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.
Files changed (404) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +6 -2
  3. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +6 -1
  4. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ar.json +8 -8
  5. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.bg.json +8 -8
  6. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.bs.json +8 -8
  7. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ca.json +8 -8
  8. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.cs.json +8 -8
  9. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.da.json +8 -8
  10. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.de.json +8 -8
  11. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.el.json +8 -8
  12. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.en.json +8 -8
  13. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.es.json +8 -8
  14. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.et.json +8 -8
  15. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.fi.json +8 -8
  16. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.fr.json +8 -8
  17. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.he.json +8 -8
  18. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.hr.json +8 -8
  19. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.hu.json +8 -8
  20. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.id.json +8 -8
  21. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.it.json +8 -8
  22. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ja.json +8 -8
  23. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ko.json +8 -8
  24. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.lt.json +8 -8
  25. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.lv.json +8 -8
  26. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.nb.json +8 -8
  27. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.nl.json +8 -8
  28. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.pl.json +8 -8
  29. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.pt-BR.json +8 -8
  30. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.pt-PT.json +8 -8
  31. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ro.json +8 -8
  32. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.ru.json +8 -8
  33. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.sk.json +8 -8
  34. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.sl.json +8 -8
  35. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.sr.json +8 -8
  36. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.sv.json +8 -8
  37. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.th.json +8 -8
  38. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.tr.json +8 -8
  39. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.uk.json +8 -8
  40. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.vi.json +8 -8
  41. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.zh-CN.json +8 -8
  42. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.zh-HK.json +8 -8
  43. package/dist/arcgis-coding-components/assets/arcade-api/t9n/arcade-api.t9n.zh-TW.json +8 -8
  44. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ar.json +8 -8
  45. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.bg.json +8 -8
  46. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.bs.json +8 -8
  47. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ca.json +8 -8
  48. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.cs.json +8 -8
  49. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.da.json +8 -8
  50. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.de.json +8 -8
  51. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.el.json +8 -8
  52. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.en.json +8 -8
  53. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.es.json +8 -8
  54. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.et.json +8 -8
  55. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.fi.json +8 -8
  56. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.fr.json +8 -8
  57. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.he.json +8 -8
  58. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.hr.json +8 -8
  59. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.hu.json +8 -8
  60. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.id.json +8 -8
  61. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.it.json +8 -8
  62. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ja.json +8 -8
  63. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ko.json +8 -8
  64. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.lt.json +8 -8
  65. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.lv.json +8 -8
  66. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.nb.json +8 -8
  67. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.nl.json +8 -8
  68. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.pl.json +8 -8
  69. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.pt-BR.json +8 -8
  70. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.pt-PT.json +8 -8
  71. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ro.json +8 -8
  72. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.ru.json +8 -8
  73. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.sk.json +8 -8
  74. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.sl.json +8 -8
  75. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.sr.json +8 -8
  76. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.sv.json +8 -8
  77. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.th.json +8 -8
  78. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.tr.json +8 -8
  79. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.uk.json +8 -8
  80. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.vi.json +8 -8
  81. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.zh-CN.json +8 -8
  82. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.zh-HK.json +8 -8
  83. package/dist/arcgis-coding-components/assets/arcade-editor/t9n/arcade-editor.t9n.zh-TW.json +8 -8
  84. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ar.json +492 -27
  85. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bg.json +492 -27
  86. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bs.json +492 -27
  87. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ca.json +492 -27
  88. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.cs.json +492 -27
  89. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.da.json +492 -27
  90. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.de.json +492 -27
  91. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.el.json +492 -27
  92. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.en.json +492 -27
  93. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.es.json +492 -27
  94. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.et.json +492 -27
  95. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fi.json +492 -27
  96. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fr.json +492 -27
  97. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.he.json +492 -27
  98. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hr.json +492 -27
  99. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hu.json +492 -27
  100. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.id.json +492 -27
  101. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.it.json +492 -27
  102. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ja.json +492 -27
  103. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ko.json +492 -27
  104. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lt.json +492 -27
  105. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lv.json +492 -27
  106. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nb.json +492 -27
  107. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nl.json +492 -27
  108. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pl.json +492 -27
  109. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-BR.json +492 -27
  110. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-PT.json +492 -27
  111. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ro.json +492 -27
  112. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ru.json +492 -27
  113. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sk.json +492 -27
  114. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sl.json +492 -27
  115. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sr.json +492 -27
  116. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sv.json +492 -27
  117. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.th.json +492 -27
  118. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.tr.json +492 -27
  119. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.uk.json +492 -27
  120. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.vi.json +492 -27
  121. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-CN.json +492 -27
  122. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-HK.json +492 -27
  123. package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-TW.json +492 -27
  124. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ar.json +14 -2
  125. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bg.json +14 -2
  126. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bs.json +14 -2
  127. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ca.json +14 -2
  128. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.cs.json +14 -2
  129. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.da.json +14 -2
  130. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.de.json +14 -2
  131. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.el.json +14 -2
  132. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.en.json +14 -2
  133. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.es.json +14 -2
  134. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.et.json +14 -2
  135. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fi.json +14 -2
  136. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fr.json +14 -2
  137. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.he.json +14 -2
  138. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hr.json +14 -2
  139. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hu.json +14 -2
  140. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.id.json +14 -2
  141. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.it.json +14 -2
  142. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ja.json +14 -2
  143. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ko.json +14 -2
  144. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lt.json +14 -2
  145. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lv.json +14 -2
  146. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nb.json +14 -2
  147. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nl.json +14 -2
  148. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pl.json +14 -2
  149. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-BR.json +14 -2
  150. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-PT.json +14 -2
  151. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ro.json +14 -2
  152. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ru.json +14 -2
  153. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sk.json +14 -2
  154. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sl.json +14 -2
  155. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sr.json +14 -2
  156. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sv.json +14 -2
  157. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.th.json +14 -2
  158. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.tr.json +14 -2
  159. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.uk.json +14 -2
  160. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.vi.json +14 -2
  161. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-CN.json +14 -2
  162. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-HK.json +14 -2
  163. package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-TW.json +14 -2
  164. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ar.json +13 -13
  165. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.bg.json +13 -13
  166. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.bs.json +13 -13
  167. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ca.json +13 -13
  168. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.cs.json +13 -13
  169. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.da.json +13 -13
  170. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.de.json +13 -13
  171. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.el.json +13 -13
  172. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.en.json +13 -13
  173. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.es.json +13 -13
  174. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.et.json +13 -13
  175. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.fi.json +13 -13
  176. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.fr.json +13 -13
  177. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.he.json +13 -13
  178. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.hr.json +13 -13
  179. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.hu.json +13 -13
  180. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.id.json +13 -13
  181. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.it.json +13 -13
  182. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ja.json +13 -13
  183. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ko.json +13 -13
  184. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.lt.json +13 -13
  185. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.lv.json +13 -13
  186. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.nb.json +13 -13
  187. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.nl.json +13 -13
  188. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.pl.json +13 -13
  189. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.pt-BR.json +13 -13
  190. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.pt-PT.json +13 -13
  191. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ro.json +13 -13
  192. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ru.json +13 -13
  193. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.sk.json +13 -13
  194. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.sl.json +13 -13
  195. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.sr.json +13 -13
  196. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.sv.json +13 -13
  197. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.th.json +13 -13
  198. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.tr.json +13 -13
  199. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.uk.json +13 -13
  200. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.vi.json +13 -13
  201. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.zh-CN.json +13 -13
  202. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.zh-HK.json +13 -13
  203. package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.zh-TW.json +13 -13
  204. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ar.json +6 -6
  205. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.bg.json +6 -6
  206. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.bs.json +6 -6
  207. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ca.json +6 -6
  208. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.cs.json +6 -6
  209. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.da.json +6 -6
  210. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.de.json +6 -6
  211. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.el.json +6 -6
  212. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.en.json +6 -6
  213. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.es.json +6 -6
  214. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.et.json +6 -6
  215. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.fi.json +6 -6
  216. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.fr.json +6 -6
  217. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.he.json +6 -6
  218. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.hr.json +6 -6
  219. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.hu.json +6 -6
  220. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.id.json +6 -6
  221. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.it.json +6 -6
  222. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ja.json +6 -6
  223. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ko.json +6 -6
  224. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.lt.json +6 -6
  225. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.lv.json +6 -6
  226. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.nb.json +6 -6
  227. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.nl.json +6 -6
  228. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.pl.json +6 -6
  229. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.pt-BR.json +6 -6
  230. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.pt-PT.json +6 -6
  231. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ro.json +6 -6
  232. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.ru.json +6 -6
  233. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.sk.json +6 -6
  234. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.sl.json +6 -6
  235. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.sr.json +6 -6
  236. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.sv.json +6 -6
  237. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.th.json +6 -6
  238. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.tr.json +6 -6
  239. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.uk.json +6 -6
  240. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.vi.json +6 -6
  241. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.zh-CN.json +6 -6
  242. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.zh-HK.json +6 -6
  243. package/dist/arcgis-coding-components/assets/arcade-suggestions/t9n/arcade-suggestions.t9n.zh-TW.json +6 -6
  244. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ar.json +8 -8
  245. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.bg.json +8 -8
  246. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.bs.json +8 -8
  247. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ca.json +8 -8
  248. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.cs.json +8 -8
  249. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.da.json +8 -8
  250. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.de.json +8 -8
  251. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.el.json +8 -8
  252. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.en.json +8 -8
  253. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.es.json +8 -8
  254. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.et.json +8 -8
  255. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.fi.json +8 -8
  256. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.fr.json +8 -8
  257. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.he.json +8 -8
  258. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.hr.json +8 -8
  259. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.hu.json +8 -8
  260. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.id.json +8 -8
  261. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.it.json +8 -8
  262. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ja.json +8 -8
  263. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ko.json +8 -8
  264. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.lt.json +8 -8
  265. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.lv.json +8 -8
  266. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.nb.json +8 -8
  267. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.nl.json +8 -8
  268. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.pl.json +8 -8
  269. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.pt-BR.json +8 -8
  270. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.pt-PT.json +8 -8
  271. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ro.json +8 -8
  272. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ru.json +8 -8
  273. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.sk.json +8 -8
  274. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.sl.json +8 -8
  275. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.sr.json +8 -8
  276. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.sv.json +8 -8
  277. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.th.json +8 -8
  278. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.tr.json +8 -8
  279. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.uk.json +8 -8
  280. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.vi.json +8 -8
  281. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.zh-CN.json +8 -8
  282. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.zh-HK.json +8 -8
  283. package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.zh-TW.json +8 -8
  284. package/dist/arcgis-coding-components/assets/code-editor/arcade.worker.js +30 -31
  285. package/dist/arcgis-coding-components/assets/code-editor/css.worker.js +30 -34
  286. package/dist/arcgis-coding-components/assets/code-editor/editor.worker.js +7 -8
  287. package/dist/arcgis-coding-components/assets/code-editor/html.worker.js +18 -20
  288. package/dist/arcgis-coding-components/assets/code-editor/json.worker.js +21 -22
  289. package/dist/arcgis-coding-components/assets/code-editor/ts.worker.js +79 -80
  290. package/dist/arcgis-coding-components/index.esm.js +6 -1
  291. package/dist/arcgis-coding-components/p-048612c6.js +7 -0
  292. package/dist/arcgis-coding-components/p-1d4f926f.js +6 -0
  293. package/dist/arcgis-coding-components/{p-443fe20e.js → p-4344b240.js} +7 -2
  294. package/dist/arcgis-coding-components/{p-9a164b63.js → p-43b95b3a.js} +8 -3
  295. package/dist/arcgis-coding-components/{p-cfff9500.js → p-5ca96f1c.js} +6 -1
  296. package/dist/arcgis-coding-components/{p-9dd33d3e.js → p-6f61a758.js} +7 -2
  297. package/dist/arcgis-coding-components/p-9c1279fa.js +68 -0
  298. package/dist/arcgis-coding-components/p-be21051e.entry.js +6 -0
  299. package/dist/arcgis-coding-components/{p-ff06e912.js → p-daef9c50.js} +7 -2
  300. package/dist/arcgis-coding-components/{p-b83db734.js → p-dfb57db2.js} +7 -2
  301. package/dist/arcgis-coding-components/{p-b3500466.js → p-e5c84ef0.js} +7 -2
  302. package/dist/arcgis-coding-components/{p-310f0408.js → p-e625cdc1.js} +7 -2
  303. package/dist/cjs/{arcade-defaults-e128d6d9.js → arcade-defaults-4a4ff48e.js} +13204 -11292
  304. package/dist/cjs/arcade-mode-e8a048dc.js +604 -0
  305. package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +1484 -1408
  306. package/dist/cjs/arcgis-coding-components.cjs.js +8 -3
  307. package/dist/cjs/{css-7229b372.js → css-66caa3cb.js} +6 -1
  308. package/dist/cjs/{cssMode-8c1d563a.js → cssMode-82651023.js} +8 -3
  309. package/dist/cjs/{html-ead03bbb.js → html-2c47fd86.js} +8 -3
  310. package/dist/cjs/{htmlMode-5e1a0115.js → htmlMode-9582a9b2.js} +8 -3
  311. package/dist/cjs/{index-f8a85eb8.js → index-7156ebfa.js} +395 -101
  312. package/dist/cjs/index.cjs.js +7 -2
  313. package/dist/cjs/{javascript-3fe2de06.js → javascript-f35b0dc5.js} +9 -4
  314. package/dist/cjs/{jsonMode-8b4b19f9.js → jsonMode-632b6048.js} +8 -3
  315. package/dist/cjs/loader.cjs.js +8 -12
  316. package/dist/cjs/{tsMode-b9491227.js → tsMode-c6f1ab1f.js} +8 -3
  317. package/dist/cjs/{typescript-524fddbc.js → typescript-9e1f35cb.js} +8 -3
  318. package/dist/components/arcade-api.js +170 -162
  319. package/dist/components/arcade-contribution.js +75 -65
  320. package/dist/components/arcade-defaults.js +1425 -1270
  321. package/dist/components/arcade-mode.js +521 -515
  322. package/dist/components/arcade-results.js +479 -426
  323. package/dist/components/arcade-suggestions.js +138 -131
  324. package/dist/components/arcade-variables.js +167 -153
  325. package/dist/components/arcgis-arcade-api.d.ts +2 -2
  326. package/dist/components/arcgis-arcade-api.js +5 -0
  327. package/dist/components/arcgis-arcade-editor.d.ts +2 -2
  328. package/dist/components/arcgis-arcade-editor.js +413 -387
  329. package/dist/components/arcgis-arcade-results.d.ts +2 -2
  330. package/dist/components/arcgis-arcade-results.js +5 -0
  331. package/dist/components/arcgis-arcade-suggestions.d.ts +2 -2
  332. package/dist/components/arcgis-arcade-suggestions.js +5 -0
  333. package/dist/components/arcgis-arcade-variables.d.ts +2 -2
  334. package/dist/components/arcgis-arcade-variables.js +5 -0
  335. package/dist/components/arcgis-code-editor.d.ts +2 -2
  336. package/dist/components/arcgis-code-editor.js +5 -0
  337. package/dist/components/code-editor.js +255 -250
  338. package/dist/components/fields.js +104 -77
  339. package/dist/components/functional-components.js +6 -1
  340. package/dist/components/index.d.ts +5 -8
  341. package/dist/components/index.js +6 -7
  342. package/dist/components/index2.js +7 -2
  343. package/dist/components/markdown.js +33 -28
  344. package/dist/components/utilities.js +26 -21
  345. package/dist/esm/{arcade-defaults-a34c2e51.js → arcade-defaults-0f350eac.js} +13196 -11284
  346. package/dist/esm/arcade-mode-e87281c6.js +600 -0
  347. package/dist/esm/arcgis-arcade-api_6.entry.js +1484 -1408
  348. package/dist/esm/arcgis-coding-components.js +9 -4
  349. package/dist/esm/{css-ff1e9f8c.js → css-368560db.js} +6 -1
  350. package/dist/esm/{cssMode-cb48c437.js → cssMode-9c59d807.js} +8 -3
  351. package/dist/esm/{html-e7c0bd60.js → html-1ffd663e.js} +8 -3
  352. package/dist/esm/{htmlMode-46638b7f.js → htmlMode-341ef75a.js} +8 -3
  353. package/dist/esm/{index-d4ec142a.js → index-585dc89e.js} +395 -101
  354. package/dist/esm/index.js +7 -2
  355. package/dist/esm/{javascript-2229cd63.js → javascript-91416769.js} +9 -4
  356. package/dist/esm/{jsonMode-08a2f0d2.js → jsonMode-ccf7e27b.js} +8 -3
  357. package/dist/esm/loader.js +8 -12
  358. package/dist/esm/{tsMode-46d0d8e8.js → tsMode-45a0fdf5.js} +8 -3
  359. package/dist/esm/{typescript-88a09694.js → typescript-7ab173c1.js} +8 -3
  360. package/dist/loader/cdn.js +5 -1
  361. package/dist/loader/index.cjs.js +5 -1
  362. package/dist/loader/index.d.ts +2 -2
  363. package/dist/loader/index.es2017.js +5 -1
  364. package/dist/loader/index.js +5 -1
  365. package/dist/types/components/arcade-api/arcade-api.d.ts +42 -41
  366. package/dist/types/components/arcade-api/t9n-types.d.ts +6 -6
  367. package/dist/types/components/arcade-editor/arcade-editor.d.ts +129 -133
  368. package/dist/types/components/arcade-editor/t9n-types.d.ts +6 -6
  369. package/dist/types/components/arcade-results/arcade-results.d.ts +46 -50
  370. package/dist/types/components/arcade-results/t9n-types.d.ts +11 -11
  371. package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +37 -36
  372. package/dist/types/components/arcade-suggestions/t9n-types.d.ts +4 -4
  373. package/dist/types/components/arcade-variables/arcade-variables.d.ts +42 -42
  374. package/dist/types/components/arcade-variables/t9n-types.d.ts +6 -6
  375. package/dist/types/components/code-editor/code-editor.d.ts +74 -74
  376. package/dist/types/components.d.ts +87 -12
  377. package/dist/types/index.d.ts +1 -1
  378. package/dist/types/stencil-public-runtime.d.ts +61 -17
  379. package/dist/types/utils/arcade-executor.d.ts +89 -81
  380. package/dist/types/utils/arcade-monaco/arcade-contribution.d.ts +1 -1
  381. package/dist/types/utils/arcade-monaco/arcade-defaults.d.ts +69 -68
  382. package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +27 -26
  383. package/dist/types/utils/arcade-monaco/arcade-mode.d.ts +10 -10
  384. package/dist/types/utils/arcade-monaco/arcade-theme.d.ts +9 -8
  385. package/dist/types/utils/arcade-monaco/arcade-worker-manager.d.ts +11 -11
  386. package/dist/types/utils/arcade-monaco/arcade.worker.d.ts +16 -14
  387. package/dist/types/utils/arcade-monaco/types.d.ts +31 -33
  388. package/dist/types/utils/colorize.d.ts +1 -1
  389. package/dist/types/utils/editor-suggestions.d.ts +24 -24
  390. package/dist/types/utils/fields.d.ts +1 -0
  391. package/dist/types/utils/functional-components.d.ts +2 -2
  392. package/dist/types/utils/markdown.d.ts +1 -1
  393. package/dist/types/utils/profile/editor-profile.d.ts +187 -196
  394. package/dist/types/utils/profile/types.d.ts +230 -109
  395. package/dist/types/utils/profile/utils.d.ts +31 -14
  396. package/dist/types/utils/utilities.d.ts +2 -2
  397. package/package.json +26 -42
  398. package/dist/arcgis-coding-components/p-0fa0a06d.js +0 -2
  399. package/dist/arcgis-coding-components/p-1b0246cd.entry.js +0 -1
  400. package/dist/arcgis-coding-components/p-236ce4a1.js +0 -62
  401. package/dist/arcgis-coding-components/p-3664ab2a.js +0 -1
  402. package/dist/cjs/arcade-mode-8bf7a14b.js +0 -598
  403. package/dist/esm/arcade-mode-c5a69066.js +0 -594
  404. 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 { CompletionItemKind, InsertTextMode, InsertTextFormat } from 'vscode-languageserver-types';
3
- import { i as importPortalPortalItem, a as importLayersFeatureLayer, b as importWebMap, s as supportedFields, c as importRequest, f as fieldTypeToIconName, d as fieldTypeToArcadeType } from './fields.js';
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 { Q, G, q, B, x, N } from './index2.js';
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
- async function newPortalItem(definition) {
9
- const PortalItem = await importPortalPortalItem();
10
- return new PortalItem(definition);
11
- }
13
+ //#region core adapter fix
12
14
  async function newFeatureLayer(definition) {
13
- const FeatureLayer = await importLayersFeatureLayer();
14
- // Fix title for the layer. Instead of defaulting to the map viewer style.
15
- return new FeatureLayer({ ...definition, sublayerTitleMode: "service-name" });
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
- return (!!item &&
23
- typeof item === "object" &&
24
- typeof item.declaredClass === "string" &&
25
- item.declaredClass.startsWith("esri.layers."));
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
- return (!!item &&
29
- typeof item === "object" &&
30
- typeof item.declaredClass === "string" &&
31
- item.declaredClass === "esri.rest.support.FeatureSet");
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 isFeatureLayerInstance(item) {
34
- return (!!item &&
35
- typeof item === "object" &&
36
- typeof item.declaredClass === "string" &&
37
- item.declaredClass === "esri.layers.FeatureLayer");
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
- return (!!item &&
41
- typeof item === "object" &&
42
- typeof item.declaredClass === "string" &&
43
- item.declaredClass === "esri.layers.GroupLayer");
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 isWebMapInstance(item) {
46
- return (!!item && typeof item === "object" && typeof item.declaredClass === "string" && item.declaredClass === "esri.WebMap");
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
- return !!item && typeof item === "object" && item.portalItem != null;
67
+ return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
50
68
  }
51
69
  function isFeatureLayerItemDefinition(item) {
52
- return !!item && typeof item === "object" && item.portalItem != null;
70
+ return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
53
71
  }
54
72
  function isFieldsDefinition(item) {
55
- return !!item && typeof item === "object" && Array.isArray(item.fields) && !("declaredClass" in item);
73
+ return (!!item && typeof item === "object" && "fields" in item && Array.isArray(item.fields) && !("declaredClass" in item));
56
74
  }
57
75
  function isUrlDefinition(item) {
58
- return !!item && typeof item === "object" && typeof item.url === "string" && !("declaredClass" in item);
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
- return (!!item &&
62
- typeof item === "object" &&
63
- typeof item.id === "string" &&
64
- typeof item.definitions === "object" &&
65
- !Array.isArray(item.definitions));
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
- function resolveIntlPath(dictionary, path) {
69
- if (!dictionary) {
70
- return "";
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 isTypesCapabaleLayer(item) {
83
- return !!item?.typeIdField;
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
- return typeof item?.getFieldDomain === "function";
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
- return Array.isArray(item?.relationships) && typeof item?.url === "string";
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
- return typeof item?.isTable === "boolean";
134
+ return !!item && typeof item === "object" && "isTable" in item && typeof item.isTable === "boolean";
93
135
  }
94
136
  function isLoadableSource(item) {
95
- return typeof item?.load === "function";
137
+ return !!item && typeof item === "object" && "load" in item && typeof item.load === "function";
96
138
  }
97
139
  //#endregion
98
- //#region Support Functions
99
- async function getRelatedFeatureLayer(layer, relationship) {
100
- if (!relationship) {
101
- return null;
102
- }
103
- const url = `${layer.url}/${relationship.relatedTableId}`;
104
- const relatedFeatureLayer = await supportedSourceFromDefinition({ url });
105
- if (!isFeatureLayerInstance(relatedFeatureLayer)) {
106
- return null;
107
- }
108
- return relatedFeatureLayer;
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 sortFields(layer) {
111
- return (firstField, secondField) => {
112
- if (firstField.type === "oid") {
113
- return -1;
114
- }
115
- if (secondField.type === "oid") {
116
- return 1;
117
- }
118
- if (isTypesCapabaleLayer(layer)) {
119
- if (firstField.name === layer.typeIdField) {
120
- return -1;
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 getSubtypesProperties(profile, types, field) {
130
- // Try the coded domain first
131
- const group = getDomainValuesProperties(profile, field.domain, { code: "subtypes" });
132
- if (group) {
133
- return group;
134
- }
135
- // No coded domain for the subtypes, we will manufacture it
136
- const values = types.map((t) => new ValueVariable({ profile, label: `${t.id}`, description: t.name, snippet: `"${t.id}"` }));
137
- return new GroupOfVariables(profile, { code: "subtypes" }, values);
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
- function getDomainValuesProperties(profile, domain, label) {
140
- if (!domain || domain.type !== "coded-value") {
141
- return null;
142
- }
143
- const values = domain.codedValues.map((v) => new ValueVariable({
144
- profile,
145
- label: `${v.code}`,
146
- description: v.name,
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 getDomainValuesBySubtypeGroup(profile, types, field) {
153
- const variables = [];
154
- types.forEach((t) => {
155
- let domain = t.domains?.[field.name];
156
- if (!domain) {
157
- return;
158
- }
159
- if (domain.type === "inherited") {
160
- domain = field.domain;
161
- return;
162
- }
163
- const domainValuesGroup = getDomainValuesProperties(profile, domain, {
164
- code: "domainvaluesfortypeformat",
165
- formatValues: {
166
- fieldName: field.alias ?? field.name,
167
- typeName: t.name
168
- }
169
- });
170
- if (!domainValuesGroup) {
171
- return;
172
- }
173
- const label = `${t.id}`;
174
- const snippet = `"${t.id}""`;
175
- const subtypeDictionary = new DictionaryVariable({ profile, label, snippet });
176
- subtypeDictionary.variables = [domainValuesGroup];
177
- variables.push(subtypeDictionary);
178
- });
179
- if (!variables.length) {
180
- return null;
181
- }
182
- return new GroupOfVariables(profile, { code: "domainvaluesbysubtypes" }, variables);
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 = new RegExp(/^[a-z_$][a-z0-9_$]*$/gi);
232
+ const validIdentifierExpr = /^[a-z_$][a-z0-9_$]*$/giu;
186
233
  function getMemberExpressionProperty(prop, includeDot = true) {
187
- if (prop.match(validIdentifierExpr)) {
188
- return `${includeDot ? "." : ""}${prop}`;
189
- }
190
- return `["${prop}"]`;
234
+ if (prop.match(validIdentifierExpr)) {
235
+ return `${includeDot ? "." : ""}${prop}`;
236
+ }
237
+ return `["${prop}"]`;
191
238
  }
192
239
  function assembleMemberExpression(obj, prop) {
193
- if (!obj) {
194
- return prop;
195
- }
196
- return `${obj}${getMemberExpressionProperty(prop)}`;
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 Functions to Editor Variables to a language service variables
246
+ //#region Editor Profile to Language Service Profile functions
253
247
  async function variablesToLSVariable(editorVariables, kind = CompletionItemKind.Variable) {
254
- if (!editorVariables) {
255
- return [];
256
- }
257
- const properties = await Promise.all(editorVariables.map(async (editorVariable) => {
258
- switch (editorVariable.type) {
259
- case "dictionary":
260
- return dictionaryToLSDictionary(editorVariable, kind);
261
- case "feature":
262
- return featureToLSFeature(editorVariable, kind);
263
- default:
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
- const { name, type } = editorVariable;
271
- const description = editorVariable.getDescription();
272
- return {
273
- name,
274
- description,
275
- type,
276
- completion: {
277
- label: name,
278
- detail: name,
279
- insertText: name,
280
- insertTextMode: InsertTextMode.asIs,
281
- insertTextFormat: InsertTextFormat.PlainText,
282
- kind,
283
- documentation: { kind: "markdown", value: description }
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
- // Get the source for the definition
289
- const source = await editorFeature.loadSource();
290
- const { name } = editorFeature;
291
- const description = editorFeature.getDescription();
292
- const resultCompletion = {
293
- label: name,
294
- detail: name,
295
- insertText: name,
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: CompletionItemKind.Field,
342
- documentation: { kind: "markdown", value: fieldCompletionDescription }
343
- }
344
- });
345
- if (!field.alias || field.alias.toLowerCase() === field.name.toLowerCase()) {
346
- return;
347
- }
348
- // The property for the alias if different than the field name
349
- let aliasCompletionDescription = `**${field.alias}** \n${field.type}`;
350
- if (field.description) {
351
- aliasCompletionDescription += ` \n'${field.description}`;
352
- }
353
- aliasProfileValues.push({
354
- name: field.alias,
355
- description: field.name,
356
- type,
357
- completion: {
358
- label: field.alias,
359
- detail: field.name,
360
- insertText,
361
- insertTextMode: InsertTextMode.asIs,
362
- insertTextFormat: InsertTextFormat.PlainText,
363
- kind: CompletionItemKind.Field,
364
- documentation: { kind: "markdown", value: aliasCompletionDescription }
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
- result.properties = [...fieldProfileValues, ...aliasProfileValues];
369
- resultCompletion.documentation = { kind: "markdown", value: featureCompletionDescription };
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
- const { name, dictionaryVariables: variables } = editorDictionary;
374
- const description = editorDictionary.getDescription();
375
- const completionDescription = variables.reduce((previous, p) => {
376
- if (previous !== "") {
377
- previous += " \n \n";
378
- }
379
- previous += `**${p.name}** \n${p.type}`;
380
- const description = p.getDescription();
381
- if (description) {
382
- previous += ` \n${description}`;
383
- }
384
- return previous;
385
- }, description ?? "");
386
- return {
387
- name,
388
- description,
389
- type: "dictionary",
390
- properties: await variablesToLSVariable(variables, CompletionItemKind.Field),
391
- completion: {
392
- label: name,
393
- detail: name,
394
- insertText: name,
395
- insertTextMode: InsertTextMode.asIs,
396
- insertTextFormat: InsertTextFormat.PlainText,
397
- kind,
398
- documentation: { kind: "markdown", value: completionDescription }
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
- constructor(_profile, _label, description) {
409
- this._profile = _profile;
410
- this._label = _label;
411
- this.description = description;
412
- this.filterDescription = false;
413
- }
414
- /**
415
- * Returns the label string.
416
- */
417
- getLabel() {
418
- if (this._label == null) {
419
- return "";
420
- }
421
- if (typeof this._label === "string") {
422
- // Some of our variables can start with a $ sign.
423
- // If the component is under RTL, the string is messed up.
424
- // It is converted from $feature to feature$, This is not acceptable since the label
425
- // represents a variable name. We are adding in front of the $ sign a right to left mark.
426
- return q(this._label);
427
- }
428
- return B(this._profile?.intlStrings?.[this._label.code], this._label.formatValues);
429
- }
430
- /**
431
- * Returns the description string.
432
- */
433
- getDescription() {
434
- if (this.description == null) {
435
- return "";
436
- }
437
- if (typeof this.description === "string") {
438
- return this.description;
439
- }
440
- return B(this._profile?.intlStrings?.[this.description.code ?? ""], this.description.formatValues);
441
- }
442
- /**
443
- * Returns true if the item pass the filter test
444
- */
445
- passFilter(filterExpression) {
446
- if (!filterExpression) {
447
- return true;
448
- }
449
- if (filterExpression.test(this.getLabel())) {
450
- return true;
451
- }
452
- return this.filterDescription && filterExpression.test(this.getDescription());
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
- constructor(props) {
460
- super(props.profile, props.label, props.description ?? props.declaration?.description);
461
- this.declaration = props.declaration ?? {};
462
- this.name = props.declaration?.name ?? "";
463
- this.snippet = props.snippet || "";
464
- this.nonInteractive = props.nonInteractive ?? false;
465
- this.filterDescription = props.filterDescription ?? false;
466
- this.icon = props.icon;
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
- constructor(props) {
474
- super(props);
475
- this.type = "text";
476
- this.isCollection = false;
477
- this.type = props?.declaration?.type ?? "text";
478
- }
479
- getDescription() {
480
- if (this.description == null) {
481
- return resolveIntlPath(this._profile?.intlStrings, this.type.toLowerCase()) ?? "";
482
- }
483
- return super.getDescription();
484
- }
485
- toProfileVariableDefinition() {
486
- return { type: this.type, name: "", ...this.declaration };
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
- constructor(props) {
495
- super(props);
496
- this.type = "array";
497
- this.isCollection = false;
498
- this.elementType = props.declaration?.elementType ?? { type: "number", name: "number" };
499
- }
500
- getDescription() {
501
- if (this.description == null) {
502
- return resolveIntlPath(this._profile?.intlStrings, this.type.toLowerCase()) ?? "";
503
- }
504
- return super.getDescription();
505
- }
506
- toProfileVariableDefinition() {
507
- return { type: this.type, elementType: this.elementType, name: "", ...this.declaration };
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
- constructor(props) {
518
- super(props);
519
- this.isCollection = true;
520
- this._loaded = true;
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
- * The collection of items used to display the profile.
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
- this.variables = [];
527
- }
528
- /**
529
- * Returns true if the collection has been loaded
530
- */
531
- get loaded() {
532
- return this._loaded;
533
- }
534
- /**
535
- * Loads the items if the collection is asynchronous.
536
- * If the colleciton is synchronous then the function is a no-op.
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
- constructor(profile, label, variables = []) {
553
- super(profile, label);
554
- this.variables = variables;
555
- this.type = "group";
556
- this.isCollection = true;
557
- }
558
- passFilter() {
559
- return true;
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
- constructor(props) {
564
- super(props);
565
- this.type = "dictionary";
566
- /**
567
- * The variables that the dictionary holds. It is different than the variables.
568
- * The variables may contain grouping.
569
- */
570
- this.dictionaryVariables = [];
571
- this.loadPropertyDeclarations(props?.declaration?.properties);
572
- // If we have a snippet then wrap the properties in a group and use the snippet as the heading
573
- // This is not applicable for root Dictionary such as Profile
574
- if (this.snippet && this.dictionaryVariables.length) {
575
- this.variables = [new GroupOfVariables(this._profile, this.snippet, this.dictionaryVariables)];
576
- }
577
- }
578
- loadPropertyDeclarations(declarations) {
579
- this.dictionaryVariables = this.createVariableInstances(declarations);
580
- this.variables = this.dictionaryVariables;
581
- }
582
- createVariableInstances(declarations) {
583
- if (!Array.isArray(declarations)) {
584
- return [];
585
- }
586
- const properties = [];
587
- declarations.forEach((declaration) => {
588
- const variable = this.createVariableInstance(declaration);
589
- if (variable) {
590
- properties.push(variable);
591
- }
592
- });
593
- return properties;
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
- default:
632
- console.error("Invalid profile variable", declaration);
633
- return null;
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
- constructor(props, relationshipsProperties) {
647
- super(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 this._source?.title ?? "";
655
- }
656
- get url() {
657
- return this._definition?.url ?? "";
658
- }
659
- get informationUrl() {
660
- if (!this.loaded) {
661
- return null;
662
- }
663
- const url = this._source?.url;
664
- if (!url) {
665
- return null;
666
- }
667
- const layerId = this._source?.layerId ?? "";
668
- return `${url}/${layerId}`;
669
- }
670
- get informationType() {
671
- return this._profile?.intlStrings?.layer ?? "layer";
672
- }
673
- loadSource() {
674
- if (Q(this._loadPromise) && G(this._loadPromise)) {
675
- return this._loadPromise;
676
- }
677
- this._loadPromise = this._loadSource();
678
- return this._loadPromise;
679
- }
680
- _getFieldProperty(field) {
681
- // Check if the field is the type id field or of the field has a coded domain.
682
- // If it has then the property will be an exanpdable property (dictionary).
683
- // Otherwise just return a simple value property.
684
- const subtypesOrDomainValuesDictionary = this._getSubtypesOrDomainValuesDictionary(field);
685
- if (subtypesOrDomainValuesDictionary) {
686
- return subtypesOrDomainValuesDictionary;
687
- }
688
- // Create the value property
689
- const valueSnippet = this.type === "feature" ? assembleMemberExpression(this.snippet, field.name) : field.name;
690
- return new ValueVariable({
691
- profile: this._profile,
692
- label: valueSnippet,
693
- description: field.alias ?? field.name,
694
- snippet: valueSnippet,
695
- icon: fieldTypeToIconName(field),
696
- filterDescription: true
697
- });
698
- }
699
- _getSubtypesOrDomainValuesDictionary(field) {
700
- if (!isDomainsCapableLayer(this._source)) {
701
- return null;
702
- }
703
- // Create the domain dictionary, we may not use it
704
- const valueSnippet = this.type === "feature" ? assembleMemberExpression(this.snippet, field.name) : field.name;
705
- const domainDictionary = new DictionaryVariable({
706
- profile: this._profile,
707
- label: valueSnippet,
708
- description: field.alias ?? field.name,
709
- snippet: valueSnippet,
710
- icon: "form-dropdown"
711
- });
712
- // Add the header group
713
- const headerGroup = new GroupOfVariables(this._profile, field.alias ?? field.name, [
714
- new ValueVariable({
715
- profile: this._profile,
716
- label: valueSnippet,
717
- description: "",
718
- snippet: valueSnippet
719
- })
720
- ]);
721
- domainDictionary.variables = [headerGroup];
722
- // If it is the subtype field then get its coded domain values
723
- if (isTypesCapabaleLayer(this._source) && field.name === this._source.typeIdField) {
724
- const subtypesGroup = getSubtypesProperties(this._profile, this._source.types, field);
725
- domainDictionary.variables.push(subtypesGroup);
726
- return domainDictionary;
727
- }
728
- // Since its' not the subtype field then add the snippet for the domain name
729
- if (this.type === "feature") {
730
- const domainNameSnippet = `DomainName(${this.snippet}, "${field.name}")`;
731
- headerGroup.variables.push(new ValueVariable({
732
- profile: this._profile,
733
- label: domainNameSnippet,
734
- description: "",
735
- snippet: domainNameSnippet
736
- }));
737
- }
738
- if (isTypesCapabaleLayer(this._source)) {
739
- // Check if all the domains for the field in the types are inherited.
740
- // If it is we can simplify the structure by avoiding splitting in subtypes
741
- const allInherited = this._source.types.every((t) => t.domains?.[field.name]?.type === "inherited");
742
- if (!allInherited) {
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 = getDomainValuesBySubtypeGroup(this._profile, this._source.types, field);
756
+ const domainValuesBySubtypeGroup = this._getDomainValuesGroup(this._source.subtypes, field);
746
757
  if (!domainValuesBySubtypeGroup) {
747
- return null;
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
- // Either we have types but all the domains are inherited or we don't have types
754
- const domainValuesGroup = getDomainValuesProperties(this._profile, this._source.getFieldDomain?.(field.name), {
755
- code: "domainvalues"
756
- });
757
- if (!domainValuesGroup) {
758
- return null;
759
- }
760
- domainDictionary.variables.push(domainValuesGroup);
761
- return domainDictionary;
762
- }
763
- async _getRelationshipsProperty() {
764
- // We need the data store to find the relationship feature layers
765
- if (!this.relationshipsProperties?.exposeRelationships || !this._profile?.supportFeatureSetFunctions) {
766
- return null;
767
- }
768
- const source = this._source;
769
- if (!isRelationshipsCapableLayer(source)) {
770
- return null;
771
- }
772
- const relationshipsGroup = new GroupOfVariables(this._profile, { code: "relationships" });
773
- const relationshipItems = await Promise.all(source.relationships.map(async (relationship) => {
774
- const relatedLayer = await getRelatedFeatureLayer(source, relationship);
775
- if (!isFeatureLayerInstance(relatedLayer)) {
776
- return null;
777
- }
778
- if (relationship.relatedTableId === this.relationshipsProperties?.sourceTableId) {
779
- // We don't want to show the reverse relationship
780
- return null;
781
- }
782
- const snippet = `FeatureSetByRelationshipName(${this.snippet}, "${relationship.name}")`;
783
- return new FeatureSetVariable({
784
- profile: this._profile,
785
- declaration: { definition: relatedLayer },
786
- label: relatedLayer.title,
787
- description: "",
788
- nonInteractive: true
789
- }, [new ValueVariable({ profile: this._profile, label: snippet, description: "", snippet })], { exposeRelationships: true, sourceTableId: source.layerId });
790
- }));
791
- relationshipsGroup.variables = relationshipItems.filter(Q);
792
- if (!relationshipsGroup.variables.length) {
793
- return null;
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
- constructor(props) {
800
- super(props, { exposeRelationships: true });
801
- this.type = "feature";
802
- }
803
- get title() {
804
- if (isSupportedLayerInstance(this._source)) {
805
- return this._source.title;
806
- }
807
- return { code: "feature" };
808
- }
809
- async _loadSource() {
810
- if (this.loaded) {
811
- return this._source;
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
- constructor(props, featureSetSnippets = [],
869
- // Relationships for feature set if only supported if the feature set is actually
870
- // representing a relationsip feature layer for a feature source.
871
- relationshipProps) {
872
- super(props, relationshipProps);
873
- this.featureSetSnippets = featureSetSnippets;
874
- this.type = "featureSet";
875
- }
876
- get title() {
877
- if (isSupportedLayerInstance(this._source)) {
878
- return this._source.title;
879
- }
880
- return { code: "featureset" };
881
- }
882
- async _loadSource() {
883
- if (this.loaded) {
884
- return this._source;
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
- constructor(props) {
920
- super(props);
921
- this.type = "featureSetCollection";
922
- this._featureSetCollections = null;
923
- this._loaded = false;
924
- this._definition = props?.declaration?.definition;
925
- }
926
- get informationUrl() {
927
- if (!this.loaded || !this._featureSetCollections) {
928
- return null;
929
- }
930
- if (typeof this._featureSetCollections.source !== "string") {
931
- return portalItemPageUrl(this._featureSetCollections.source.portalItem);
932
- }
933
- // const firstLayer = this._featureSetCollection.layers[0] ?? this._featureSetCollection.tables[0];
934
- // if (!firstLayer) {
935
- return null;
936
- // }
937
- // return `${firstLayer.url}`;
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
- try {
960
- this._featureSetCollections = await this._featureSetCollectionsFromDefinition();
961
- if (!this._featureSetCollections) {
962
- throw new Error("Invalid definition");
963
- }
964
- // Create the group for the header
965
- const groupLabel = typeof this._featureSetCollections.source === "string"
966
- ? { code: this._featureSetCollections.source.endsWith("FeatureServer") ? "featureservice" : "mapservice" }
967
- : {
968
- code: "webmapformat",
969
- formatValues: {
970
- webMapTitle: this._featureSetCollections.source.portalItem?.title ?? "Untitled map"
971
- }
972
- };
973
- const headerGroup = new GroupOfVariables(this._profile, groupLabel, [
974
- new ValueVariable({
975
- profile: this._profile,
976
- label: this.snippet,
977
- description: "",
978
- snippet: this.snippet
979
- })
980
- ]);
981
- // Creates the groups for the layer and tables
982
- const layersGroup = new GroupOfVariables(this._profile, { code: "layers" }, this._featureSetCollections.layers);
983
- const tablesGroup = new GroupOfVariables(this._profile, { code: "tables" }, this._featureSetCollections.tables);
984
- this.variables.push(headerGroup, layersGroup, tablesGroup);
985
- }
986
- catch (e) {
987
- console.error("Loading issue", e, this);
988
- this._featureSetCollections = null;
989
- }
990
- finally {
991
- this._loaded = true;
992
- }
993
- return this._featureSetCollections;
994
- }
995
- async _featureSetCollectionsFromDefinition() {
996
- if (!this._definition) {
997
- return null;
998
- }
999
- if (isWebMapInstance(this._definition)) {
1000
- return this._featureSetCollectionFromWebMap(this._definition);
1001
- }
1002
- if (isSupportedLayerInstance(this._definition)) {
1003
- return this._featureSetCollectionFromUrl(this._definition.url);
1004
- }
1005
- if (isPortalItemDefinition(this._definition)) {
1006
- // Preload the portal item so we can discover if are dealing with a Web Map
1007
- // or Feature Service
1008
- return this._featureSetCollectionFromPortalItem(this._definition.portalItem);
1009
- }
1010
- if (isUrlDefinition(this._definition)) {
1011
- // Assume that the url is pointing to a feature server
1012
- return this._featureSetCollectionFromUrl(this._definition.url);
1013
- }
1014
- return null;
1015
- }
1016
- async _featureSetCollectionFromWebMap(definition) {
1017
- const webMap = isWebMapInstance(definition) ? definition : await newWebMap({ portalItem: definition });
1018
- await webMap.loadAll();
1019
- // Until jsapi fix a bug we have to load the table separately
1020
- await Promise.all(webMap.tables.map(async (t) => t.load()));
1021
- return {
1022
- layers: this._convertWebMapLayersToVariables(webMap.layers),
1023
- tables: this._convertWebMapLayersToVariables(webMap.tables, true),
1024
- source: webMap
1025
- };
1026
- }
1027
- async _featureSetCollectionFromPortalItem(definition) {
1028
- const portalItem = await newPortalItem(definition);
1029
- await portalItem.load();
1030
- switch (portalItem.type) {
1031
- case "Web Map":
1032
- return this._featureSetCollectionFromWebMap(portalItem);
1033
- case "Feature Service":
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
- async _featureSetCollectionFromUrl(url) {
1041
- url = url.replace(/\/featureserver\/[0-9]*/i, "/FeatureServer");
1042
- url = url.replace(/\/mapserver\/[0-9]*/i, "/MapServer");
1043
- url = url.split("?")[0];
1044
- const metadata = await serviceMetaData(url);
1045
- const layersPromise = Promise.all(metadata.layers.map(async (layerInfo) => {
1046
- const fl = await newFeatureLayer({ url: `${url}/${layerInfo.id}` });
1047
- await fl.load();
1048
- return this._createFeatureSetVariable(fl);
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
- else {
1099
- const snippetById = `FeatureSetById(${this.snippet}, "${featureLayer.layerId}")`;
1100
- return [new ValueVariable({ profile: this._profile, label: snippetById, description: "", snippet: snippetById })];
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
- constructor(definition, intlStrings, locale = "en") {
1117
- // Delay the load of the variable declarations so we have a `this`
1118
- super({
1119
- profile: null,
1120
- declaration: { properties: [] }
1121
- });
1122
- this.definition = definition;
1123
- this.intlStrings = intlStrings;
1124
- this.locale = locale;
1125
- this.variables = [];
1126
- // We are the root
1127
- this._profile = this;
1128
- // Now that `this` is defined, we can load the variables
1129
- this.loadPropertyDeclarations(definition?.variables);
1130
- }
1131
- /**
1132
- * Returns true if the profile supports feature set functions for snippets.
1133
- */
1134
- get supportFeatureSetFunctions() {
1135
- return this.definition?.bundles?.includes("data-access") ?? false;
1136
- }
1137
- /**
1138
- * Returns the language service profile. It is different than the editor profile as it is optimized for Monaco.
1139
- */
1140
- async toLSProfile() {
1141
- const { apiVersion, bundles, hiddenApiItems } = this.definition ?? {};
1142
- const variables = await variablesToLSVariable(this.dictionaryVariables);
1143
- return { apiVersion, bundles, variables, hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()) };
1144
- }
1145
- /**
1146
- * Returns the EditorProfile as a json. The EditorProfile may have been updated. This function allows to
1147
- * get the new json representing mutations.
1148
- */
1149
- toEditorProfileDefinition() {
1150
- return {
1151
- ...this.definition,
1152
- variables: this.dictionaryVariables.map((variable) => variable.toProfileVariableDefinition())
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
- return (isSupportedLayerInstance(item) ||
1160
- isFeatureSetInstance(item) ||
1161
- isUrlDefinition(item) ||
1162
- isFieldsDefinition(item) ||
1163
- isFeatureLayerItemDefinition(item));
1317
+ return (isSupportedLayerInstance(item) ||
1318
+ isFeatureSetInstance(item) ||
1319
+ isUrlDefinition(item) ||
1320
+ isFieldsDefinition(item) ||
1321
+ isFeatureLayerItemDefinition(item));
1164
1322
  }
1165
1323
  function isFeatureSetDefinition(item) {
1166
- return (isFeatureLayerInstance(item) ||
1167
- isFeatureSetInstance(item) ||
1168
- isUrlDefinition(item) ||
1169
- isFieldsDefinition(item) ||
1170
- isFeatureLayerItemDefinition(item));
1324
+ return (isQueryableLayerInstance(item) ||
1325
+ isFeatureSetInstance(item) ||
1326
+ isUrlDefinition(item) ||
1327
+ isFieldsDefinition(item) ||
1328
+ isFeatureLayerItemDefinition(item));
1171
1329
  }
1172
1330
  function isFeatureSetCollectionDefinition(item) {
1173
- return isPortalItemDefinition(item) || isWebMapInstance(item) || isFeatureSetDefinition(item);
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
- const profiles = sdkPredefinedProfilesMap.get(locale);
1182
- if (profiles) {
1183
- return profiles;
1184
- }
1185
- if (!x.has(locale)) {
1186
- return getSdkPredefinedProfiles("en");
1187
- }
1188
- try {
1189
- const response = await fetch(getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
1190
- if (response.ok) {
1191
- return cacheSdkPredefinedProfiles(locale, await response.json());
1192
- }
1193
- if (locale === "en") {
1194
- return null;
1195
- }
1196
- return getSdkPredefinedProfiles("en");
1197
- }
1198
- catch (e) {
1199
- return null;
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
- const map = new Map();
1209
- profiles.forEach((profile) => {
1210
- map.set(profile.id, profile);
1211
- });
1212
- sdkPredefinedProfilesMap.set(locale, map);
1213
- return map;
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
- const profiles = await getSdkPredefinedProfiles(locale);
1217
- return profiles?.get(id) ?? null;
1374
+ const profiles = await getSdkPredefinedProfiles(locale);
1375
+ return profiles?.get(id) ?? null;
1218
1376
  }
1219
- function isExtendedPredefinedProfileDefinition(predefinedProfileDefinition) {
1220
- return Array.isArray(predefinedProfileDefinition?.additionalVariables);
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
- if (!variables) {
1224
- return [];
1225
- }
1226
- return variables.map(convertApiVariable);
1381
+ return variables.map(convertApiVariable);
1227
1382
  }
1228
1383
  function convertApiVariable(variable) {
1229
- switch (variable.type) {
1230
- case "dictionary":
1231
- return {
1232
- ...variable,
1233
- type: variable.type,
1234
- properties: convertApiVariables(variable.properties)
1235
- };
1236
- case "array": {
1237
- return {
1238
- ...variable,
1239
- type: variable.type,
1240
- elementType: { type: "number", name: "number" }
1241
- };
1242
- }
1243
- default:
1244
- return { ...variable, type: variable.type };
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
- if (!isPredefinedProfile(predefinedProfile)) {
1249
- return undefined;
1250
- }
1251
- const sdkPredefinedProfile = await getSdkPredefinedProfile(predefinedProfile.id, locale);
1252
- if (!sdkPredefinedProfile) {
1253
- return undefined;
1254
- }
1255
- const editorProfile = {
1256
- bundles: [...sdkPredefinedProfile.bundles],
1257
- variables: [],
1258
- hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase())
1259
- };
1260
- // Merge the SDK variables' definitions/properties with the predefined profile definitions.
1261
- sdkPredefinedProfile.variables.forEach((sdkVariable) => {
1262
- // Don't include disabled variables
1263
- if (predefinedProfile.disabledVariables?.includes(sdkVariable.name)) {
1264
- return;
1265
- }
1266
- // Try to get a definition from the predefined profile.
1267
- const definition = predefinedProfile.definitions[sdkVariable.name];
1268
- // Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
1269
- // despite the type checking from the switch statement.
1270
- switch (sdkVariable.type) {
1271
- case "dictionary":
1272
- // For dictionary, we support properties overrride
1273
- return editorProfile.variables.push(convertApiVariable({
1274
- ...sdkVariable,
1275
- type: sdkVariable.type,
1276
- properties: Array.isArray(definition) ? [...definition] : sdkVariable.properties
1277
- }));
1278
- case "feature":
1279
- if (isFeatureDefinition(definition)) {
1280
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type, definition });
1281
- }
1282
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type });
1283
- case "featureSet":
1284
- if (isFeatureSetDefinition(definition)) {
1285
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type, definition });
1286
- }
1287
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type });
1288
- case "featureSetCollection":
1289
- if (isFeatureSetCollectionDefinition(definition)) {
1290
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type, definition });
1291
- }
1292
- return editorProfile.variables.push({ ...sdkVariable, type: sdkVariable.type });
1293
- default:
1294
- return editorProfile.variables.push(convertApiVariable(sdkVariable));
1295
- }
1296
- });
1297
- if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
1298
- editorProfile.variables.push(...(predefinedProfile.additionalVariables ?? []));
1299
- }
1300
- return editorProfile;
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
- locale: "en"
1460
+ locale: "en"
1306
1461
  };
1307
1462
  class ArcadeLanguageServiceDefaults {
1308
- constructor() {
1309
- this._languageId = arcadeLanguageId;
1310
- this._languageOptions = {};
1311
- this._onDidChange = new Emitter();
1312
- this._profileMap = new Map();
1313
- this._apiContextMap = new Map();
1314
- this._onModelContextDidChange = new Emitter();
1315
- this._onDidModelContextChangeTimeout = -1;
1316
- }
1317
- get onDidChange() {
1318
- return this._onDidChange.event;
1319
- }
1320
- get onModelContextDidChange() {
1321
- return this._onModelContextDidChange.event;
1322
- }
1323
- get languageId() {
1324
- return this._languageId;
1325
- }
1326
- get languageOptions() {
1327
- return this._languageOptions;
1328
- }
1329
- _fireModelContextDidChange(key) {
1330
- if (this._onDidModelContextChangeTimeout !== -1) {
1331
- return;
1332
- }
1333
- this._onDidModelContextChangeTimeout = window.setTimeout(() => {
1334
- this._onDidModelContextChangeTimeout = -1;
1335
- this._onModelContextDidChange.fire(key);
1336
- }, 0);
1337
- }
1338
- _getApiKey(modelId) {
1339
- if (!Uri.isUri(modelId)) {
1340
- modelId = Uri.parse(modelId);
1341
- }
1342
- return modelId.toString();
1343
- }
1344
- /**
1345
- * Create an EditorProfile for the given model id using the given definition and locale.
1346
- * The EditorProfile is used by the the Arcade Language service as well by the cosing components.
1347
- * The definition can be a pre-defined profile or an editor profile definition.
1348
- * If the locale is not provided then the 'en' locale is used.
1349
- * @param modelId The model id for which to create the context.
1350
- * @param definition The definition to use for the model context.
1351
- * @param locale The locale to use for the model context.
1352
- * @returns The EditorProfile for the model.
1353
- */
1354
- async setProfileForModel(modelId, definition, apiContext = { locale: "en" }) {
1355
- // Convert pre-defined profile to a runtime profile
1356
- if (isPredefinedProfile(definition)) {
1357
- definition = await convertToEditorProfileDefinition(definition, apiContext.locale);
1358
- }
1359
- const intlStrings = await N(apiContext.locale, getAssetPath("./assets/arcade-language/t9n"), "profile.t9n.");
1360
- if (!intlStrings) {
1361
- throw new Error(`Failed to load the language bundle for ${apiContext.locale}`);
1362
- }
1363
- this.disposeEditorProfileForModel(modelId);
1364
- const key = this._getApiKey(modelId);
1365
- const editorProfile = new EditorProfile(definition, intlStrings);
1366
- this._profileMap.set(key, editorProfile);
1367
- const apiProfile = await editorProfile.toLSProfile();
1368
- this.updateApiContextForModel(modelId, {
1369
- locale: apiContext.locale,
1370
- profile: apiProfile,
1371
- snippets: apiContext.snippets
1372
- });
1373
- }
1374
- /**
1375
- * Dispose the editor profile for the given model id.
1376
- * It is the responsibility of the caller that created the editor profile to dispose it.
1377
- * @param modelId The model id for which to dispose the editor profile.
1378
- */
1379
- disposeEditorProfileForModel(modelId) {
1380
- const key = this._getApiKey(modelId);
1381
- this._profileMap.delete(key);
1382
- }
1383
- /**
1384
- * Dispose the api context for the given model id.
1385
- * @param modelId The model id for which to dispose the api context.
1386
- */
1387
- disposeApiContextForModel(modelId) {
1388
- const key = this._getApiKey(modelId);
1389
- if (this._apiContextMap.delete(key)) {
1390
- this._fireModelContextDidChange(key);
1391
- }
1392
- }
1393
- /**
1394
- * Returns the editor profile for the given model id.
1395
- * @param modelId The model id for which to get the editor profile.
1396
- * @returns The editor profile for the model.
1397
- */
1398
- getEditorProfileForModel(modelId) {
1399
- return this._profileMap.get(this._getApiKey(modelId));
1400
- }
1401
- /**
1402
- * Returns the API context for the given model id.
1403
- * Returns the default context if the model has no context.
1404
- * @param modelId The model id for which to get the API context.
1405
- * @returns The API context for the model.
1406
- */
1407
- getApiContextForModel(contextId) {
1408
- return this._apiContextMap.get(this._getApiKey(contextId)) ?? defaultContext;
1409
- }
1410
- /**
1411
- * Set or update api context for the given model id.
1412
- * @param modelId The model id for which to set the context.
1413
- * @param apiContext The api context to set.
1414
- */
1415
- updateApiContextForModel(modelId, apiContext) {
1416
- const key = this._getApiKey(modelId);
1417
- const currentApiContext = this._apiContextMap.get(key) ?? {};
1418
- this._apiContextMap.set(key, { ...currentApiContext, ...apiContext });
1419
- this._fireModelContextDidChange(key);
1420
- }
1421
- /**
1422
- * Set or update the Arcade language service options.
1423
- * @param languageOptions The language options to set.
1424
- */
1425
- setLanguageOptions(languageOptions = {}) {
1426
- // Check if options have actually changed.
1427
- // Avoid restarting the worker when no updates.
1428
- // Today we only have the 'assetsPath' as a property
1429
- if (this._languageOptions.assetsPath === languageOptions.assetsPath) {
1430
- return;
1431
- }
1432
- this._languageOptions = { ...this._languageOptions, ...languageOptions };
1433
- this._onDidChange.fire(this);
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
- setProfileForModel: arcadeDefaults.setProfileForModel.bind(arcadeDefaults)
1593
+ setProfileForModel: arcadeDefaults.setProfileForModel.bind(arcadeDefaults)
1439
1594
  };
1440
1595
 
1441
1596
  export { arcade as a, arcadeDefaults as b };