@arcgis/coding-components 5.2.0-next.75 → 5.2.0-next.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/46SGP3IQ.js +2 -0
- package/dist/cdn/TNE7K4P6.js +2 -0
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-arcade-editor/customElement.js +165 -142
- package/dist/components/arcgis-arcade-results/customElement.js +9 -9
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +1 -1
- package/dist/utils/arcade-executor.d.ts +14 -1
- package/package.json +6 -6
- package/dist/cdn/ADELNDZO.js +0 -2
- package/dist/cdn/CVKAPGDA.js +0 -2
|
@@ -3,23 +3,23 @@ import { g as Z, c as ee } from "../../chunks/runtime.js";
|
|
|
3
3
|
import { css as te, html as d, nothing as O } from "lit";
|
|
4
4
|
import { i as se } from "../../chunks/monaco-importer.js";
|
|
5
5
|
import { LitElement as ie, createEvent as z, safeClassMap as v } from "@arcgis/lumina";
|
|
6
|
-
import { getMinorVersion as
|
|
7
|
-
import { i as
|
|
8
|
-
import { s as
|
|
9
|
-
import { b as
|
|
6
|
+
import { getMinorVersion as ne, generateGuid as ae } from "@arcgis/toolkit/string";
|
|
7
|
+
import { i as $, D as re, e as K } from "../../chunks/arcade-executor.js";
|
|
8
|
+
import { s as oe, a as ce } from "../../chunks/arcade-service-accessors.js";
|
|
9
|
+
import { b as E } from "../../chunks/arcade-defaults.js";
|
|
10
10
|
import { setArcadeAskAiBinding as B, arcadeAskAiCommandId as le, arcadeQuickFixKind as de } from "../../chunks/arcade-mode.js";
|
|
11
11
|
import { u as ue } from "../../chunks/useT9n.js";
|
|
12
12
|
import { createRef as H, ref as V } from "lit/directives/ref.js";
|
|
13
|
-
import { load as
|
|
14
|
-
import
|
|
13
|
+
import { load as ge } from "@arcgis/lumina/controllers";
|
|
14
|
+
import he from "@arcgis/core/config.js";
|
|
15
15
|
import Q from "@arcgis/core/identity/IdentityManager.js";
|
|
16
|
-
import { log as pe, rethrowError as
|
|
17
|
-
import { watch as
|
|
18
|
-
import
|
|
19
|
-
import { property as c, subclass as
|
|
16
|
+
import { log as pe, rethrowError as g } from "@arcgis/toolkit/log";
|
|
17
|
+
import { watch as I } from "@arcgis/core/core/reactiveUtils.js";
|
|
18
|
+
import x from "@arcgis/core/core/Accessor.js";
|
|
19
|
+
import { property as c, subclass as S } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
20
20
|
import { A as j } from "../../chunks/ArcadeDebuggerPreviewTabsState.js";
|
|
21
21
|
import { r as be } from "../../chunks/utilities.js";
|
|
22
|
-
import { Range as W, KeyCode as
|
|
22
|
+
import { Range as W, KeyCode as me, Uri as _e } from "monaco-editor";
|
|
23
23
|
const fe = te`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}.main-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.bottom-action-bar.is-collapsed{border-bottom:0}.bottom-action-bar{display:flex;.bottom-action-bar__actions{flex:1 1 auto;min-inline-size:0}}`, G = "https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0", h = (t, e) => {
|
|
24
24
|
pe(t, "Arcade Assistant", e);
|
|
25
25
|
}, X = [
|
|
@@ -44,24 +44,24 @@ async function ve({
|
|
|
44
44
|
"warn",
|
|
45
45
|
"The arcadeAssistant property is deprecated. Set esriConfig.portalUrl instead of arcadeAssistant.portalUrl."
|
|
46
46
|
);
|
|
47
|
-
const e = t ||
|
|
47
|
+
const e = t || he.portalUrl;
|
|
48
48
|
if (!e)
|
|
49
49
|
return h("warn", "Arcade Assistant initialization failed. Reason: missing portal url."), { shouldRender: !1 };
|
|
50
50
|
const s = e.replace(/\/sharing\/rest(\/.*)?$/iu, "").replace(/\/$/u, "");
|
|
51
51
|
if (!await Pe(s))
|
|
52
52
|
return { shouldRender: !1 };
|
|
53
|
-
const
|
|
53
|
+
const n = await Ae(e), o = `${s}/sharing/rest/portals/self?f=json&token=${n}`, a = `${s}/sharing/rest/portals/self/settings?f=json&token=${n}`, r = `${s}/sharing/rest/portals/self/signinSettings?f=json&token=${n}`, m = await Promise.allSettled([
|
|
54
54
|
fetch(o, { credentials: "include" }).then((P) => P.json()),
|
|
55
|
-
fetch(
|
|
55
|
+
fetch(a, { credentials: "include" }).then((P) => P.json()),
|
|
56
56
|
fetch(r, { credentials: "include" }).then((P) => P.json())
|
|
57
|
-
]), [
|
|
58
|
-
if (A.isPortal &&
|
|
57
|
+
]), [u, R, T] = m, A = u.status === "fulfilled" ? u.value : (h("warn", `Failed to fetch selfUrl. Reason: ${u.reason}.`), {}), L = R.status === "fulfilled" ? R.value : (h("warn", `Failed to fetch settingsUrl. Reason: ${R.reason}.`), {}), J = T.status === "fulfilled" ? T.value : (h("warn", `Failed to fetch signinSettingsUrl. Reason: ${T.reason}.`), {});
|
|
58
|
+
if (A.isPortal && !Ee(A.enterpriseVersion))
|
|
59
59
|
return { shouldRender: !1 };
|
|
60
60
|
const M = A.helpBase || "";
|
|
61
|
-
if (!
|
|
61
|
+
if (!L)
|
|
62
62
|
return h("warn", "Settings response is not available."), { shouldRender: !1 };
|
|
63
63
|
const k = {
|
|
64
|
-
orgAiAssistantsEnabled: Se(
|
|
64
|
+
orgAiAssistantsEnabled: Se(L),
|
|
65
65
|
betaAppsAllowed: J.blockBetaApps !== !0,
|
|
66
66
|
serviceUrlAvailable: !!A?.helperServices?.aiAssistantServices?.url,
|
|
67
67
|
userHasUseAiAssistantsPrivilege: A?.user?.privileges?.includes("portal:user:useAIAssistants") === !0
|
|
@@ -92,46 +92,46 @@ async function ve({
|
|
|
92
92
|
feedbackServiceUrl: G
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
const e =
|
|
97
|
-
return Number.isNaN(
|
|
95
|
+
function Ee(t) {
|
|
96
|
+
const e = ne(t), [s, i = "0"] = e.split("."), n = Number.parseInt(s, 10), o = Number.parseInt(i, 10);
|
|
97
|
+
return Number.isNaN(n) || Number.isNaN(o) ? !1 : n > 12 || n === 12 && o >= 2;
|
|
98
98
|
}
|
|
99
|
-
var
|
|
100
|
-
for (var
|
|
101
|
-
(
|
|
102
|
-
return i &&
|
|
99
|
+
var $e = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, f = (t, e, s, i) => {
|
|
100
|
+
for (var n = i > 1 ? void 0 : i ? ye(e, s) : e, o = t.length - 1, a; o >= 0; o--)
|
|
101
|
+
(a = t[o]) && (n = (i ? a(e, s, n) : a(n)) || n);
|
|
102
|
+
return i && n && $e(e, s, n), n;
|
|
103
103
|
};
|
|
104
104
|
const Y = 100;
|
|
105
|
-
let
|
|
105
|
+
let p = class extends x {
|
|
106
106
|
constructor(t) {
|
|
107
107
|
super(t), this.collectionItems = [], this.errorMessage = "", this.expanded = !1, this.requestId = 0, this.status = "idle", this.visibleChildCount = Y;
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
-
|
|
110
|
+
f([
|
|
111
111
|
c()
|
|
112
|
-
],
|
|
113
|
-
|
|
112
|
+
], p.prototype, "collectionItems", 2);
|
|
113
|
+
f([
|
|
114
114
|
c()
|
|
115
|
-
],
|
|
116
|
-
|
|
115
|
+
], p.prototype, "errorMessage", 2);
|
|
116
|
+
f([
|
|
117
117
|
c()
|
|
118
|
-
],
|
|
119
|
-
|
|
118
|
+
], p.prototype, "expanded", 2);
|
|
119
|
+
f([
|
|
120
120
|
c()
|
|
121
|
-
],
|
|
122
|
-
|
|
121
|
+
], p.prototype, "requestId", 2);
|
|
122
|
+
f([
|
|
123
123
|
c()
|
|
124
|
-
],
|
|
125
|
-
|
|
124
|
+
], p.prototype, "schemaValue", 2);
|
|
125
|
+
f([
|
|
126
126
|
c()
|
|
127
|
-
],
|
|
128
|
-
|
|
127
|
+
], p.prototype, "status", 2);
|
|
128
|
+
f([
|
|
129
129
|
c()
|
|
130
|
-
],
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
],
|
|
134
|
-
let C = class extends
|
|
130
|
+
], p.prototype, "visibleChildCount", 2);
|
|
131
|
+
p = f([
|
|
132
|
+
S("ArcadeDebuggerLazyTreeNodeState")
|
|
133
|
+
], p);
|
|
134
|
+
let C = class extends x {
|
|
135
135
|
constructor(t) {
|
|
136
136
|
super(t), this.generation = 0, this.nodes = /* @__PURE__ */ new Map();
|
|
137
137
|
}
|
|
@@ -142,8 +142,8 @@ let C = class extends f {
|
|
|
142
142
|
const i = this.nodes.get(t);
|
|
143
143
|
if (i)
|
|
144
144
|
return i;
|
|
145
|
-
const
|
|
146
|
-
return
|
|
145
|
+
const n = new p();
|
|
146
|
+
return n.expanded = e, this.nodes.set(t, n), e && s && this.loadNode(t, s), n;
|
|
147
147
|
}
|
|
148
148
|
setExpanded(t, e, s) {
|
|
149
149
|
const i = this.ensureNode(t, e, s);
|
|
@@ -175,13 +175,13 @@ let C = class extends f {
|
|
|
175
175
|
const i = this.nodes.get(t);
|
|
176
176
|
if (!i || i.status === "loading" || i.status === "loaded")
|
|
177
177
|
return;
|
|
178
|
-
const
|
|
179
|
-
i.requestId = o, i.status = "loading", i.errorMessage = "", i.schemaValue = void 0, i.collectionItems = [], e().then((
|
|
178
|
+
const n = this.generation, o = i.requestId + 1;
|
|
179
|
+
i.requestId = o, i.status = "loading", i.errorMessage = "", i.schemaValue = void 0, i.collectionItems = [], e().then((a) => {
|
|
180
180
|
const r = this.nodes.get(t);
|
|
181
|
-
!r || this.generation !==
|
|
181
|
+
!r || this.generation !== n || r.requestId !== o || (s(r, a), r.status = "loaded");
|
|
182
182
|
}).catch(() => {
|
|
183
|
-
const
|
|
184
|
-
!
|
|
183
|
+
const a = this.nodes.get(t);
|
|
184
|
+
!a || this.generation !== n || a.requestId !== o || (a.status = "error");
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
destroyNodes() {
|
|
@@ -190,15 +190,15 @@ let C = class extends f {
|
|
|
190
190
|
this.nodes.clear();
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
|
-
C =
|
|
194
|
-
|
|
193
|
+
C = f([
|
|
194
|
+
S("ArcadeDebuggerLazyTreeState")
|
|
195
195
|
], C);
|
|
196
196
|
var De = Object.defineProperty, we = Object.getOwnPropertyDescriptor, l = (t, e, s, i) => {
|
|
197
|
-
for (var
|
|
198
|
-
(
|
|
199
|
-
return i &&
|
|
197
|
+
for (var n = i > 1 ? void 0 : i ? we(e, s) : e, o = t.length - 1, a; o >= 0; o--)
|
|
198
|
+
(a = t[o]) && (n = (i ? a(e, s, n) : a(n)) || n);
|
|
199
|
+
return i && n && De(e, s, n), n;
|
|
200
200
|
};
|
|
201
|
-
let _ = class extends
|
|
201
|
+
let _ = class extends x {
|
|
202
202
|
constructor(t) {
|
|
203
203
|
super(t), this.phase = "idle", this.sessionId = 0, this.consoleLogs = [], this.hasExecuted = !1;
|
|
204
204
|
}
|
|
@@ -217,6 +217,9 @@ let _ = class extends f {
|
|
|
217
217
|
get debugResult() {
|
|
218
218
|
return this.result?.resultType === "debug" ? this.result.result : void 0;
|
|
219
219
|
}
|
|
220
|
+
get executionTiming() {
|
|
221
|
+
return this.result?.timing;
|
|
222
|
+
}
|
|
220
223
|
addConsoleLog(t) {
|
|
221
224
|
this.consoleLogs = [...this.consoleLogs, t];
|
|
222
225
|
}
|
|
@@ -240,9 +243,9 @@ l([
|
|
|
240
243
|
c()
|
|
241
244
|
], _.prototype, "hasExecuted", 2);
|
|
242
245
|
_ = l([
|
|
243
|
-
|
|
246
|
+
S("ArcadeDebuggerExecutionModel")
|
|
244
247
|
], _);
|
|
245
|
-
let y = class extends
|
|
248
|
+
let y = class extends x {
|
|
246
249
|
constructor(t) {
|
|
247
250
|
super(t), this.editorBreakpoints = [], this.executionBreakpoints = [];
|
|
248
251
|
}
|
|
@@ -267,9 +270,9 @@ l([
|
|
|
267
270
|
c()
|
|
268
271
|
], y.prototype, "executionBreakpoints", 2);
|
|
269
272
|
y = l([
|
|
270
|
-
|
|
273
|
+
S("ArcadeDebuggerSessionModel")
|
|
271
274
|
], y);
|
|
272
|
-
let D = class extends
|
|
275
|
+
let D = class extends x {
|
|
273
276
|
constructor(t) {
|
|
274
277
|
super(t), this.openedPanel = "output", this.showPanel = !1;
|
|
275
278
|
}
|
|
@@ -281,9 +284,9 @@ l([
|
|
|
281
284
|
c()
|
|
282
285
|
], D.prototype, "showPanel", 2);
|
|
283
286
|
D = l([
|
|
284
|
-
|
|
287
|
+
S("ArcadeDebuggerUiModel")
|
|
285
288
|
], D);
|
|
286
|
-
let w = class extends
|
|
289
|
+
let w = class extends x {
|
|
287
290
|
constructor(t) {
|
|
288
291
|
super(t);
|
|
289
292
|
}
|
|
@@ -307,9 +310,9 @@ l([
|
|
|
307
310
|
c()
|
|
308
311
|
], w.prototype, "lastPausedState", 2);
|
|
309
312
|
w = l([
|
|
310
|
-
|
|
313
|
+
S("ArcadeDebuggerPausedFrameModel")
|
|
311
314
|
], w);
|
|
312
|
-
let
|
|
315
|
+
let b = class extends x {
|
|
313
316
|
constructor(t) {
|
|
314
317
|
super(t), this.execution = new _(), this.lazyTreeState = new C(), this.pausedFrame = new w(), this.previewTabsState = new j(), this.session = new y(), this.ui = new D();
|
|
315
318
|
}
|
|
@@ -336,6 +339,9 @@ let p = class extends f {
|
|
|
336
339
|
get debugResult() {
|
|
337
340
|
return this.execution.debugResult;
|
|
338
341
|
}
|
|
342
|
+
get executionTiming() {
|
|
343
|
+
return this.execution.executionTiming;
|
|
344
|
+
}
|
|
339
345
|
get debuggerLine() {
|
|
340
346
|
return this.pausedFrame.pausedState?.line;
|
|
341
347
|
}
|
|
@@ -391,11 +397,15 @@ let p = class extends f {
|
|
|
391
397
|
closePanel() {
|
|
392
398
|
this.ui.showPanel = !1;
|
|
393
399
|
}
|
|
394
|
-
completeDebug(t) {
|
|
395
|
-
this.execution.mode = "debug", this.execution.result = { resultType: "debug", result: t }, this.execution.phase = "completed", this.ui.openedPanel = "output", this.pausedFrame.reset(), this.resetTransientDebuggerState();
|
|
400
|
+
completeDebug(t, e) {
|
|
401
|
+
this.execution.mode = "debug", this.execution.result = { resultType: "debug", result: t, ...e ? { timing: e } : {} }, this.execution.phase = "completed", this.ui.openedPanel = "output", this.pausedFrame.reset(), this.resetTransientDebuggerState();
|
|
396
402
|
}
|
|
397
403
|
completeRun(t, e = {}) {
|
|
398
|
-
this.execution.mode = "run", !e.useDebugRenderer &&
|
|
404
|
+
this.execution.mode = "run", !e.useDebugRenderer && $(t) ? this.execution.result = { resultType: "run", result: t } : e.useDebugRenderer && !$(t) && (this.execution.result = {
|
|
405
|
+
resultType: "debug",
|
|
406
|
+
result: t,
|
|
407
|
+
...e.timing ? { timing: e.timing } : {}
|
|
408
|
+
}), this.execution.phase = "completed", this.pausedFrame.reset(), this.ui.openedPanel = "output", this.resetTransientDebuggerState();
|
|
399
409
|
}
|
|
400
410
|
continueDebug() {
|
|
401
411
|
const t = this.pausedFrame.pausedState?.continue;
|
|
@@ -468,37 +478,37 @@ let p = class extends f {
|
|
|
468
478
|
};
|
|
469
479
|
l([
|
|
470
480
|
c()
|
|
471
|
-
],
|
|
481
|
+
], b.prototype, "execution", 2);
|
|
472
482
|
l([
|
|
473
483
|
c()
|
|
474
|
-
],
|
|
484
|
+
], b.prototype, "lazyTreeState", 2);
|
|
475
485
|
l([
|
|
476
486
|
c()
|
|
477
|
-
],
|
|
487
|
+
], b.prototype, "pausedLine", 2);
|
|
478
488
|
l([
|
|
479
489
|
c()
|
|
480
|
-
],
|
|
490
|
+
], b.prototype, "pausedFrame", 2);
|
|
481
491
|
l([
|
|
482
492
|
c()
|
|
483
|
-
],
|
|
493
|
+
], b.prototype, "previewTabsState", 2);
|
|
484
494
|
l([
|
|
485
495
|
c()
|
|
486
|
-
],
|
|
496
|
+
], b.prototype, "session", 2);
|
|
487
497
|
l([
|
|
488
498
|
c()
|
|
489
|
-
],
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
],
|
|
499
|
+
], b.prototype, "ui", 2);
|
|
500
|
+
b = l([
|
|
501
|
+
S("ArcadeDebuggerStore")
|
|
502
|
+
], b);
|
|
493
503
|
const ke = {
|
|
494
504
|
glyphMargin: !0,
|
|
495
505
|
lineNumbersMinChars: 1
|
|
496
506
|
};
|
|
497
507
|
class Be extends ie {
|
|
498
508
|
constructor() {
|
|
499
|
-
super(...arguments), this._codeEditorElt = H(), this._arcadeAssistantElt = H(), this._componentReadyDefer = Promise.withResolvers(), this._disposables = [], this._editorProfilePromise = Promise.resolve(void 0), this._debuggerState = new
|
|
500
|
-
window.open(
|
|
501
|
-
}, this._decorations = void 0, this._monacoEditor =
|
|
509
|
+
super(...arguments), this._codeEditorElt = H(), this._arcadeAssistantElt = H(), this._componentReadyDefer = Promise.withResolvers(), this._disposables = [], this._editorProfilePromise = Promise.resolve(void 0), this._debuggerState = new b(), this.messages = ue(), this._modelId = ae(), this._openArcadeHelp = () => {
|
|
510
|
+
window.open(re, "Arcade Help");
|
|
511
|
+
}, this._decorations = void 0, this._monacoEditor = ge(se), this._editorOptions = {}, this._toggleSidePanel = (e) => {
|
|
502
512
|
e.currentTarget instanceof HTMLElement && this._setOpenedSidePanel(e.currentTarget.dataset.panelName ?? "none");
|
|
503
513
|
}, this._closeSidePanel = () => {
|
|
504
514
|
this._setOpenedSidePanel("none");
|
|
@@ -552,7 +562,7 @@ class Be extends ie {
|
|
|
552
562
|
return { type: "error", value: "Missing editor profile", error: null };
|
|
553
563
|
await this._componentReadyDefer.promise;
|
|
554
564
|
const s = this._codeEditorElt.value?.value, i = await K(e.definition, s, this.testData, { mode: "run" });
|
|
555
|
-
return
|
|
565
|
+
return $(i) ? i : { type: "error", value: "Unexpected debug result", error: null };
|
|
556
566
|
}
|
|
557
567
|
async setFocus() {
|
|
558
568
|
await this._componentReadyDefer.promise, await this._codeEditorElt.value?.setFocus();
|
|
@@ -567,14 +577,14 @@ class Be extends ie {
|
|
|
567
577
|
}
|
|
568
578
|
async load() {
|
|
569
579
|
const e = Z("./assets");
|
|
570
|
-
|
|
580
|
+
oe(e), await this._updateDataModelDeps(), this.manager.onLifecycle(() => (this.hasUpdated && this._connectMonacoCustomizations().catch(g(this)), () => {
|
|
571
581
|
for (this._askAiBindingKey && (B(this._askAiBindingKey, void 0), this._askAiBindingKey = void 0); this._disposables.length; )
|
|
572
582
|
this._disposables.pop()?.dispose();
|
|
573
583
|
this._abortExternalExecution(), this._connectMonacoCustomizationsPromise = void 0, this._executeScriptAction = void 0, this._clearDebuggerDecorations(), this._debuggerState.disconnect();
|
|
574
584
|
}));
|
|
575
585
|
}
|
|
576
586
|
willUpdate(e) {
|
|
577
|
-
(e.has("messages") || e.has("profile")) && this._updateDataModelDeps(), (e.has("testData") || e.has("externalExecutor")) && this._executionContextChanged(), e.has("enableDebugger") && !this.enableDebugger && this._debuggerState.disableDebugger(), e.has("snippets") &&
|
|
587
|
+
(e.has("messages") || e.has("profile")) && this._updateDataModelDeps(), (e.has("testData") || e.has("externalExecutor")) && this._executionContextChanged(), e.has("enableDebugger") && !this.enableDebugger && this._debuggerState.disableDebugger(), e.has("snippets") && E.updateApiContextForModel(this._modelId, {
|
|
578
588
|
snippets: this.snippets
|
|
579
589
|
}), (e.has("arcadeAssistant") || e.has("disableAssistant")) && this._updateArcadeAssistantRemoteState();
|
|
580
590
|
}
|
|
@@ -594,12 +604,12 @@ class Be extends ie {
|
|
|
594
604
|
this._disposables.push(e.onDiagnosticsChange((r) => {
|
|
595
605
|
this._preparingArcade || (this._diagnostics = r.diagnostics, this.arcgisDiagnosticsChange.emit(r.diagnostics));
|
|
596
606
|
})), this._canExecute && !this._executeScriptAction && this._addExecuteScriptAction(), this._syncAskAiAction();
|
|
597
|
-
const s =
|
|
598
|
-
this._disposables.push({ dispose: () => s.remove() }, { dispose: () => i.remove() }, { dispose: () =>
|
|
607
|
+
const s = I(() => this._debuggerState.editorBreakpoints, () => this._updateBreakpointsDecorations(), { sync: !0 }), i = I(() => this._debuggerState.debuggerLine, () => this._updateDebuggerPausedLineDecoration(), { sync: !0 }), n = I(() => this._debuggerState.consoleLogs.length, () => this.requestUpdate(), { sync: !0 });
|
|
608
|
+
this._disposables.push({ dispose: () => s.remove() }, { dispose: () => i.remove() }, { dispose: () => n.remove() });
|
|
599
609
|
const o = this.editorInstance?.onMouseDown((r) => this._onEditorMouseDown(r));
|
|
600
610
|
o && this._disposables.push(o);
|
|
601
|
-
const
|
|
602
|
-
|
|
611
|
+
const a = this.editorInstance?.onDidChangeModelContent((r) => this._onEditorModelContentChange(r));
|
|
612
|
+
a && this._disposables.push(a), this._updateBreakpointsDecorations(), this._updateDebuggerPausedLineDecoration();
|
|
603
613
|
})();
|
|
604
614
|
try {
|
|
605
615
|
await this._connectMonacoCustomizationsPromise;
|
|
@@ -617,7 +627,7 @@ class Be extends ie {
|
|
|
617
627
|
if (!this.enableDebugger || !this._debuggerState.editorBreakpoints.length || e.isFlush)
|
|
618
628
|
return;
|
|
619
629
|
const s = be(this._debuggerState.editorBreakpoints, e.changes);
|
|
620
|
-
s.length === this._debuggerState.editorBreakpoints.length && s.every((i,
|
|
630
|
+
s.length === this._debuggerState.editorBreakpoints.length && s.every((i, n) => i === this._debuggerState.editorBreakpoints[n]) || this._debuggerState.setBreakpoints(s);
|
|
621
631
|
}
|
|
622
632
|
_updateDebuggerPausedLineDecoration() {
|
|
623
633
|
const e = this.editorInstance;
|
|
@@ -650,17 +660,17 @@ class Be extends ie {
|
|
|
650
660
|
this._abortExternalExecution(), this._debuggerState.stopDebug({ hidePanel: !1 });
|
|
651
661
|
}
|
|
652
662
|
_resetDebugSession() {
|
|
653
|
-
this._abortExternalExecution(), this._debuggerState.resetDebug(), this._executeScript("debug").catch(
|
|
663
|
+
this._abortExternalExecution(), this._debuggerState.resetDebug(), this._executeScript("debug").catch(g(this));
|
|
654
664
|
}
|
|
655
665
|
async _handleDebugPause(e, s, i) {
|
|
656
666
|
if (!this._debuggerState.isDebugging || e !== this._debuggerState.sessionId)
|
|
657
667
|
return;
|
|
658
|
-
const
|
|
668
|
+
const n = Promise.withResolvers();
|
|
659
669
|
return this._debuggerState.pauseDebug({
|
|
660
670
|
line: s.line,
|
|
661
671
|
result: i,
|
|
662
|
-
continue:
|
|
663
|
-
}), await
|
|
672
|
+
continue: n
|
|
673
|
+
}), await n.promise;
|
|
664
674
|
}
|
|
665
675
|
async _updateDataModelDeps() {
|
|
666
676
|
await this._updateEditorProfile(), await this._updateApiLibrary();
|
|
@@ -668,21 +678,21 @@ class Be extends ie {
|
|
|
668
678
|
async _executeWithExternalExecutor(e, s, i) {
|
|
669
679
|
if (!this.externalExecutor)
|
|
670
680
|
return { type: "error", value: "Missing external executor", error: null };
|
|
671
|
-
const
|
|
672
|
-
this._abortExternalExecution(), this._externalExecutionAbortController =
|
|
681
|
+
const n = new AbortController();
|
|
682
|
+
this._abortExternalExecution(), this._externalExecutionAbortController = n;
|
|
673
683
|
const o = i.console ?? (() => {
|
|
674
684
|
});
|
|
675
685
|
try {
|
|
676
686
|
if (e === "debug") {
|
|
677
|
-
const { breakpoints:
|
|
678
|
-
if (!
|
|
687
|
+
const { breakpoints: a, onDebugPause: r } = i;
|
|
688
|
+
if (!a || !r)
|
|
679
689
|
throw new Error("Missing debug execution options");
|
|
680
690
|
return await this.externalExecutor.execute({
|
|
681
691
|
mode: "debug",
|
|
682
692
|
script: s,
|
|
683
693
|
console: o,
|
|
684
|
-
signal:
|
|
685
|
-
breakpoints:
|
|
694
|
+
signal: n.signal,
|
|
695
|
+
breakpoints: a,
|
|
686
696
|
onDebugPause: r
|
|
687
697
|
});
|
|
688
698
|
}
|
|
@@ -690,28 +700,31 @@ class Be extends ie {
|
|
|
690
700
|
mode: "run",
|
|
691
701
|
script: s,
|
|
692
702
|
console: o,
|
|
693
|
-
signal:
|
|
703
|
+
signal: n.signal
|
|
694
704
|
});
|
|
695
|
-
} catch (
|
|
705
|
+
} catch (a) {
|
|
696
706
|
return {
|
|
697
707
|
type: "error",
|
|
698
|
-
value: "Execution failed",
|
|
699
|
-
error:
|
|
708
|
+
value: (a instanceof Error ? a : new Error(String(a))).message ?? "Execution failed",
|
|
709
|
+
error: a instanceof Error ? a : new Error(String(a)),
|
|
710
|
+
compilationTime: 0,
|
|
711
|
+
executionTime: 0,
|
|
712
|
+
timeStamp: /* @__PURE__ */ new Date()
|
|
700
713
|
};
|
|
701
714
|
} finally {
|
|
702
|
-
this._externalExecutionAbortController ===
|
|
715
|
+
this._externalExecutionAbortController === n && (this._externalExecutionAbortController = void 0);
|
|
703
716
|
}
|
|
704
717
|
}
|
|
705
718
|
_executionContextChanged() {
|
|
706
|
-
!this._canExecute && this._executeScriptAction && (this._disposeSafely(this._executeScriptAction), this._executeScriptAction = void 0), this._canExecute && !this._executeScriptAction && this._addExecuteScriptAction(), !this.testData && this.enableDebugger && this._debuggerState.clearForMissingTestData(), this._debuggerState.openedPanel === "debug-console" && !this.enableDebugger && this._debuggerState.closePanel(), this._debuggerState.showPanel && this._executeScript("run").catch(
|
|
719
|
+
!this._canExecute && this._executeScriptAction && (this._disposeSafely(this._executeScriptAction), this._executeScriptAction = void 0), this._canExecute && !this._executeScriptAction && this._addExecuteScriptAction(), !this.testData && this.enableDebugger && this._debuggerState.clearForMissingTestData(), this._debuggerState.openedPanel === "debug-console" && !this.enableDebugger && this._debuggerState.closePanel(), this._debuggerState.showPanel && this._executeScript("run").catch(g(this));
|
|
707
720
|
}
|
|
708
721
|
async _updateEditorProfile() {
|
|
709
722
|
this._preparingArcade = !0;
|
|
710
723
|
try {
|
|
711
|
-
await
|
|
724
|
+
await E.setProfileForModel(this._modelId, this.profile, {
|
|
712
725
|
locale: this.messages._t9nLocale,
|
|
713
726
|
snippets: this.snippets
|
|
714
|
-
}), this._editorProfile =
|
|
727
|
+
}), this._editorProfile = E.getEditorProfileForModel(this._modelId);
|
|
715
728
|
} catch {
|
|
716
729
|
this._editorProfile = void 0;
|
|
717
730
|
} finally {
|
|
@@ -719,7 +732,7 @@ class Be extends ie {
|
|
|
719
732
|
}
|
|
720
733
|
}
|
|
721
734
|
async _updateApiLibrary() {
|
|
722
|
-
this._apiLibrary = await
|
|
735
|
+
this._apiLibrary = await E.getApiLibraryForModel(this._modelId);
|
|
723
736
|
}
|
|
724
737
|
_setExecutionPanel(e) {
|
|
725
738
|
this._debuggerState.setPanel(e);
|
|
@@ -728,37 +741,47 @@ class Be extends ie {
|
|
|
728
741
|
const s = this.testData, i = this.externalExecutor;
|
|
729
742
|
if (!this._codeEditorElt.value || !s && !i)
|
|
730
743
|
return;
|
|
731
|
-
const
|
|
744
|
+
const n = e === "debug" ? this._debuggerState.startDebug() : this._debuggerState.startRun();
|
|
732
745
|
setTimeout(() => {
|
|
733
746
|
(async () => {
|
|
734
|
-
const o = this._codeEditorElt.value?.value ?? this.script,
|
|
747
|
+
const o = this._codeEditorElt.value?.value ?? this.script, a = {
|
|
735
748
|
mode: e,
|
|
736
|
-
console: (
|
|
749
|
+
console: (u) => this._debuggerState.addConsoleLog(u),
|
|
737
750
|
breakpoints: e === "debug" ? this._debuggerState.debuggerBreakpoints : void 0
|
|
738
751
|
};
|
|
739
|
-
e === "debug" && (
|
|
740
|
-
let r;
|
|
741
|
-
if (i)
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
752
|
+
e === "debug" && (a.onDebugPause = this._handleDebugPause.bind(this, n));
|
|
753
|
+
let r, m;
|
|
754
|
+
if (i) {
|
|
755
|
+
const u = await this._executeWithExternalExecutor(e, o, a);
|
|
756
|
+
"result" in u ? (r = u.result, m = u.timing) : r = u;
|
|
757
|
+
} else if (s) {
|
|
758
|
+
const u = await this._editorProfilePromise;
|
|
759
|
+
if (!u) {
|
|
746
760
|
this._debuggerState.fail({ type: "error", value: "Missing editor profile", error: null });
|
|
747
761
|
return;
|
|
748
762
|
}
|
|
749
|
-
r = await K(
|
|
763
|
+
r = await K(u.definition, o, s, a);
|
|
750
764
|
} else
|
|
751
765
|
return;
|
|
752
|
-
if (
|
|
766
|
+
if (n === this._debuggerState.sessionId) {
|
|
753
767
|
if (e === "debug") {
|
|
754
|
-
if (
|
|
768
|
+
if ($(r)) {
|
|
755
769
|
this._debuggerState.fail(r);
|
|
756
770
|
return;
|
|
757
771
|
}
|
|
758
|
-
this._debuggerState.completeDebug(r);
|
|
772
|
+
this._debuggerState.completeDebug(r, m);
|
|
759
773
|
return;
|
|
760
774
|
}
|
|
761
|
-
|
|
775
|
+
if ($(r))
|
|
776
|
+
this._debuggerState.completeRun(r);
|
|
777
|
+
else if (i) {
|
|
778
|
+
if (!m) {
|
|
779
|
+
this._debuggerState.fail({ type: "error", value: "Missing execution timing", error: null });
|
|
780
|
+
return;
|
|
781
|
+
}
|
|
782
|
+
this._debuggerState.completeRun(r, { useDebugRenderer: !0, timing: m });
|
|
783
|
+
} else
|
|
784
|
+
this._debuggerState.fail({ type: "error", value: "Unexpected debug result", error: null });
|
|
762
785
|
}
|
|
763
786
|
})();
|
|
764
787
|
}, 0);
|
|
@@ -773,13 +796,13 @@ class Be extends ie {
|
|
|
773
796
|
e.stopPropagation(), this.script = e.detail, this.arcgisScriptChange.emit(e.detail);
|
|
774
797
|
}
|
|
775
798
|
_insertAsSnippet(e) {
|
|
776
|
-
this._codeEditorElt.value?.insertSnippet(e.detail).catch(
|
|
799
|
+
this._codeEditorElt.value?.insertSnippet(e.detail).catch(g(this));
|
|
777
800
|
}
|
|
778
801
|
_insertAsText(e) {
|
|
779
802
|
this._insertText(e.detail);
|
|
780
803
|
}
|
|
781
804
|
_insertText(e) {
|
|
782
|
-
this._codeEditorElt.value?.insertText(e).catch(
|
|
805
|
+
this._codeEditorElt.value?.insertText(e).catch(g(this));
|
|
783
806
|
}
|
|
784
807
|
_onResultPanelChange(e) {
|
|
785
808
|
const s = e.currentTarget;
|
|
@@ -793,17 +816,17 @@ class Be extends ie {
|
|
|
793
816
|
// An unique identifier for the action.
|
|
794
817
|
id: "run-script",
|
|
795
818
|
label: "Run Arcade Expression",
|
|
796
|
-
keybindings: [
|
|
819
|
+
keybindings: [me.F5],
|
|
797
820
|
contextMenuGroupId: "code",
|
|
798
821
|
contextMenuOrder: 1,
|
|
799
822
|
run: () => {
|
|
800
|
-
this._canExecute && this._executeScript("run").catch(
|
|
823
|
+
this._canExecute && this._executeScript("run").catch(g(this));
|
|
801
824
|
}
|
|
802
825
|
});
|
|
803
826
|
e && (this._executeScriptAction = e, this._disposables.push(e));
|
|
804
827
|
}
|
|
805
828
|
_getAskAiBindingKey() {
|
|
806
|
-
return
|
|
829
|
+
return _e.parse(this._modelId).toString();
|
|
807
830
|
}
|
|
808
831
|
_canRenderAskAiCodeActions() {
|
|
809
832
|
const e = this._arcadeAssistantRemoteState;
|
|
@@ -850,7 +873,7 @@ class Be extends ie {
|
|
|
850
873
|
run: (i) => {
|
|
851
874
|
this.openArcadeAssistant({
|
|
852
875
|
prompt: i ?? this.messages.askarcadeassistantprompt ?? "Fix the errors in my script"
|
|
853
|
-
}).catch(
|
|
876
|
+
}).catch(g(this));
|
|
854
877
|
}
|
|
855
878
|
}), this._askAiBindingKey = s;
|
|
856
879
|
}
|
|
@@ -864,14 +887,14 @@ class Be extends ie {
|
|
|
864
887
|
}
|
|
865
888
|
renderMainActionBar() {
|
|
866
889
|
return this._usesBottomExecutionDrawer || !this._canExecute ? null : d`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-toggle-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run ?? ""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${() => {
|
|
867
|
-
this._executeScript("run").catch(
|
|
890
|
+
this._executeScript("run").catch(g(this));
|
|
868
891
|
}}></calcite-action>${this._debuggerState.result ? d`<calcite-action .text=${this.messages.lastresults ?? ""} .active=${this._debuggerState.showPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>` : null}</calcite-action-group></calcite-action-bar>`;
|
|
869
892
|
}
|
|
870
893
|
renderMainPanel() {
|
|
871
|
-
return d`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${
|
|
894
|
+
return d`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${E.languageId} .value=${this.script ?? ""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${V(this._codeEditorElt)}></arcgis-code-editor>`;
|
|
872
895
|
}
|
|
873
|
-
renderAction({ id: e, label: s, icon: i, active:
|
|
874
|
-
return d`<calcite-action id=${e ?? O} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${
|
|
896
|
+
renderAction({ id: e, label: s, icon: i, active: n, panelName: o, iconFlipRtl: a = !1, onClick: r = this._toggleSidePanel }) {
|
|
897
|
+
return d`<calcite-action id=${e ?? O} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${n} @click=${r} data-panel-name=${o ?? O} .iconFlipRtl=${a}></calcite-action>${!this.sideActionBarExpanded && d`<calcite-tooltip .referenceElement=${e}><span>${s}</span></calcite-tooltip>` || ""}`;
|
|
875
898
|
}
|
|
876
899
|
renderSideActionBar() {
|
|
877
900
|
return this.hideSideBar ? null : d`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({
|
|
@@ -941,23 +964,23 @@ class Be extends ie {
|
|
|
941
964
|
if (!this._debuggerState.showPanel)
|
|
942
965
|
return null;
|
|
943
966
|
const e = this._debuggerState.openedPanel === "debug-console" ? "output" : this._debuggerState.openedPanel;
|
|
944
|
-
return d`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`;
|
|
967
|
+
return d`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.runResult} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`;
|
|
945
968
|
}
|
|
946
969
|
renderBottomExecutionBody() {
|
|
947
|
-
const { showPanel: e, openedPanel: s, debugResult: i, isExecuting:
|
|
970
|
+
const { showPanel: e, openedPanel: s, debugResult: i, isExecuting: n, mode: o } = this._debuggerState;
|
|
948
971
|
if (!e)
|
|
949
972
|
return null;
|
|
950
|
-
const
|
|
951
|
-
return this.enableDebugger && s === "debug-console" ? d`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>` : s === "output" && (o === "debug" || i) ? d`<arcgis-arcade-debugger-output .outputTitle=${this.messages.output} slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>` : d`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${
|
|
973
|
+
const a = s === "debug-console" ? "output" : s;
|
|
974
|
+
return this.enableDebugger && s === "debug-console" ? d`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>` : s === "output" && (o === "debug" || i) ? d`<arcgis-arcade-debugger-output .outputTitle=${this.messages.output} slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>` : d`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${a} .loading=${s === "console" && this._debuggerState.isPaused ? !1 : n} .result=${this._debuggerState.runResult} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`;
|
|
952
975
|
}
|
|
953
976
|
renderBottomActionBar() {
|
|
954
977
|
if (!this._usesBottomExecutionDrawer)
|
|
955
978
|
return null;
|
|
956
|
-
const { showPanel: e, hasExecuted: s, openedPanel: i, isDebugging:
|
|
957
|
-
return d`<div slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e ? "" : "is-collapsed"}`}><calcite-action-bar class="bottom-action-bar__actions" layout=horizontal scale=s expand-toggle-disabled expanded><calcite-action-group scale=s>${this.enableDebugger &&
|
|
958
|
-
this._executeScript("run").catch(
|
|
959
|
-
}}></calcite-action>${this.enableDebugger && d`<calcite-action .disabled=${this._debuggerState.editorBreakpoints.length === 0} .text=${this.messages.runanddebug ?? "Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade ||
|
|
960
|
-
this._executeScript("debug").catch(
|
|
979
|
+
const { showPanel: e, hasExecuted: s, openedPanel: i, isDebugging: n, isPaused: o, isExecuting: a } = this._debuggerState, r = this.messages.continue ?? "Continue", m = this.messages.reset ?? "Reset", u = this.messages.stop ?? "Stop";
|
|
980
|
+
return d`<div slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e ? "" : "is-collapsed"}`}><calcite-action-bar class="bottom-action-bar__actions" layout=horizontal scale=s expand-toggle-disabled expanded><calcite-action-group scale=s>${this.enableDebugger && n ? d`<calcite-action id=debugger-continue-action .text=${r} icon=forward scale=s .disabled=${!o} @click=${this._continueDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-continue-action placement=top><span>${r}</span></calcite-tooltip><calcite-action id=debugger-reset-action .text=${m} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-reset-action placement=top><span>${m}</span></calcite-tooltip><calcite-action id=debugger-stop-action .text=${u} icon=circle-stop scale=s @click=${this._stopDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-stop-action placement=top><span>${u}</span></calcite-tooltip>` : d`<calcite-action .text=${this.messages.run ?? ""} text-enabled icon=play scale=s .loading=${this._preparingArcade || a} @click=${() => {
|
|
981
|
+
this._executeScript("run").catch(g(this));
|
|
982
|
+
}}></calcite-action>${this.enableDebugger && d`<calcite-action .disabled=${this._debuggerState.editorBreakpoints.length === 0} .text=${this.messages.runanddebug ?? "Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade || a} @click=${() => {
|
|
983
|
+
this._executeScript("debug").catch(g(this));
|
|
961
984
|
}}></calcite-action>` || ""}`}</calcite-action-group>${s ? d`<calcite-action-group scale=s><calcite-action .active=${i === "output" && e} .text=${this.messages.output ?? "Output"} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${() => this._setExecutionPanel("output")}></calcite-action><calcite-action .active=${i === "console" && e} .text=${this.messages.console ?? "Console"} text-enabled scale=s icon=console icon-flip-rtl @click=${() => this._setExecutionPanel("console")}></calcite-action><calcite-action .active=${i === "log" && e} .text=${this.messages.log ?? "Log"} text-enabled scale=s icon=list icon-flip-rtl @click=${() => this._setExecutionPanel("log")} .disabled=${this.enableDebugger && this._debuggerState.mode === "debug"}></calcite-action>${this.enableDebugger && d`<calcite-action .active=${i === "debug-console" && e} .text=${this.messages.debugconsole ?? "Debug Console"} text-enabled scale=s icon=debug-script .disabled=${this._debuggerState.mode !== "debug"} @click=${() => this._setExecutionPanel("debug-console")}></calcite-action>` || ""}</calcite-action-group>` : null}</calcite-action-bar>${e ? d`<calcite-action .text=${this.messages.close ?? "Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose} slot=actions-end></calcite-action>` : null}</div>`;
|
|
962
985
|
}
|
|
963
986
|
render() {
|