@arcgis/coding-components 5.2.0-next.32 → 5.2.0-next.33

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.
@@ -1,38 +1,38 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { g as v, f as F, m as M, L as S, E as A } from "./language-defaults-base.js";
3
- import { i as h, a as L, b as k, c as E, d as I, e as C, f as P } from "./utils.js";
2
+ import { g as v, f as A, m as F, L as M, E as S } from "./language-defaults-base.js";
3
+ import { i as h, a as L, b as k, c as E, d as I, e as C, f as T } from "./utils.js";
4
4
  import { supportedLocales as j, fetchT9nStringsBundle as $ } from "@arcgis/toolkit/intl";
5
- import { g as T } from "./runtime.js";
6
- import { CompletionItemKind as w, InsertTextFormat as p, InsertTextMode as f } from "vscode-languageserver-types";
7
- import { getDeclaredPixelMembers as q } from "@arcgis/core/applications/Components/arcadeEditorUtils.js";
5
+ import { g as P } from "./runtime.js";
6
+ import { CompletionItemKind as w, InsertTextFormat as u, InsertTextMode as f } from "vscode-languageserver-types";
7
+ import { getDeclaredPixelMembers as U } from "@arcgis/core/applications/Components/arcadeEditorUtils.js";
8
8
  import "@arcgis/toolkit/type";
9
- async function B(e) {
10
- const { apiVersion: i, bundles: t, hiddenApiItems: s } = e.toEditorProfileDefinition(), o = await b(e.dictionaryVariables.filter(P));
11
- return { apiVersion: i, bundles: t, variables: o, hiddenApiItems: s?.map((a) => a.toLowerCase()) };
9
+ async function q(e) {
10
+ const { apiVersion: r, bundles: t, hiddenApiItems: s } = e.toEditorProfileDefinition(), o = await b(e.dictionaryVariables.filter(T));
11
+ return { apiVersion: r, bundles: t, variables: o, hiddenApiItems: s?.map((a) => a.toLowerCase()) };
12
12
  }
13
- async function b(e, i = w.Variable) {
13
+ async function b(e, r = w.Variable) {
14
14
  return await Promise.all(
15
15
  e.map(async (t) => {
16
16
  switch (t.type) {
17
17
  case "dictionary":
18
- return await O(t, i);
18
+ return await z(t, r);
19
19
  case "pixel":
20
- return await z(t, i);
20
+ return await _(t, r);
21
21
  // Voxel is equivalent to features in regards to the languageservice.
22
22
  // They both have equivalent fields, but some voxel fields are different types (arrays)
23
23
  // than what is reported in .fields, so in the sidebar we treat a bit differently.
24
24
  // In autocomplete we don't differentiate types, so we can use the same logic as features.
25
25
  case "voxel":
26
26
  case "feature":
27
- return await _(t, i);
27
+ return await K(t, r);
28
28
  default:
29
- return K(t, i);
29
+ return B(t, r);
30
30
  }
31
31
  })
32
32
  );
33
33
  }
34
- function K(e, i) {
35
- const { name: t, type: s } = e, o = e.getDescription(), a = i === w.Field ? v(t, !1) : t;
34
+ function B(e, r) {
35
+ const { name: t, type: s } = e, o = e.getDescription(), a = r === w.Field ? v(t, !1) : t;
36
36
  return {
37
37
  name: t,
38
38
  description: o,
@@ -42,20 +42,20 @@ function K(e, i) {
42
42
  detail: t,
43
43
  insertText: a,
44
44
  insertTextMode: f.asIs,
45
- insertTextFormat: p.PlainText,
46
- kind: i,
45
+ insertTextFormat: u.PlainText,
46
+ kind: r,
47
47
  documentation: { kind: "markdown", value: o }
48
48
  }
49
49
  };
50
50
  }
51
- async function _(e, i) {
51
+ async function K(e, r) {
52
52
  const t = await e.loadSource(), { name: s } = e, o = e.getDescription(), a = {
53
53
  label: s,
54
54
  detail: s,
55
55
  insertText: s,
56
56
  insertTextMode: f.asIs,
57
- insertTextFormat: p.PlainText,
58
- kind: i
57
+ insertTextFormat: u.PlainText,
58
+ kind: r
59
59
  }, n = {
60
60
  name: s,
61
61
  description: o,
@@ -65,12 +65,12 @@ async function _(e, i) {
65
65
  };
66
66
  if (!t)
67
67
  return n;
68
- const [r, c] = F(t.fields, o, {
68
+ const [i, c] = A(t.fields, o, {
69
69
  includeAliases: !0
70
70
  });
71
- return n.properties = r, a.documentation = { kind: "markdown", value: c }, n;
71
+ return n.properties = i, a.documentation = { kind: "markdown", value: c }, n;
72
72
  }
73
- async function z(e, i) {
73
+ async function _(e, r) {
74
74
  const t = await e.loadSource(), s = e.toProfileVariableDefinition();
75
75
  if (s.type !== "pixel")
76
76
  throw new Error("Incorrect definition passed to pixel variable");
@@ -79,9 +79,9 @@ async function z(e, i) {
79
79
  detail: o,
80
80
  insertText: o,
81
81
  insertTextMode: f.asIs,
82
- insertTextFormat: p.PlainText,
83
- kind: i
84
- }, r = {
82
+ insertTextFormat: u.PlainText,
83
+ kind: r
84
+ }, i = {
85
85
  name: o,
86
86
  description: a,
87
87
  type: "dictionary",
@@ -89,17 +89,17 @@ async function z(e, i) {
89
89
  completion: n
90
90
  };
91
91
  if (!t || !s.definition)
92
- return r;
93
- const c = await q(t), [d, l] = M(c, a);
94
- return r.properties = d, n.documentation = { kind: "markdown", value: l }, r;
92
+ return i;
93
+ const c = await U(t), [d, l] = F(c, a);
94
+ return i.properties = d, n.documentation = { kind: "markdown", value: l }, i;
95
95
  }
96
- async function O(e, i) {
97
- const { name: t, dictionaryVariables: s } = e, o = e.getDescription(), a = s.reduce((n, r) => {
96
+ async function z(e, r) {
97
+ const { name: t, dictionaryVariables: s } = e, o = e.getDescription(), a = s.reduce((n, i) => {
98
98
  n !== "" && (n += `
99
99
 
100
- `), n += `**${r.name}**
101
- ${r.type}`;
102
- const c = r.getDescription();
100
+ `), n += `**${i.name}**
101
+ ${i.type}`;
102
+ const c = i.getDescription();
103
103
  return c && (n += `
104
104
  ${c}`), n;
105
105
  }, o);
@@ -108,73 +108,74 @@ ${c}`), n;
108
108
  description: o,
109
109
  type: "dictionary",
110
110
  // TODO(editor-profile): remove filter once we have a arcade-specific editor profile type that doesn't include SQL-layer-specific variables.
111
- properties: await b(s.filter(P), w.Field),
111
+ properties: await b(s.filter(T), w.Field),
112
112
  completion: {
113
113
  label: t,
114
114
  detail: t,
115
115
  insertText: t,
116
116
  insertTextMode: f.asIs,
117
- insertTextFormat: p.PlainText,
118
- kind: i,
117
+ insertTextFormat: u.PlainText,
118
+ kind: r,
119
119
  documentation: { kind: "markdown", value: a }
120
120
  }
121
121
  };
122
122
  }
123
123
  async function y(e = "en") {
124
- const i = x.get(e);
125
- if (i)
126
- return i;
124
+ const r = x.get(e);
125
+ if (r)
126
+ return r;
127
127
  if (!j.has(e))
128
128
  return await y("en");
129
129
  try {
130
- const t = await fetch(T(`./assets/arcade-language/profiles/arcade-profiles.t9n.${e}.json`));
131
- return t.ok ? Q(e, await t.json()) : e === "en" ? null : await y("en");
130
+ const t = await fetch(P(`./assets/arcade-language/profiles/arcade-profiles.t9n.${e}.json`));
131
+ return t.ok ? O(e, await t.json()) : e === "en" ? null : await y("en");
132
132
  } catch {
133
133
  return null;
134
134
  }
135
135
  }
136
136
  const x = /* @__PURE__ */ new Map();
137
- function Q(e, i) {
137
+ function O(e, r) {
138
138
  const t = /* @__PURE__ */ new Map();
139
- return i.forEach((s) => {
139
+ return r.forEach((s) => {
140
140
  t.set(s.id, s);
141
141
  }), x.set(e, t), t;
142
142
  }
143
- async function U(e, i = "en") {
144
- return (await y(i))?.get(e) ?? null;
143
+ async function Q(e, r = "en") {
144
+ return (await y(r))?.get(e) ?? null;
145
145
  }
146
146
  function G(e) {
147
147
  return !!e && typeof e == "object" && "additionalVariables" in e && Array.isArray(e.additionalVariables);
148
148
  }
149
- function H(e) {
150
- return e?.map(m);
149
+ function H(e, r) {
150
+ return e?.map((t) => m(t, r));
151
151
  }
152
- function m(e) {
152
+ function m(e, r) {
153
153
  switch (e.type) {
154
154
  case "dictionary":
155
155
  return {
156
156
  ...e,
157
157
  type: e.type,
158
- properties: H(e.properties)
158
+ properties: H(e.properties, r)
159
159
  };
160
160
  case "array":
161
161
  return {
162
162
  ...e,
163
163
  type: e.type,
164
- elementType: { type: "number", name: "number" }
164
+ // TODO(5.2): Remove conversion options from the function signatures, its a safety net for a last minute patch. See issue #17618
165
+ ...r?.allowUserArrayElementTypes ? {} : { elementType: { type: "number", name: "number" } }
165
166
  };
166
167
  default:
167
168
  return { ...e, type: e.type };
168
169
  }
169
170
  }
170
- async function J(e, i = "en") {
171
+ async function J(e, r = "en") {
171
172
  if (!h(e))
172
173
  return;
173
- const t = await U(e.id, i);
174
+ const t = await Q(e.id, r);
174
175
  if (!t)
175
176
  return;
176
177
  const s = e.definitions, o = new Map(
177
- Object.entries(s).map(([n, r]) => [n.toLowerCase(), r])
178
+ Object.entries(s).map(([n, i]) => [n.toLowerCase(), i])
178
179
  ), a = {
179
180
  bundles: [...t.bundles],
180
181
  variables: [],
@@ -183,26 +184,31 @@ async function J(e, i = "en") {
183
184
  return t.variables.forEach((n) => {
184
185
  if (e.disabledVariables?.includes(n.name))
185
186
  return;
186
- const r = o.get(n.name.toLowerCase());
187
+ const i = o.get(n.name.toLowerCase());
187
188
  switch (n.type) {
188
189
  case "dictionary":
189
190
  return a.variables.push(
190
- m({
191
- ...n,
192
- type: n.type,
193
- properties: Array.isArray(r) ? [...r] : n.properties
194
- })
191
+ m(
192
+ {
193
+ ...n,
194
+ type: n.type,
195
+ properties: Array.isArray(i) ? [...i] : n.properties
196
+ },
197
+ {
198
+ allowUserArrayElementTypes: e.id === "data-pipelines"
199
+ }
200
+ )
195
201
  );
196
202
  case "feature":
197
- return C(r) ? a.variables.push({ ...n, type: "feature", definition: r }) : void 0;
203
+ return C(i) ? a.variables.push({ ...n, type: "feature", definition: i }) : void 0;
198
204
  case "pixel":
199
- return I(r) ? a.variables.push({ ...n, type: n.type, definition: r }) : void 0;
205
+ return I(i) ? a.variables.push({ ...n, type: n.type, definition: i }) : void 0;
200
206
  case "voxel":
201
- return E(r) ? a.variables.push({ ...n, type: n.type, definition: r }) : void 0;
207
+ return E(i) ? a.variables.push({ ...n, type: n.type, definition: i }) : void 0;
202
208
  case "featureSet":
203
- return k(r) ? a.variables.push({ ...n, type: n.type, definition: r }) : void 0;
209
+ return k(i) ? a.variables.push({ ...n, type: n.type, definition: i }) : void 0;
204
210
  case "featureSetCollection":
205
- return L(r) ? a.variables.push({ ...n, type: n.type, definition: r }) : void 0;
211
+ return L(i) ? a.variables.push({ ...n, type: n.type, definition: i }) : void 0;
206
212
  default:
207
213
  return a.variables.push(m(n));
208
214
  }
@@ -230,7 +236,7 @@ const W = {
230
236
  R(e)
231
237
  )
232
238
  };
233
- class X extends S {
239
+ class X extends M {
234
240
  /**
235
241
  * Per-model update chaining to serialize profile updates.
236
242
  *
@@ -261,40 +267,40 @@ class X extends S {
261
267
  * @param locale The locale to use for the model context.
262
268
  * @returns The EditorProfile for the model.
263
269
  */
264
- async setProfileForModel(i, t, s = { locale: "en" }) {
265
- const o = this._getApiKey(i), n = (this.#e.get(o) || Promise.resolve()).then(async () => {
270
+ async setProfileForModel(r, t, s = { locale: "en" }) {
271
+ const o = this._getApiKey(r), n = (this.#e.get(o) || Promise.resolve()).then(async () => {
266
272
  const c = t, d = h(c) ? await J(c, s.locale) : c, l = await $(
267
273
  s.locale,
268
- T("./assets/editor-profile/t9n"),
274
+ P("./assets/editor-profile/t9n"),
269
275
  "messages."
270
276
  );
271
277
  if (!l)
272
278
  throw new Error(`Failed to load the language bundle for ${s.locale}`);
273
- this.disposeForModel(i);
274
- const g = new A(
279
+ this.disposeForModel(r);
280
+ const g = new S(
275
281
  d,
276
282
  l,
277
283
  s.locale,
278
284
  W
279
285
  );
280
286
  this._modelToProfileMap.set(o, g);
281
- const D = await B(g);
282
- this.updateApiContextForModel(i, {
287
+ const D = await q(g);
288
+ this.updateApiContextForModel(r, {
283
289
  locale: s.locale,
284
290
  profile: D,
285
291
  snippets: s.snippets
286
292
  });
287
- }), r = n.finally(() => {
288
- this.#e.get(o) === r && this.#e.delete(o);
293
+ }), i = n.finally(() => {
294
+ this.#e.get(o) === i && this.#e.delete(o);
289
295
  });
290
- return this.#e.set(o, r), await n;
296
+ return this.#e.set(o, i), await n;
291
297
  }
292
298
  }
293
- const u = new X(), re = {
294
- setProfileForModel: u.setProfileForModel.bind(u),
295
- getApiLibraryForModel: u.getApiLibraryForModel.bind(u)
299
+ const p = new X(), ie = {
300
+ setProfileForModel: p.setProfileForModel.bind(p),
301
+ getApiLibraryForModel: p.getApiLibraryForModel.bind(p)
296
302
  };
297
303
  export {
298
- re as a,
299
- u as b
304
+ ie as a,
305
+ p as b
300
306
  };