@vertigis/viewer-spec 43.6.0 → 44.0.0

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,4 +1,5 @@
1
1
  import type { CancelToken } from "@vertigis/arcgis-extensions/support/Cancellable";
2
+ import type { Event } from "./Event.js";
2
3
  import type { Message, MessageExecuteOptions } from "./Message.js";
3
4
  /**
4
5
  * A named operation. Operations compute a value, but don't generally alter the
@@ -9,6 +10,15 @@ export interface Operation<T = void, TResult = undefined> extends Message {
9
10
  * The name of the operation.
10
11
  */
11
12
  name: string;
13
+ /**
14
+ * An event that is published whenever canExecute might return a new value.
15
+ * Implementations are responsible for calling publish() as appropriate.
16
+ */
17
+ readonly canExecuteChanged: Event;
18
+ /**
19
+ * Indicates whether the operation has been initialized.
20
+ */
21
+ readonly isInitialized: boolean;
12
22
  /**
13
23
  * Executes the operation and returns its result.
14
24
  *
@@ -17,6 +27,18 @@ export interface Operation<T = void, TResult = undefined> extends Message {
17
27
  * behavior.
18
28
  */
19
29
  execute: (argument: T, options?: CancelToken | MessageExecuteOptions) => Promise<TResult>;
30
+ /**
31
+ * Determines whether the operation can execute with the given arguments.
32
+ *
33
+ * @param argument The operation arguments.
34
+ */
35
+ canExecute(argument?: T): boolean;
36
+ /**
37
+ * Initializes the operation if it is not already initialized. Attempting to
38
+ * execute an operation will automatically initialize it, however calling
39
+ * canExecute() will always return false until the operation is initialized.
40
+ */
41
+ initialize(): Promise<void>;
20
42
  }
21
43
  /**
22
44
  * Context that will be passed in to each behavior for an operation.
@@ -1,5 +1,6 @@
1
1
  import { OperationRegistry } from "../OperationRegistry.js";
2
2
  import { AppOperations } from "./app.js";
3
+ import { ArcadeOperations } from "./arcade.js";
3
4
  import { AuthOperations } from "./auth.js";
4
5
  import { BasemapOperations } from "./basemap.js";
5
6
  import { ChartOperations } from "./charts.js";
@@ -24,6 +25,7 @@ import { TasksOperations } from "./tasks.js";
24
25
  import { UIOperations } from "./ui.js";
25
26
  import { ViewerOperations } from "./viewer.js";
26
27
  export declare class Operations extends OperationRegistry {
28
+ readonly arcade: ArcadeOperations;
27
29
  readonly auth: AuthOperations;
28
30
  readonly app: AppOperations;
29
31
  readonly basemap: BasemapOperations;
@@ -1 +1 @@
1
- import{OperationRegistry}from"../OperationRegistry.js";import{AppOperations}from"./app.js";import{AuthOperations}from"./auth.js";import{BasemapOperations}from"./basemap.js";import{ChartOperations}from"./charts.js";import{DebugConsoleOperations}from"./debugConsole.js";import{DrawingOperations}from"./drawing.js";import{FileOperations}from"./file.js";import{GeocodeOperations}from"./geocode.js";import{GeolocationOperations}from"./geolocation.js";import{GeometryOperations}from"./geometry.js";import{HighlightsOperations}from"./highlights.js";import{KpiOperations}from"./kpi.js";import{LogViewerOperations}from"./logViewer.js";import{MapOperations}from"./map.js";import{MeasurementOperations}from"./measurement.js";import{MessagingOperations}from"./messaging.js";import{NetworkOperations}from"./network.js";import{OfflineOperations}from"./offline.js";import{ResultsOperations}from"./results.js";import{SketchingOperations}from"./sketching.js";import{SystemOperations}from"./system.js";import{TasksOperations}from"./tasks.js";import{UIOperations}from"./ui.js";import{ViewerOperations}from"./viewer.js";export class Operations extends OperationRegistry{constructor(){super(...arguments),this.auth=new AuthOperations(this._messages),this.app=new AppOperations(this._messages),this.basemap=new BasemapOperations(this._messages),this.charts=new ChartOperations(this._messages),this.drawing=new DrawingOperations(this._messages),this.file=new FileOperations(this._messages),this.geocode=new GeocodeOperations(this._messages),this.geolocation=new GeolocationOperations(this._messages),this.geometry=new GeometryOperations(this._messages),this.highlights=new HighlightsOperations(this._messages),this.kpi=new KpiOperations(this._messages),this.logViewer=new LogViewerOperations(this._messages),this.map=new MapOperations(this._messages),this.measurement=new MeasurementOperations(this._messages),this.messaging=new MessagingOperations(this._messages),this.network=new NetworkOperations(this._messages),this.offline=new OfflineOperations(this._messages),this.sketching=new SketchingOperations(this._messages),this.system=new SystemOperations(this._messages),this.results=new ResultsOperations(this._messages),this.tasks=new TasksOperations(this._messages),this.ui=new UIOperations(this._messages),this.viewer=new ViewerOperations(this._messages),this.debugConsole=new DebugConsoleOperations(this._messages)}}
1
+ import{OperationRegistry}from"../OperationRegistry.js";import{AppOperations}from"./app.js";import{ArcadeOperations}from"./arcade.js";import{AuthOperations}from"./auth.js";import{BasemapOperations}from"./basemap.js";import{ChartOperations}from"./charts.js";import{DebugConsoleOperations}from"./debugConsole.js";import{DrawingOperations}from"./drawing.js";import{FileOperations}from"./file.js";import{GeocodeOperations}from"./geocode.js";import{GeolocationOperations}from"./geolocation.js";import{GeometryOperations}from"./geometry.js";import{HighlightsOperations}from"./highlights.js";import{KpiOperations}from"./kpi.js";import{LogViewerOperations}from"./logViewer.js";import{MapOperations}from"./map.js";import{MeasurementOperations}from"./measurement.js";import{MessagingOperations}from"./messaging.js";import{NetworkOperations}from"./network.js";import{OfflineOperations}from"./offline.js";import{ResultsOperations}from"./results.js";import{SketchingOperations}from"./sketching.js";import{SystemOperations}from"./system.js";import{TasksOperations}from"./tasks.js";import{UIOperations}from"./ui.js";import{ViewerOperations}from"./viewer.js";export class Operations extends OperationRegistry{constructor(){super(...arguments),this.arcade=new ArcadeOperations(this._messages),this.auth=new AuthOperations(this._messages),this.app=new AppOperations(this._messages),this.basemap=new BasemapOperations(this._messages),this.charts=new ChartOperations(this._messages),this.drawing=new DrawingOperations(this._messages),this.file=new FileOperations(this._messages),this.geocode=new GeocodeOperations(this._messages),this.geolocation=new GeolocationOperations(this._messages),this.geometry=new GeometryOperations(this._messages),this.highlights=new HighlightsOperations(this._messages),this.kpi=new KpiOperations(this._messages),this.logViewer=new LogViewerOperations(this._messages),this.map=new MapOperations(this._messages),this.measurement=new MeasurementOperations(this._messages),this.messaging=new MessagingOperations(this._messages),this.network=new NetworkOperations(this._messages),this.offline=new OfflineOperations(this._messages),this.sketching=new SketchingOperations(this._messages),this.system=new SystemOperations(this._messages),this.results=new ResultsOperations(this._messages),this.tasks=new TasksOperations(this._messages),this.ui=new UIOperations(this._messages),this.viewer=new ViewerOperations(this._messages),this.debugConsole=new DebugConsoleOperations(this._messages)}}
@@ -0,0 +1,100 @@
1
+ import type { ItemRef } from "app-config/common/ItemRef.js";
2
+ import type { Operation } from "../Operation.js";
3
+ import { OperationRegistry } from "../OperationRegistry.js";
4
+ import type { Model } from "../common.js";
5
+ /**
6
+ * The arguments for the arcade.run operation.
7
+ */
8
+ export interface RunArcadeArgs {
9
+ /**
10
+ * The stringified Arcade script to run. If this property is included, the
11
+ * operation will return the result of the script.
12
+ */
13
+ executeScript?: string;
14
+ /**
15
+ * The stringified Arcade script used to determine whether or not the
16
+ * executeScript can/should be run. If no executeScript is provided and the
17
+ * canExecuteScript returns a truthy value, the operation will return its
18
+ * input arguments; otherwise, if the canEecuteScript returns a falsey
19
+ * value, it will throw a {@link Cancellation}.
20
+ */
21
+ canExecuteScript?: string;
22
+ /**
23
+ * An arguments object that provides named variables and associated values,
24
+ * which can be referenced from within the executeScript and
25
+ * canExecuteScript.
26
+ *
27
+ * NOTE: All variable keys must consist of only lowercase letters;
28
+ * camel-cased context variables will break the script when they are
29
+ * referenced at runtime.
30
+ */
31
+ arguments?: Record<string, unknown | ItemPropertyPath>;
32
+ /**
33
+ * Properties used to set a series of watch handles and/or event listeners
34
+ * on an item that will trigger the canExecuteChanged event for the
35
+ * 'arcade.run' operation.
36
+ */
37
+ watchHandles?: WatchEventHandleProperties[];
38
+ }
39
+ /**
40
+ * An object containing a propertyPath that used to retrieve a property value
41
+ * from the given item.
42
+ */
43
+ export interface ItemPropertyPath {
44
+ /**
45
+ * The item from which to access a property value.
46
+ */
47
+ item: ItemRef | Model;
48
+ /**
49
+ * The path to a property on an item.
50
+ */
51
+ propertyPath: string;
52
+ }
53
+ export declare class ArcadeOperations extends OperationRegistry {
54
+ /**
55
+ * Runs a stringified Arcade script. If only a string is passed in as an
56
+ * argument, it is interpreted as an executeScript. If an executeSript is
57
+ * provided, the operation will return its result. If only a canExecute
58
+ * script is provided and it returns a truthy result, the operation will
59
+ * return its input arguments. If a canExecuteScript returns a falsey value,
60
+ * the operation will throw a {@link Cancellation}.
61
+ *
62
+ * @webOnly
63
+ *
64
+ */
65
+ get run(): Operation<RunArcadeArgs | string, unknown>;
66
+ }
67
+ /**
68
+ * Properties used to set a series of watch handles and/or event listeners on
69
+ * an item.
70
+ */
71
+ export interface WatchEventHandleProperties {
72
+ /**
73
+ * The item whose properties will be watched for changes and/or events.
74
+ */
75
+ item: ItemRef | Model;
76
+ /**
77
+ * One or more properties on the item that will be watched for changes
78
+ * and/or events. Any strings will be used as propertyPaths that will be
79
+ * watched for changes; for this to work, the item and all properties
80
+ * referenced within the path (except for the last) must implement
81
+ * {@link Observable}.
82
+ */
83
+ watch: string | WatchEventProperty | (string | WatchEventProperty)[];
84
+ }
85
+ /**
86
+ * Properties on an item to watch, with an optional event name to listen for.
87
+ */
88
+ export interface WatchEventProperty {
89
+ /**
90
+ * The path used to target a property on an item that will be watched for
91
+ * events. The watched property must implement {@link Evented}; this will
92
+ * effectively do `item[propertyPath].on(eventName)`.
93
+ */
94
+ propertyPath?: string;
95
+ /**
96
+ * The name of the event to listen for. If no propertyPath is included, the
97
+ * listener will go directly on the watched item.
98
+ */
99
+ eventName: string;
100
+ }
@@ -0,0 +1 @@
1
+ import{OperationRegistry}from"../OperationRegistry.js";export class ArcadeOperations extends OperationRegistry{get run(){return this._messages.operation("arcade.run")}}
@@ -3480,6 +3480,31 @@
3480
3480
  ],
3481
3481
  "type": "object"
3482
3482
  },
3483
+ "RunArcadeArgs": {
3484
+ "additionalProperties": false,
3485
+ "description": "The arguments for the arcade.run operation.",
3486
+ "properties": {
3487
+ "arguments": {
3488
+ "description": "An arguments object that provides named variables and associated values, which can be referenced from within the executeScript and canExecuteScript. NOTE: All variable keys must consist of only lowercase letters; camel-cased context variables will break the script when they are referenced at runtime."
3489
+ },
3490
+ "canExecuteScript": {
3491
+ "description": "The stringified Arcade script used to determine whether or not the executeScript can/should be run. If no executeScript is provided and the canExecuteScript returns a truthy value, the operation will return its input arguments; otherwise, if the canEecuteScript returns a falsey value, it will throw a {@link Cancellation}.",
3492
+ "type": "string"
3493
+ },
3494
+ "executeScript": {
3495
+ "description": "The stringified Arcade script to run. If this property is included, the operation will return the result of the script.",
3496
+ "type": "string"
3497
+ },
3498
+ "watchHandles": {
3499
+ "description": "Properties used to set a series of watch handles and/or event listeners on an item that will trigger the canExecuteChanged event for the 'arcade.run' operation.",
3500
+ "items": {
3501
+ "$ref": "#/definitions/WatchEventHandleProperties"
3502
+ },
3503
+ "type": "array"
3504
+ }
3505
+ },
3506
+ "type": "object"
3507
+ },
3483
3508
  "RunPrintArgs": {
3484
3509
  "additionalProperties": false,
3485
3510
  "description": "The arguments required by the printing.run command.",
@@ -4770,6 +4795,70 @@
4770
4795
  "description": "A component's visual state. The values will vary based on the component type.",
4771
4796
  "type": "string"
4772
4797
  },
4798
+ "WatchEventHandleProperties": {
4799
+ "additionalProperties": false,
4800
+ "description": "Properties used to set a series of watch handles and/or event listeners on an item.",
4801
+ "properties": {
4802
+ "item": {
4803
+ "anyOf": [
4804
+ {
4805
+ "$ref": "#/definitions/Model"
4806
+ },
4807
+ {
4808
+ "type": "string"
4809
+ }
4810
+ ],
4811
+ "description": "The item whose properties will be watched for changes and/or events."
4812
+ },
4813
+ "watch": {
4814
+ "anyOf": [
4815
+ {
4816
+ "$ref": "#/definitions/WatchEventProperty"
4817
+ },
4818
+ {
4819
+ "items": {
4820
+ "anyOf": [
4821
+ {
4822
+ "$ref": "#/definitions/WatchEventProperty"
4823
+ },
4824
+ {
4825
+ "type": "string"
4826
+ }
4827
+ ]
4828
+ },
4829
+ "type": "array"
4830
+ },
4831
+ {
4832
+ "type": "string"
4833
+ }
4834
+ ],
4835
+ "description": "One or more properties on the item that will be watched for changes and/or events. Any strings will be used as propertyPaths that will be watched for changes; for this to work, the item and all properties referenced within the path (except for the last) must implement {@link Observable}."
4836
+ }
4837
+ },
4838
+ "required": [
4839
+ "item",
4840
+ "watch"
4841
+ ],
4842
+ "type": "object"
4843
+ },
4844
+ "WatchEventProperty": {
4845
+ "additionalProperties": false,
4846
+ "description": "Properties on an item to watch, with an optional event name to listen for.",
4847
+ "properties": {
4848
+ "eventName": {
4849
+ "description": "The name of the event to listen for. If no propertyPath is included, the listener will go directly on the watched item.",
4850
+ "type": "string"
4851
+ },
4852
+ "propertyPath": {
4853
+ "description": "The path used to target a property on an item that will be watched for events. The watched property must implement {@link Evented}; this will effectively do `item[propertyPath].on(eventName)`.",
4854
+ "type": "string"
4855
+ }
4856
+ },
4857
+ "required": [
4858
+ "eventName"
4859
+ ],
4860
+ "type": "object"
4861
+ },
4773
4862
  "ZoomToLayerArgs": {
4774
4863
  "additionalProperties": false,
4775
4864
  "description": "Arguments for the map.zoom-to-layer-extent and map.zoom-to-layer-visible-scale commands.",
@@ -4880,6 +4969,22 @@
4880
4969
  }
4881
4970
  ]
4882
4971
  },
4972
+ "arcade.run": {
4973
+ "description": "Runs a stringified Arcade script. If only a string is passed in as an argument, it is interpreted as an executeScript. If an executeSript is provided, the operation will return its result. If only a canExecute script is provided and it returns a truthy result, the operation will return its input arguments. If a canExecuteScript returns a falsey value, the operation will throw a {@link Cancellation}.",
4974
+ "enum": [
4975
+ "arcade.run"
4976
+ ]
4977
+ },
4978
+ "arcade.run:input": {
4979
+ "anyOf": [
4980
+ {
4981
+ "$ref": "#/definitions/RunArcadeArgs"
4982
+ },
4983
+ {
4984
+ "type": "string"
4985
+ }
4986
+ ]
4987
+ },
4883
4988
  "auth.get-current-user": {
4884
4989
  "description": "Gets the user that is currently signed into the application.",
4885
4990
  "enum": [
@@ -17075,6 +17180,22 @@
17075
17180
  ],
17076
17181
  "type": "object"
17077
17182
  },
17183
+ {
17184
+ "additionalProperties": false,
17185
+ "properties": {
17186
+ "arguments": {
17187
+ "$ref": "#/definitions/arcade.run:input"
17188
+ },
17189
+ "name": {
17190
+ "$ref": "#/definitions/arcade.run"
17191
+ }
17192
+ },
17193
+ "required": [
17194
+ "name",
17195
+ "arguments"
17196
+ ],
17197
+ "type": "object"
17198
+ },
17078
17199
  {
17079
17200
  "additionalProperties": false,
17080
17201
  "properties": {
@@ -18902,6 +19023,9 @@
18902
19023
  {
18903
19024
  "$ref": "#/definitions/app.load-project"
18904
19025
  },
19026
+ {
19027
+ "$ref": "#/definitions/arcade.run"
19028
+ },
18905
19029
  {
18906
19030
  "$ref": "#/definitions/auth.sign-in"
18907
19031
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertigis/viewer-spec",
3
- "version": "43.6.0",
3
+ "version": "44.0.0",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "VertiGIS Viewer Specification",
6
6
  "type": "module",
@@ -34,11 +34,11 @@
34
34
  },
35
35
  "author": "VertiGIS Ltd.",
36
36
  "peerDependencies": {
37
- "@vertigis/arcgis-extensions": ">= 33.5.4 < 34.0.0"
37
+ "@vertigis/arcgis-extensions": ">= 34.1.0 < 35.0.0"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@arcgis/core": "4.21.2",
41
- "@vertigis/arcgis-extensions": "33.5.4 ",
41
+ "@vertigis/arcgis-extensions": "34.1.0 ",
42
42
  "@types/glob": "7.1.4",
43
43
  "@types/json-stable-stringify": "1.0.33",
44
44
  "@types/node": "14.14.41",
package/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * The current version of the Geocortex Viewer Specification.
3
3
  */
4
- export declare const version = "43.6.0";
4
+ export declare const version = "44.0.0";
package/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * The current version of the Geocortex Viewer Specification.
3
3
  */
4
- export const version = "43.6.0";
4
+ export const version = "44.0.0";