@vertigis/workflow 5.41.0 → 5.43.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.
- package/Activator.d.ts +2 -1
- package/Collections.d.ts +4 -3
- package/Errors.d.ts +0 -10
- package/Errors.js +1 -1
- package/Hooks.d.ts +5 -4
- package/IActivityHandler.d.ts +2 -0
- package/ProgramInspectorFacility.d.ts +2 -1
- package/activities/arcgis/AddAttachment.js +1 -1
- package/activities/arcgis/AddFeatures.js +1 -1
- package/activities/arcgis/CreateFeatureSet.d.ts +1 -0
- package/activities/arcgis/CreateFeatureSet.js +1 -1
- package/activities/arcgis/DeleteAttachments.js +1 -1
- package/activities/arcgis/DeleteFeatures.js +1 -1
- package/activities/arcgis/DistanceServiceTask.js +1 -1
- package/activities/arcgis/FromGeoCoordinateStringServiceTask.js +1 -1
- package/activities/arcgis/Geocode.js +1 -1
- package/activities/arcgis/GeoprocessingAsync.js +1 -1
- package/activities/arcgis/GetCodedValueDomain.js +1 -1
- package/activities/arcgis/GetFeatureLayerInfo.js +1 -1
- package/activities/arcgis/LabelPointsServiceTask.js +1 -1
- package/activities/arcgis/MapProvider.d.ts +3 -0
- package/activities/arcgis/MapProvider.js +1 -1
- package/activities/arcgis/ProjectServiceTask.js +1 -1
- package/activities/arcgis/QueryAttachmentInfos.js +1 -1
- package/activities/arcgis/QueryTask.d.ts +10 -4
- package/activities/arcgis/QueryTask.js +1 -1
- package/activities/arcgis/RelationServiceTask.js +1 -1
- package/activities/arcgis/ReshapeServiceTask.js +1 -1
- package/activities/arcgis/ReverseGeocode.js +1 -1
- package/activities/arcgis/RouteTask.js +1 -1
- package/activities/arcgis/RunPrint.d.ts +4 -10
- package/activities/arcgis/RunPrint.js +1 -1
- package/activities/arcgis/RunReport.d.ts +0 -8
- package/activities/arcgis/RunReport.js +1 -1
- package/activities/arcgis/RunWorkflow.d.ts +0 -8
- package/activities/arcgis/RunWorkflow.js +1 -1
- package/activities/arcgis/ServiceAreaTask.js +1 -1
- package/activities/arcgis/SetImageryLayerOptions.d.ts +4 -0
- package/activities/arcgis/SetImageryLayerOptions.js +1 -1
- package/activities/arcgis/SymbolFromJson.js +1 -1
- package/activities/arcgis/ToGeoCoordinateStringServiceTask.js +1 -1
- package/activities/arcgis/TypeChecking.d.ts +1 -2
- package/activities/arcgis/UnionServiceTask.js +1 -1
- package/activities/arcgis/UpdateAttachment.js +1 -1
- package/activities/arcgis/UpdateFeatures.js +1 -1
- package/activities/arcgis/shared.d.ts +0 -3
- package/activities/arcgis/tools.d.ts +1 -10
- package/activities/arcgis/tools.js +1 -1
- package/activities/core/ChannelProvider.d.ts +1 -1
- package/activities/core/Subworkflow.d.ts +2 -0
- package/activities/core/WebRequest.d.ts +1 -1
- package/activities/essentials/RunEssentialsWorkflow.d.ts +1 -1
- package/activities/pdf/AddTextToPdf.d.ts +2 -2
- package/definition/ProgramInspector.d.ts +21 -13
- package/definition/ProgramInspector.js +1 -1
- package/definition/Transition.d.ts +1 -1
- package/execution/ActivityContext.d.ts +2 -2
- package/execution/ActivityContextProxy.d.ts +1 -1
- package/execution/AmbientState.d.ts +2 -1
- package/execution/AmbientStateProxy.d.ts +1 -0
- package/execution/AmbientStateProxy.js +1 -1
- package/execution/Engine.d.ts +8 -5
- package/execution/Engine.js +1 -1
- package/execution/ModuleLoader.d.ts +0 -28
- package/execution/ModuleLoader.js +1 -1
- package/execution/ProgramRunner.js +1 -1
- package/execution/util.js +1 -1
- package/forms/Calendar.d.ts +1 -1
- package/forms/FormDefinition.d.ts +1 -1
- package/forms/FormHost.d.ts +2 -2
- package/forms/components/AccordionGroup.js +1 -1
- package/forms/components/AutoComplete.js +1 -1
- package/forms/components/DatePicker.js +1 -1
- package/forms/components/DateTimePicker.js +1 -1
- package/forms/components/Form.js +1 -1
- package/forms/components/FormElement.js +1 -1
- package/forms/components/FormLabelNumberField.d.ts +1 -1
- package/forms/components/ListBox.d.ts +1 -1
- package/forms/components/ListBox.js +1 -1
- package/forms/components/Markdown.d.ts +1 -1
- package/forms/components/Markdown.js +1 -1
- package/forms/components/Number.js +1 -1
- package/forms/components/NumberRangeSlider.js +1 -1
- package/forms/components/NumberSlider.js +1 -1
- package/forms/components/Scanner.js +1 -1
- package/forms/components/SignatureDialog.d.ts +1 -1
- package/forms/components/SketchDialog.d.ts +2 -2
- package/forms/components/TimePicker.js +1 -1
- package/forms/components/common.d.ts +0 -1
- package/forms/customNumberFormat.d.ts +70 -0
- package/forms/customNumberFormat.js +1 -0
- package/forms/dateUtilities.d.ts +6 -6
- package/forms/dateUtilities.js +1 -1
- package/forms/hostContext.d.ts +2 -1
- package/forms/keyboard.d.ts +2 -8
- package/forms/numberFormatter.d.ts +0 -1
- package/forms/numberFormatter.js +1 -1
- package/forms/numberUtilities.d.ts +1 -13
- package/forms/numberUtilities.js +1 -1
- package/forms/utils.d.ts +0 -7
- package/forms/utils.js +1 -1
- package/libs/version.d.ts +1 -1
- package/libs/version.js +1 -1
- package/package.json +7 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import{solve}from"@arcgis/core/rest/serviceArea";import ServiceAreaParams from"@arcgis/core/rest/support/ServiceAreaParameters";import{activate}from"../../Hooks.js";import{validation}from"../../Validation.js";import{MapProvider}from"./MapProvider.js";
|
|
1
|
+
import{__decorate}from"tslib";import{solve}from"@arcgis/core/rest/serviceArea";import ServiceAreaParams from"@arcgis/core/rest/support/ServiceAreaParameters";import{activate}from"../../Hooks.js";import{validation}from"../../Validation.js";import{MapProvider}from"./MapProvider.js";let ServiceAreaTask=class{async execute(i,e,r){var t=validation.string("url",i.url,validation.never);const o=new ServiceAreaParams({facilities:validation.exists("facilities",i.facilities),accumulateAttributes:validation.array("accumulateAttributes",i.accumulateAttributes),attributeParameterValues:i.attributeParameterValues,defaultBreaks:i.defaultBreaks,excludeSourcesFromPolygons:i.excludeSourcesFromPolygons,impedanceAttribute:validation.string("impedanceAttribute",i.impedanceAttribute,void 0),mergeSimilarPolygonRanges:validation.boolean("mergeSimilarPolygonRanges",i.mergeSimilarPolygonRanges,void 0),outputGeometryPrecision:validation.number("outputGeometryPrecision",i.outputGeometryPrecision,void 0),outputGeometryPrecisionUnits:validation.string("outputGeometryPrecisionUnits",i.outputGeometryPrecisionUnits,void 0),outputLines:validation.string("outputLines",i.outputLines,void 0),outputPolygons:validation.string("outputPolygons",i.outputPolygons,void 0),overlapLines:validation.boolean("overlapLines",i.overlapLines,void 0),overlapPolygons:validation.boolean("overlapPolygons",i.overlapPolygons,void 0),pointBarriers:i.pointBarriers,polygonBarriers:i.polygonBarriers,polylineBarriers:i.polylineBarriers,restrictionAttributes:i.restrictionAttributes,restrictUTurns:validation.string("restrictUTurns",i.restrictUTurns,void 0),returnFacilities:validation.boolean("returnFacilities",i.returnFacilities,void 0),returnPointBarriers:validation.boolean("returnPointBarriers",i.returnPointBarriers,void 0),returnPolygonBarriers:validation.boolean("returnPolygonBarriers",i.returnPolygonBarriers,void 0),returnPolylineBarriers:validation.boolean("returnPolylineBarriers",i.returnPolylineBarriers,void 0),splitLinesAtBreaks:validation.boolean("splitLinesAtBreaks",i.splitLinesAtBreaks,void 0),splitPolygonsAtBreaks:validation.boolean("splitPolygonsAtBreaks",i.splitPolygonsAtBreaks,void 0),timeOfDay:i.timeOfDay,travelDirection:validation.string("travelDirection",i.travelDirection,void 0),trimOuterPolygon:validation.boolean("trimOuterPolygon",i.trimOuterPolygon,void 0),trimPolygonDistance:validation.number("trimPolygonDistance",i.trimPolygonDistance,void 0),trimPolygonDistanceUnits:validation.string("trimPolygonDistanceUnits",i.trimPolygonDistanceUnits,void 0),useHierarchy:validation.boolean("useHierarchy",i.useHierarchy,void 0),outSpatialReference:r.getOutSR(i.outSpatialReference)});o.impedanceAttribute||(o.impedanceAttribute=validation.string("impedenceAttribute",i.impedenceAttribute,void 0));e={signal:e.cancellationToken.signal},e=await solve(t,o,e);return{facilities:e.facilities,messages:e.messages,pointBarriers:e.pointBarriers,polygonBarriers:e.polygonBarriers,polylineBarriers:e.polylineBarriers,serviceAreaPolygons:e.serviceAreaPolygons,serviceAreaPolylines:e.serviceAreaPolylines}}};ServiceAreaTask.action="gcx:wf:arcgis::ServiceAreaTask",ServiceAreaTask.suite="gcx:wf:builtin",ServiceAreaTask=__decorate([activate(MapProvider)],ServiceAreaTask);export{ServiceAreaTask};
|
|
@@ -7,6 +7,8 @@ export interface SetImageryLayerOptionsInputs {
|
|
|
7
7
|
/** The mosaic rule to apply to the imagery layer. */
|
|
8
8
|
mosaicRule?: __esri.MosaicRule | __esri.MosaicRuleProperties;
|
|
9
9
|
/** The raster function used to render the imagery layer. */
|
|
10
|
+
rasterFunction?: __esri.RasterFunction | __esri.RasterFunctionProperties;
|
|
11
|
+
/** The raster function used to render the imagery layer. */
|
|
10
12
|
renderingRule?: __esri.RasterFunction | __esri.RasterFunctionProperties;
|
|
11
13
|
/** The filter used to process the pixel data of the imagery layer. The pixelData object contains a pixelBlock property that gives you access to all of the pixels in the raster on the client. */
|
|
12
14
|
pixelFilter?: Function;
|
|
@@ -15,6 +17,8 @@ export interface SetImageryLayerOptionsInputs {
|
|
|
15
17
|
export interface SetImageryLayerOptionsOutputs {
|
|
16
18
|
/** Indicates the mosaic rule used. */
|
|
17
19
|
mosaicRule?: __esri.MosaicRule;
|
|
20
|
+
/** Indicates the raster function used. */
|
|
21
|
+
rasterFunction?: __esri.RasterFunction;
|
|
18
22
|
/** Indicates the rendering rule used. */
|
|
19
23
|
renderingRule?: __esri.RasterFunction;
|
|
20
24
|
/** Indicates the pixel function used. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__decorate}from"tslib";import MosaicRule from"@arcgis/core/layers/support/MosaicRule";import RasterFunction from"@arcgis/core/layers/support/RasterFunction";import{activate}from"../../Hooks.js";import{validation}from"../../Validation.js";import{MapProvider}from"./MapProvider.js";let SetImageryLayerOptions=class{async execute(e,r,t){var
|
|
1
|
+
import{__decorate}from"tslib";import MosaicRule from"@arcgis/core/layers/support/MosaicRule";import RasterFunction from"@arcgis/core/layers/support/RasterFunction";import{activate}from"../../Hooks.js";import{validation}from"../../Validation.js";import{MapProvider}from"./MapProvider.js";let SetImageryLayerOptions=class{async execute(e,r,t){var a=validation.id("layerId",e.layerId,validation.never);const i=t.create();await i.load();const o=i.findLayer(a);if(void 0===o||null===o)return{};await o.load();a=e.mosaicRule;null!=a&&o.setProperty("mosaicRule",a instanceof MosaicRule?a:new MosaicRule(a));a=e.rasterFunction||e.renderingRule;null!=a&&o.setProperty("rasterFunction",a instanceof RasterFunction?a:new RasterFunction(a));e=e.pixelFilter;return"function"==typeof e&&o.setProperty("pixelFilter",e),o.redraw(),{mosaicRule:o.getProperty("mosaicRule"),pixelFilter:o.getProperty("pixelFilter"),rasterFunction:o.getProperty("rasterFunction"),renderingRule:o.getProperty("rasterFunction")}}};SetImageryLayerOptions.action="gcx:wf:arcgis::SetImageryLayerOptions",SetImageryLayerOptions.suite="gcx:wf:builtin",SetImageryLayerOptions=__decorate([activate(MapProvider)],SetImageryLayerOptions);export{SetImageryLayerOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{fromJSON}from"@arcgis/core/symbols/support/jsonUtils";class SymbolFromJson{execute(o,s){if(!o.json)return{symbol:void 0};
|
|
1
|
+
import CIMSymbol from"@arcgis/core/symbols/CIMSymbol";import{fromJSON}from"@arcgis/core/symbols/support/jsonUtils";class SymbolFromJson{execute(o,s){if(!o.json)return{symbol:void 0};var m="string"==typeof o.json?JSON.parse(o.json):o.json;let r;switch(m.type){case"CIMLineSymbol":case"CIMPointSymbol":case"CIMPolygonSymbol":r=CIMSymbol.fromJSON(m);break;default:r=fromJSON(m)}return{symbol:r}}}SymbolFromJson.action="gcx:wf:arcgis::SymbolFromJson",SymbolFromJson.suite="gcx:wf:builtin";export{SymbolFromJson};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SpatialReference from"@arcgis/core/geometry/SpatialReference";import{toGeoCoordinateString}from"@arcgis/core/rest/geometryService";import{validation}from"../../Validation.js";
|
|
1
|
+
import SpatialReference from"@arcgis/core/geometry/SpatialReference";import{toGeoCoordinateString}from"@arcgis/core/rest/geometryService";import{validation}from"../../Validation.js";class ToGeoCoordinateStringServiceTask{async execute(e,i){var o=validation.string("url",e.url,validation.never),n=validation.exists("spatialReference",e.spatialReference),a=validation.exists("coordinates",e.coordinates),r=validation.string("conversionType",e.conversionType);let t="object"==typeof n?n:void 0;"number"==typeof n&&(t=new SpatialReference({wkid:n})),"string"==typeof n&&(t=new SpatialReference({wkt:n}));const s={sr:t,coordinates:a,conversionType:r};null!==e.conversionMode&&void 0!==e.conversionMode&&(s.conversionMode=validation.string("conversionMode",e.conversionMode)),null!==e.numOfDigits&&void 0!==e.numOfDigits&&(s.numOfDigits=validation.number("numOfDigits",e.numOfDigits)),null!==e.rounding&&void 0!==e.rounding&&(s.rounding=validation.boolean("rounding",s.rounding)),null!==e.addSpaces&&void 0!==e.addSpaces&&(s.addSpaces=validation.boolean("addSpaces",e.addSpaces));i={signal:i.cancellationToken.signal};return{strings:await toGeoCoordinateString(o,s,i)}}}ToGeoCoordinateStringServiceTask.action="gcx:wf:arcgis::ToGeoCoordinateStringServiceTask",ToGeoCoordinateStringServiceTask.suite="gcx:wf:builtin";export{ToGeoCoordinateStringServiceTask};
|
|
@@ -26,8 +26,7 @@ export declare function isLayerWithDefinitionExpression(layer: __esri.Layer): la
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function isLayerWithPopupTemplate(layer: __esri.Layer): layer is __esri.Layer & LayerWithPopupTemplate;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
* `ArcGISDynamicService`.
|
|
29
|
+
* Checks if the supplied layer has a `findSublayerById` method.
|
|
31
30
|
* @param layer The layer to be checked.
|
|
32
31
|
*/
|
|
33
32
|
export declare function isLayerWithSublayers(layer: __esri.Layer): layer is __esri.Layer & LayerWithSublayers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{union}from"@arcgis/core/rest/geometryService";import{validation}from"../../Validation.js";
|
|
1
|
+
import{union}from"@arcgis/core/rest/geometryService";import{validation}from"../../Validation.js";class UnionServiceTask{async execute(i,e){var a=validation.string("url",i.url,validation.never),n=validation.array("geometry1",i.geometry1,validation.never),i=validation.array("geometry2",i.geometry2,[]),e={signal:e.cancellationToken.signal};return{geometry:await union(a,[...n,...i],e)}}}UnionServiceTask.action="gcx:wf:arcgis::UnionServiceTask",UnionServiceTask.suite="gcx:wf:builtin";export{UnionServiceTask};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import esriRequest from"@arcgis/core/request";import{GenericActivityError}from"../../Errors.js";import{validation}from"../../Validation.js";import{addToPath
|
|
1
|
+
import esriRequest from"@arcgis/core/request";import{GenericActivityError}from"../../Errors.js";import{validation}from"../../Validation.js";import{addToPath}from"./tools.js";class UpdateAttachment{async execute(t,e){var a=validation.urlOrLayer(t).trim(),n=validation.number("objectId",t.objectId,validation.never);const i=validation.number("attachmentId",t.attachmentId,validation.never);var r=validation.exists("attachment",t.attachment,validation.never),o=validation.string("gdbVersion",t.gdbVersion),d=validation.boolean("returnEditMoment",t.returnEditMoment,!1),m=validation.number("uploadId",t.uploadId),c=validation.number("timeout",t.timeout),n=addToPath(a,`${n}/updateAttachment`);let s=validation.string("attachmentName",t.attachmentName,"").trim();""===s&&(s=void 0);const l=new FormData;l.append("f","json"),l.append("attachmentId",i.toString()),l.append("attachment",r,s),o&&l.append("gdbVersion",o),l.append("returnEditMoment",d?"true":"false"),null!=m&&l.append("uploadId",m?"true":"false");c={body:l,cacheBust:!1,method:"post",responseType:"json",signal:e.cancellationToken.signal,timeout:c},c=(await esriRequest(n,c)).data.updateAttachmentResult;if(!c)throw new GenericActivityError('Error running the "Update Attachment" activity. The response did not include the required "updateAttachmentResult" property.');return{result:c}}}UpdateAttachment.action="gcx:wf:arcgis::UpdateAttachment",UpdateAttachment.suite="gcx:wf:builtin";export{UpdateAttachment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{validation}from"../../Validation.js";import{
|
|
1
|
+
import{validation}from"../../Validation.js";import{addToPath,post}from"./tools.js";class UpdateFeatures{async execute(e,t){var a=validation.urlOrLayer(e),a=addToPath(a,"applyEdits"),s=validation.string("gdbVersion",e.gdbVersion),i=validation.number("timeout",e.timeout),s={updates:validation.array("features",e.features,validation.never).map(e=>{if(e.geometry)return e;{const t=e.toJSON();return delete t.geometry,t}}),gdbVersion:s};const o=await post(a,s,i,t.cancellationToken.signal);this.onApplyEditsComplete(o);t=!!o.updateResults?.every(e=>e.success);return{results:o.updateResults,success:t}}onApplyEditsComplete(e){}}UpdateFeatures.action="gcx:wf:arcgis::UpdateFeatures",UpdateFeatures.suite="gcx:wf:builtin";export{UpdateFeatures};
|
|
@@ -2,9 +2,6 @@ import type { Task } from "../../Task";
|
|
|
2
2
|
import type { ChannelProvider } from "../core/ChannelProvider";
|
|
3
3
|
/**
|
|
4
4
|
* Gets the authentication token, if any, for the supplied portal.
|
|
5
|
-
* This is a separate method because GVH does not use the
|
|
6
|
-
* IdentityManager to store credentials. The GVH host module
|
|
7
|
-
* overrides this method and uses its own technique.
|
|
8
5
|
* @param portalUrl
|
|
9
6
|
*/
|
|
10
7
|
export declare function getAuthenticationToken(portalUrl: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Extent from "@arcgis/core/geometry/Extent";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Abortable } from "../../IActivityHandler";
|
|
3
3
|
import type { Task } from "../../Task";
|
|
4
4
|
/**
|
|
5
5
|
* A promise that can be cancelled.
|
|
@@ -13,15 +13,6 @@ export declare function isAbortable(task: Task<any> | (Task<any> & Abortable)):
|
|
|
13
13
|
* @param promise A promise to check if it supports cancellation.
|
|
14
14
|
*/
|
|
15
15
|
export declare function isCancellable(promise: PromiseLike<any>): promise is PromiseLike<any> & Cancellable;
|
|
16
|
-
/**
|
|
17
|
-
* Schedules the cancellation of the supplied promise for when the activity's cancellation token is resolved.
|
|
18
|
-
* This does not do anything if the cancellation token contains an `AbortSignal` as we assume in such cases
|
|
19
|
-
* we're passing that to the Esri API for cancellation.
|
|
20
|
-
* Also, if the promise does not support cancellation, it is not cancelled.
|
|
21
|
-
* @param context The context of an activity being executed.
|
|
22
|
-
* @param promise A promise to be cancelled when the workflow is cancelled.
|
|
23
|
-
*/
|
|
24
|
-
export declare function schedulePromiseCancellation(context: IActivityContext, promise: PromiseLike<any>): void;
|
|
25
16
|
export declare function addToPath(url: string, pathSuffix: string): string;
|
|
26
17
|
export interface ExtentLike extends __esri.Geometry {
|
|
27
18
|
xmin?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Extent from"@arcgis/core/geometry/Extent";import esriRequest from"@arcgis/core/request";import{jsonToQueryObject}from"../../activities/core/converters.js";function isAbortable(e){return"object"==typeof e.signal}function isCancellable(e){return null!=e&&"function"==typeof e.cancel}function
|
|
1
|
+
import Extent from"@arcgis/core/geometry/Extent";import esriRequest from"@arcgis/core/request";import{jsonToQueryObject}from"../../activities/core/converters.js";function isAbortable(e){return"object"==typeof e.signal}function isCancellable(e){return null!=e&&"function"==typeof e.cancel}function addToPath(n,a){return n.replace(/([\#\?].*)?$/,function(e){const t=n.substring(0,n.length-e.length);return t.match(/\/+$/)?a+e:"/"+a+e})}function isExtent(e){return"number"==typeof e.xmin&&("number"==typeof e.xmax&&("number"==typeof e.ymin&&"number"==typeof e.ymax))}function polygonFromExtent(e,t){if(null!=e)return isExtent(e)?new t({rings:[[[e.xmin,e.ymin],[e.xmax,e.ymin],[e.xmax,e.ymax],[e.xmin,e.ymax]]],spatialReference:e.spatialReference}):e}function get(e,t,n,a){t.f="json";const r={method:"get",query:jsonToQueryObject(t),responseType:"json",timeout:n,cacheBust:!1};return a&&(r.signal=a),esriRequest(e,r).then(e=>e.data)}function post(e,t,n,a){t.f="json";const r={method:"post",query:jsonToQueryObject(t),responseType:"json",timeout:n,cacheBust:!1};return a&&(r.signal=a),esriRequest(e,r).then(e=>e.data)}function isFeatureSet(e){return null!=e&&(!Array.isArray(e)&&!!Array.isArray(e.features))}function featuresToArray(e){return null==e?[]:e instanceof Array?e:isFeatureSet(e)?e.features:void 0!==e.attributes&&null!==e.attributes||void 0!==e.geometry&&null!==e.geometry?[e]:[]}function extentOf(e){let t;for(const a of e||[])if(a)if("point"===a.type){var n=a;void 0===t?t=pointToExtent(n):(t.xmin=Math.min(t.xmin,n.x),t.ymin=Math.min(t.ymin,n.y),t.xmax=Math.max(t.xmax,n.x),t.ymax=Math.max(t.ymax,n.y),t.spatialReference=a.spatialReference||t.spatialReference,"number"==typeof n.z&&(t.zmin=Math.min(t.zmin,n.z),t.zmax=Math.max(t.zmax,n.z)))}else{let e=a.extent;void 0!==e&&null!==e&&(void 0!==t?(t.xmin=Math.min(t.xmin,e.xmin),t.ymin=Math.min(t.ymin,e.ymin),t.xmax=Math.max(t.xmax,e.xmax),t.ymax=Math.max(t.ymax,e.ymax),t.spatialReference=a.spatialReference||t.spatialReference,"number"==typeof e.zmin&&(t.zmin=Math.min(t.zmin,e.zmin)),"number"==typeof e.zmax&&(t.zmax=Math.max(t.zmax,e.zmax))):(e=e.clone(),t=e))}return t}function pointToExtent(e){const t=new Extent({xmin:e.x,ymin:e.y,xmax:e.x,ymax:e.y,spatialReference:e.spatialReference});return"number"==typeof e.z&&(t.zmin=e.z,t.zmax=e.z),t}export{isAbortable,isCancellable,addToPath,polygonFromExtent,get,post,isFeatureSet,featuresToArray,extentOf};
|
|
@@ -42,7 +42,7 @@ export declare class ChannelProvider implements ChannelInfo {
|
|
|
42
42
|
* @param name The channel by name.
|
|
43
43
|
*/
|
|
44
44
|
static create(channel?: ChannelProvider, name?: string): ChannelProvider;
|
|
45
|
-
constructor(
|
|
45
|
+
constructor(channelProviderType: typeof ChannelProvider, name?: string);
|
|
46
46
|
/** Indicates the channel name. */
|
|
47
47
|
protected name: string | undefined;
|
|
48
48
|
/** Indicates the channel type. */
|
|
@@ -2,6 +2,8 @@ import type { RunSubworkflowOutputs } from "./RunSubworkflow";
|
|
|
2
2
|
import type { IActivityContext, IActivityHandler } from "../../IActivityHandler";
|
|
3
3
|
export interface SubworkflowInputs {
|
|
4
4
|
subworkflow: RunSubworkflowOutputs;
|
|
5
|
+
argumentsType?: "any" | "{ addressCandidate: esri.AddressCandidate }" | "{ extent: esri.Extent }" | "{ featureSet: esri.FeatureSet }" | "{ geometry: esri.Geometry }" | "{ graphic: esri.Graphic }" | "{ id: number; name: string; location: esri.Point; }" | "{ layer: esri.Layer }" | "{ multiPoint: esri.Multipoint }" | "{ point: esri.Point }" | "{ polygon: esri.Polygon }" | "{ polyline: esri.Polyline }" | "{ portalGroup: esri.PortalGroup }" | "{ portalUser: esri.PortalUser }" | "{ spatialReference: esri.SpatialReference }" | "{ symbol: esri.Symbol }" | string;
|
|
6
|
+
resultType?: "any" | "ArrayBuffer" | "boolean" | "Date" | "Error" | "Function" | "number" | "number[]" | "Object" | "string" | "string[]" | "esri.Graphic" | "esri.Extent" | "esri.Geometry" | "esri.Multipoint" | "esri.Point" | "esri.Polygon" | "esri.Polyline" | "esri.PortalGroup" | "esri.PortalUser" | "esri.SpatialReference" | "esri.Layer" | "esri.Symbol" | "esri.AddressCandidate" | "esri.FeatureSet" | "{ id: number; name: string; location: esri.Point; }" | string;
|
|
5
7
|
}
|
|
6
8
|
export interface SubworkflowOutputs {
|
|
7
9
|
arguments?: Record<string, any>;
|
|
@@ -48,5 +48,5 @@ export interface WebRequestOutputs {
|
|
|
48
48
|
export declare class WebRequest implements IActivityHandler {
|
|
49
49
|
static readonly action = "gcx:wf:core:request:WebRequest";
|
|
50
50
|
static readonly suite = "gcx:wf:builtin";
|
|
51
|
-
execute(inputs: WebRequestInputs, context: IActivityContext,
|
|
51
|
+
execute(inputs: WebRequestInputs, context: IActivityContext, channelProviderType: typeof ChannelProvider): Promise<WebRequestOutputs>;
|
|
52
52
|
}
|
|
@@ -17,7 +17,7 @@ export interface RunEssentialsWorkflowOutputs {
|
|
|
17
17
|
export declare class RunEssentialsWorkflow implements IActivityHandler {
|
|
18
18
|
static readonly action = "gcx:wf:essentials::RunEssentialsWorkflow";
|
|
19
19
|
static readonly suite = "gcx:wf:builtin";
|
|
20
|
-
execute(inputs: RunEssentialsWorkflowInputs, context: IActivityContext,
|
|
20
|
+
execute(inputs: RunEssentialsWorkflowInputs, context: IActivityContext, channelProviderType: typeof ChannelProvider): Promise<RunEssentialsWorkflowOutputs>;
|
|
21
21
|
private isString;
|
|
22
22
|
private getWorkflowSchema;
|
|
23
23
|
private validateInputs;
|
|
@@ -24,9 +24,9 @@ export interface AddTextToPdfInputs {
|
|
|
24
24
|
*/
|
|
25
25
|
y: number;
|
|
26
26
|
/**
|
|
27
|
-
* @description The name of font of the text. The default is
|
|
27
|
+
* @description The name of the font family of the text. Only the listed fonts are supported at this time. The default is Arial.
|
|
28
28
|
*/
|
|
29
|
-
fontName: "
|
|
29
|
+
fontName: "Arial" | "Courier New" | "Lucida Console" | "Symbol" | "Times New Roman" | "Verdana" | string;
|
|
30
30
|
/**
|
|
31
31
|
* @description The font size (in points) of the text. The default is 12.
|
|
32
32
|
*/
|
|
@@ -16,7 +16,7 @@ export interface ImportResults {
|
|
|
16
16
|
start?: Step;
|
|
17
17
|
}
|
|
18
18
|
/** Delegates remapping of identifiers and names. */
|
|
19
|
-
|
|
19
|
+
interface NameIdMapper {
|
|
20
20
|
(id: number, name: string): boolean | number | string | {
|
|
21
21
|
id?: number;
|
|
22
22
|
name?: string;
|
|
@@ -43,6 +43,13 @@ export declare class ProgramInspector {
|
|
|
43
43
|
program: Program;
|
|
44
44
|
/** Indicates the starting step. */
|
|
45
45
|
start: Step | undefined;
|
|
46
|
+
/** The id of the editor created this ProgramInspector. */
|
|
47
|
+
readonly editorId: string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new instance of the `ProgramInspector` class.
|
|
50
|
+
* @param editorId (optional) The id of the editor created this ProgramInspector.
|
|
51
|
+
*/
|
|
52
|
+
constructor(editorId?: string);
|
|
46
53
|
/** Yields a new identifier that is not currently in use. */
|
|
47
54
|
newId(nextId?: number): number;
|
|
48
55
|
/** Checks to see if the given identifier exists. */
|
|
@@ -94,7 +101,7 @@ export declare class ProgramInspector {
|
|
|
94
101
|
/** Relates components to steps and transitions. */
|
|
95
102
|
relate(components: Iterable<Component>): Iterator<Activity>;
|
|
96
103
|
/** Relates steps to transitions. */
|
|
97
|
-
relate(steps: Iterable<Step>, branch?:
|
|
104
|
+
relate(steps: Iterable<Step>, branch?: string): Iterator<Transition>;
|
|
98
105
|
/** Relates transitions to steps. */
|
|
99
106
|
relate(transitions: Iterable<Transition>): Iterator<Step>;
|
|
100
107
|
/** Relates resources to resources. */
|
|
@@ -196,18 +203,18 @@ export declare class ProgramInspector {
|
|
|
196
203
|
reset(): void;
|
|
197
204
|
toJSON(): Program;
|
|
198
205
|
}
|
|
199
|
-
|
|
206
|
+
interface Incident<TResource extends Resource> {
|
|
200
207
|
token: string;
|
|
201
208
|
master?: ResourceList<TResource, Incident<TResource>>;
|
|
202
209
|
resource?: TResource;
|
|
203
210
|
}
|
|
204
|
-
|
|
211
|
+
declare class IncidentList extends Dictionary<Incident<Resource>> {
|
|
205
212
|
nextId: number;
|
|
206
213
|
findFor(resource: Resource | undefined): Incident<Resource> | undefined;
|
|
207
214
|
newId(): number;
|
|
208
215
|
relate(resource: Resource, branch: string | undefined): Iterable<Resource>;
|
|
209
216
|
}
|
|
210
|
-
|
|
217
|
+
declare abstract class ResourceList<T extends Resource, TIncident extends Incident<T>> extends Dictionary<TIncident> {
|
|
211
218
|
incidents: IncidentList;
|
|
212
219
|
protected cacheLookup: Record<string, T> | undefined;
|
|
213
220
|
abstract qualify(name: string): string;
|
|
@@ -233,44 +240,44 @@ export declare abstract class ResourceList<T extends Resource, TIncident extends
|
|
|
233
240
|
relate(_incident: Incident<Resource>, _branch: string | undefined): Iterable<Resource>;
|
|
234
241
|
changeParent(this: StepList | TransitionList, incident: StepIncident | TransitionIncident, parent: ComponentIncident | undefined): void;
|
|
235
242
|
}
|
|
236
|
-
|
|
243
|
+
interface ComponentIncident extends Incident<Component> {
|
|
237
244
|
steps?: Dictionary<StepIncident>;
|
|
238
245
|
transitions?: Dictionary<TransitionIncident>;
|
|
239
246
|
}
|
|
240
|
-
|
|
247
|
+
declare class ComponentList extends ResourceList<Component, ComponentIncident> {
|
|
241
248
|
create(): Component;
|
|
242
249
|
qualify(name: string): string;
|
|
243
250
|
unlink(incident: ComponentIncident): number;
|
|
244
251
|
relate(incident: ComponentIncident, branch: string): Iterable<Activity>;
|
|
245
252
|
}
|
|
246
|
-
|
|
253
|
+
declare class FormList extends ResourceList<Form, Incident<Form>> {
|
|
247
254
|
create(): Form;
|
|
248
255
|
qualify(name: string): string;
|
|
249
256
|
}
|
|
250
|
-
|
|
257
|
+
declare class ReferenceList extends ResourceList<Reference, Incident<Reference>> {
|
|
251
258
|
create(): Reference;
|
|
252
259
|
qualify(name: string): string;
|
|
253
260
|
}
|
|
254
|
-
|
|
261
|
+
interface StepIncident extends Incident<Step> {
|
|
255
262
|
master?: StepList;
|
|
256
263
|
parent?: ComponentIncident;
|
|
257
264
|
branches?: Record<string, Transition | Transition[]>;
|
|
258
265
|
transitions?: Dictionary<TransitionIncident>;
|
|
259
266
|
}
|
|
260
|
-
|
|
267
|
+
declare class StepList extends ResourceList<Step, StepIncident> {
|
|
261
268
|
create(): Step;
|
|
262
269
|
qualify(name: string): string;
|
|
263
270
|
siblings(incident: ComponentIncident): Dictionary<StepIncident | TransitionIncident>;
|
|
264
271
|
unlink(incident: StepIncident): number;
|
|
265
272
|
relate(incident: StepIncident, branch: string): Iterable<Transition>;
|
|
266
273
|
}
|
|
267
|
-
|
|
274
|
+
interface TransitionIncident extends Incident<Transition> {
|
|
268
275
|
master?: TransitionList;
|
|
269
276
|
parent?: ComponentIncident;
|
|
270
277
|
source?: StepIncident;
|
|
271
278
|
target?: StepIncident;
|
|
272
279
|
}
|
|
273
|
-
|
|
280
|
+
declare class TransitionList extends ResourceList<Transition, TransitionIncident> {
|
|
274
281
|
create(): Transition;
|
|
275
282
|
qualify(name: string): string;
|
|
276
283
|
siblings(incident: ComponentIncident): Dictionary<StepIncident | TransitionIncident>;
|
|
@@ -289,3 +296,4 @@ export type LocaleParts = {
|
|
|
289
296
|
export declare function parseLocale(locale: string | undefined): LocaleParts | undefined;
|
|
290
297
|
/** Converts a locale code to its canonicalized form, e.g. "de-ch" becomes "de-CH", "ZH-HANS-CN" becomes "zh-Hans-CN"). */
|
|
291
298
|
export declare function canonicalizeLocale(locale: string | undefined): string | undefined;
|
|
299
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Dictionary,Iterator,Stash}from"../Collections.js";class ProgramInspector{constructor(){this.incidents=new IncidentList,this.components=new ComponentList(this.incidents),this.forms=new FormList(this.incidents),this.references=new ReferenceList(this.incidents),this.steps=new StepList(this.incidents),this.transitions=new TransitionList(this.incidents),this.program=makeBlankProgram()}newId(t){return"number"==typeof t&&(this.incidents.nextId=t),this.incidents.newId()}exists(t){return void 0!==this.incidents.findFor(t)}find(t){t=this.incidents.find(t);return void 0!==t?t.resource:void 0}findComponent(t){return this.components.findWith(t)}findForm(t){return this.forms.findWith(t)}findReference(t){return this.references.findWith(t)}findStep(t){return this.steps.findWith(t)}findTransition(t){return this.transitions.findWith(t)}all(){return iterate(this.incidents)}allComponents(){return this.components.all()}allForms(){return this.forms.all()}allReferences(){return this.references.all()}allSteps(){return this.steps.all()}allTransitions(){return this.transitions.all()}addComponent(){return this.components.add().resource}addForm(){return this.forms.add().resource}addReference(){return this.references.add().resource}addStep(){return this.steps.add().resource}addTransition(r,n){const i=this.steps.findFor(r),s=this.steps.findFor(n);if(void 0!==i&&void 0!==s){let t=i.transitions;void 0===t&&(t=i.transitions=new Dictionary);let e=s.transitions;void 0===e&&(e=s.transitions=new Dictionary);const o=this.transitions.add(),a=o.resource;return o.source=i,a.source=r,t.assign(o.token,o),o.target=s,a.target=n,e.assign(o.token,o),i.branches=void 0,a}}cacheComponents(){return this.components.cache()}cacheForms(){return this.forms.cache()}cacheReference(){return this.references.cache()}cacheSteps(){return this.steps.cache()}cacheTransitions(){return this.transitions.cache()}relate(t,e){const r=1<arguments.length?branchToToken(e):void 0;return Iterator.from(t).map(t=>this.incidents.relate(t,r))}remove(e,n){var r=t=>{let e=0;!1===n&&this.isComponent(t)&&(e+=this.remove(this.relate(t)));const r=this.incidents.findFor(t);return void 0!==r&&(e+=r.master.unlink(r),this.start===r.resource&&(this.start=void 0)),e};if(Array.isArray(e)||e instanceof Iterator){let t=0;const i=Iterator.from(e);for(;i.next();)t+=r(i.current);return t}return 0<r(e)}removeComponent(t){return this.components.removeFor(t)}removeForm(t){return this.forms.removeFor(t)}removeReference(t){return this.references.removeFor(t)}removeStep(t){return!!this.steps.removeFor(t)&&(this.start===t&&(this.start=void 0),!0)}removeTransition(t){return this.transitions.removeFor(t)}shift(t,e){const r=this.incidents.findFor(t);return void 0!==r&&r.master.shift(r,e)}shiftComponent(t,e){return this.components.shiftFor(t,e)}shiftForm(t,e){return this.forms.shiftFor(t,e)}shiftReference(t,e){return this.references.shiftFor(t,e)}shiftStep(t,e){return this.steps.shiftFor(t,e)}shiftTransition(t,e){return this.transitions.shiftFor(t,e)}rename(t,e){const r=this.incidents.findFor(t);return void 0!==r?r.master.rename(r,e):void 0}renameComponent(t,e){return this.components.renameFor(t,e)}renameForm(t,e){return this.forms.renameFor(t,e)}renameReference(t,e){return this.references.renameFor(t,e)}renameStep(t,e){return this.steps.renameFor(t,e)}renameTransition(t,e){return this.transitions.renameFor(t,e)}changeStart(t){return!!this.isStep(t)&&(this.start=t,!0)}changeBranch(t,e){const r=this.transitions.findFor(t);return void 0!==r&&(r.source.branches=void 0,t.branch=void 0!==literalType(e)?e:void 0,!0)}changeParent(t,e){let r=this.steps.findFor(t);if(void 0===r&&(r=this.transitions.findFor(t)),void 0===r)return!1;let n;return(null==e||(n=this.components.findFor(e),void 0!==n))&&(r.master.changeParent(r,n),!0)}changeSource(t,e){const r=this.transitions.findFor(t);if(void 0===r)return!1;const n=this.steps.findFor(e);if(void 0===n)return!1;r.source.branches=void 0,r.source!==r.target&&r.source.transitions.remove(r.token);let i=n.transitions;return void 0===i&&(i=n.transitions=new Dictionary),r.source=n,t.source=e,n.branches=void 0,i.assign(r.token,r),!0}changeTarget(t,e){const r=this.transitions.findFor(t);if(void 0===r)return!1;const n=this.steps.findFor(e);if(void 0===n)return!1;r.target!==r.source&&r.target.transitions.remove(r.token);let i=n.transitions;return void 0===i&&(i=n.transitions=new Dictionary),r.target=n,t.target=e,i.assign(r.token,r),!0}isComponent(t){return void 0!==this.components.findFor(t)}isParent(t,e){return this.isActivity(e)&&e.parent===t}isForm(t){return void 0!==this.forms.findFor(t)}isActivity(t){return this.isStep(t)||this.isTransition(t)}isReference(t){return void 0!==this.references.findFor(t)}isStep(t){return void 0!==this.steps.findFor(t)}isTransition(t){return void 0!==this.transitions.findFor(t)}isSource(t,e){return this.isTransition(t)&&t.source===e}isTarget(t,e){return this.isTransition(t)&&t.target===e}getDeploymentConfig(){return this.program.deploymentConfig||{supportedApps:{}}}getDefaultLocale(){return navigator.language||navigator.userLanguage||"inv"}getStrings(t){var e,r=this.program.strings||{};t=t||this.getDefaultLocale();let n={...r.inv||{}};return"inv"===t||(t=canonicalizeLocale(t))&&(t!==(e=parseLocale(t).language)&&e in r&&(n={...n,...r[e]}),t in r&&(n={...n,...r[t]})),n}realize(){this.program.components=this.allComponents().list(),this.program.forms=this.allForms().list(),this.program.references=this.allReferences().list(),this.program.steps=this.allSteps().list(),this.program.transitions=this.allTransitions().list(),this.program.start=this.start;const t=this.allComponents();for(;t.next();)t.current.steps=[],t.current.transitions=[];const e=this.allSteps();for(;e.next();){const n=e.current;n.transitions=[];const i=n.parent;void 0!==i&&i.steps.push(n)}const r=this.allTransitions();for(;r.next();){const s=r.current,o=s.parent;void 0!==o&&o.transitions.push(s),s.source.transitions.push(s),s.target!==s.source&&s.target.transitions.push(s)}}release(){this.program.components=[],this.program.forms=[],this.program.references=[],this.program.steps=[],this.program.transitions=[],this.program.start=void 0;const t=this.allComponents();for(;t.next();)t.current.steps=[],t.current.transitions=[];const e=this.allSteps();for(;e.next();)e.current.transitions=[]}resolveStart(t){if("number"==typeof t)return this.findStep(t);if("string"==typeof t)return this.findStep(t);if("object"!=typeof t||null===t)return this.start;var e=t.id;if("number"==typeof e)return this.findStep(e);t=t.name;return"string"==typeof t?this.findStep(t):void 0}import(t,n,s){if("object"!=typeof(t="string"==typeof t?JSON.parse(t):t)||null===t)return{};"function"!=typeof s&&(s=void 0),n=!1!==n;const i={},o={},a=new Stash,c=(t,e)=>{copyResource(t,e);let r=t.id,n=t.name;void 0!==s&&("number"==typeof(i=s(r,n))?(r=i,n=void 0):"string"==typeof i?(r=void 0,n=i):"object"==typeof i&&null!==i?(r=i.id,n=i.name):!0!==i&&(r=void 0,n=void 0)),"number"==typeof r&&(this.shift(e,r),o[r]=e),"string"==typeof n&&this.rename(e,n);var i="number"==typeof r?"id$"+r:"auto";return a.write(i,t,e),e};function u(t,e,r){var n=e.id;if("number"!=typeof n)return c(e,r());t+=n,n=i[t];return void 0===n?c(e,i[t]=r()):c(e,n)}const r=()=>this.addComponent();function h(t){const e=u("component$",t,r);return y(t.steps,t=>p(t,e)),y(t.transitions,t=>v(t,e)),e}const e=()=>this.addForm();const d=()=>this.addReference();const f=()=>this.addStep(),p=(t,e)=>{const r=u("step$",t,f);return this.changeParent(r,g(t.parent,h)||r.parent||e),y(t.transitions,t=>v(t,n?e:void 0,r)),r},m=this.addStep(),l=()=>this.addTransition(m,m),v=(t,e,r)=>{var n=u("transition$",t,()=>l());this.changeParent(n,g(t.parent,h)||n.parent||e);e=n.source!==m?n.source:void 0;this.changeSource(n,g(t.source,p)||e||r);e=n.target!==m?n.target:void 0;return this.changeTarget(n,g(t.target,p)||e||r),n};function g(t,e){if(isObject(t)){var r=t.id,r="number"==typeof r?"id$"+r:"auto";return a.read(r,t)||e(t)}}function y(t,e){if(Array.isArray(t))for(const r of t)g(r,e)}copyResource(t,this.program),y(t.components,h),y(t.forms,function(t){return u("form$",t,e)}),y(t.references,function(t){return u("reference$",t,d)}),y(t.steps,p),y(t.transitions,v),o.start=g(t.start,p),void 0===s&&(this.start=o.start);let F;var k=t=>(void 0===F&&(F=this.addStep(),this.changeParent(F,t)),F);const L=this.relate(m);for(;L.next();){F=void 0;var b=L.current;b.source===m&&this.changeSource(b,k(b.parent)),b.target===m&&this.changeTarget(b,k(b.parent))}return this.removeStep(m),this.realize(),o}export(){this.realize();const t=new ProgramInspector;t.import(this.program,!1);const e=t.program;e.steps=minifyArray(e.steps,function(e){return e.transitions=minifyArray(e.transitions,function(t){return t.source===e&&t.parent===e.parent&&(t.parent=void 0,t.source=void 0,t.target=t.target!==t.source?{id:t.target.id}:void 0,!0)}),void 0===e.parent}),e.transitions=minifyArray(e.transitions,function(t){return void 0===t.parent&&void 0!==t.source&&(t.source={id:t.source.id},t.target={id:t.target.id},!0)}),e.components=minifyArray(e.components,function(t){return t.steps=minifyArray(t.steps,function(t){return!(t.parent=void 0)}),t.transitions=minifyArray(t.transitions,function(t){return void 0!==t.parent&&(t.parent=void 0,t.source={id:t.source.id},t.target={id:t.target.id},!0)}),!0}),e.forms=minifyArray(e.forms),e.references=minifyArray(e.references);var r=t.start;return e.start=void 0!==r?{id:r.id}:void 0,e}reset(){this.incidents.clear(),this.components.clear(),this.forms.clear(),this.references.clear(),this.steps.clear(),this.transitions.clear(),this.incidents.nextId=1,this.program=makeBlankProgram(),this.start=void 0}toJSON(){return this.export()}}function iterate(t){return void 0===t?Iterator.empty:t.iterate().filter(function(t,e){return 0===String(e).lastIndexOf("token$",0)}).map(t=>t.resource,t=>t.id)}class IncidentList extends Dictionary{constructor(){super(...arguments),this.nextId=1}findFor(t){if(null!=t){var e=this.find(t.id);if(void 0!==e&&e.resource===t)return e}}newId(){let t=this.nextId;for(;this.exists(t);)t++;return this.nextId=t+1,t}relate(t,e){const r=this.findFor(t);return void 0!==r?r.master.relate(r,e):Iterator.empty}}class ResourceList extends Dictionary{constructor(t){super(),this.incidents=t}all(){return iterate(this)}cache(){let t=this.cacheLookup;if(void 0!==t)return t;t=this.cacheLookup={};const e=this.iterate();for(;e.next();){var r=e.current.resource,n=(t[r.id]=r).name;void 0!==n&&(t["$"+n]=r)}return t}findFor(t){t=this.incidents.findFor(t);return this.test(t)?t:void 0}test(t){return void 0!==t&&t.master===this}findWith(t){"string"==typeof t&&(t=this.qualify(t));t=this.incidents.find(t);return this.test(t)?t.resource:void 0}shift(t,e){this.incidents.remove(t.resource.id),"number"!=typeof e&&(e=this.incidents.newId());const r=this.incidents.assign(t.resource.id=e,t);void 0!==r&&this.incidents.assign(r.resource.id=this.incidents.newId(),r),this.cacheLookup=void 0}shiftFor(t,e){t=this.findFor(t);return void 0!==t&&(this.shift(t,e),!0)}rename(t,e){var r=t.resource.name;if(void 0!==r&&this.incidents.remove(this.qualify(r)),"string"==typeof e){e=this.qualify(t.resource.name=e);const n=this.incidents.assign(e,t);void 0!==n&&(n.resource.name=void 0)}else t.resource.name=void 0;return this.cacheLookup=void 0,r}renameFor(t,e){t=this.findFor(t);return void 0!==t&&(this.rename(t,e),!0)}add(){const t={},e=t.resource=this.create();return t.token=generateToken(),t.master=this,e.id=this.incidents.newId(),this.assign(t.token,t),this.incidents.assign(e.id,t),this.cacheLookup=void 0,t}removeFor(t){t=this.findFor(t);return void 0!==t&&(this.unlink(t),!0)}unlink(t){this.remove(t.token),this.cacheLookup=void 0;var e=t.resource.id;this.incidents.remove(e);t=t.resource.name;return void 0!==t&&this.incidents.remove(this.qualify(t)),1}relate(t,e){return Iterator.empty}changeParent(t,e){var r=t.parent;void 0!==r&&this.siblings(r).remove(t.token),void 0!==e?(t.parent=e,t.resource.parent=e.resource,this.siblings(e).assign(t.token,t)):(t.parent=void 0,t.resource.parent=void 0)}}class ComponentList extends ResourceList{create(){return{steps:[],transitions:[]}}qualify(t){return"component$"+t}unlink(t){super.unlink(t);const e=t.steps;if(void 0!==e){const n=e.iterate();for(;n.next();)n.current.resource.parent=void 0}const r=t.transitions;if(void 0!==r){const i=r.iterate();for(;i.next();)i.current.resource.parent=void 0}return 1}relate(t,e){const r=iterate(t.steps);t=iterate(t.transitions);return r.concat(t)}}class FormList extends ResourceList{create(){return{defaults:{},elements:{}}}qualify(t){return"form$"+t}}class ReferenceList extends ResourceList{create(){return{suite:"",path:""}}qualify(t){return"reference$"+t}}class StepList extends ResourceList{create(){return{inputs:{},transitions:[]}}qualify(t){return"activity$"+t}siblings(t){return t.steps||(t.steps=new Dictionary)}unlink(t){let e=super.unlink(t);void 0!==t.parent&&t.parent.steps.remove(t.token);const r=t.transitions;if(void 0!==r){const n=r.iterate();for(;n.next();)e+=n.current.master.unlink(n.current)}return e}relate(t,e){var r=t.transitions;if(void 0===r)return Iterator.empty;if(void 0===e)return iterate(r);let n=t.branches;if(void 0===n){n=t.branches={};for(const s of iterate(r).list().sort(compareTransitions))if(s.source===t.resource){var i=branchToToken(s.branch);const o=n[i];void 0===o?n[i]=s:Array.isArray(o)?o.push(s):n[i]=[o,s]}}return n[e]||Iterator.empty}}class TransitionList extends ResourceList{create(){return{inputs:{}}}qualify(t){return"activity$"+t}siblings(t){return t.transitions||(t.transitions=new Dictionary)}unlink(t){return super.unlink(t),t.source.branches=void 0,t.source.transitions.remove(t.token),t.target.transitions.remove(t.token),void 0!==t.parent&&t.parent.transitions.remove(t.token),1}relate(t,e){return t.source!==t.target?[t.source.resource,t.target.resource]:t.source.resource}}const safeProps={id:!1,name:!1,components:!1,elements:!0,forms:!1,references:!1,steps:!1,transitions:!1,start:!1,parent:!1,source:!1,target:!1,suite:!0,path:!0};function copyResource(t,e){for(const r in t)!1!==safeProps[r]&&(e[r]=deepClone(t[r]))}function deepClone(t){if(null!=t){if(Array.isArray(t))return t.map(deepClone);if("object"!=typeof t)return t;{const r={};for(const n in t){var e=t[n];null!=e&&(r[n]=e)}return r}}}function isObject(t){return!Array.isArray(t)&&("object"==typeof t&&null!==t)}function makeBlankProgram(){return{components:[],forms:[],references:[],steps:[],transitions:[]}}function minifyArray(e,r){let n=0;for(let t=0;t<e.length;t++){var i=e[t];void 0!==r&&!r(i)||(e[n++]=i)}return e.length=n,0<e.length?e:void 0}function literalType(t){var e=typeof t;switch(e){case"boolean":case"number":case"string":return e}}function branchToToken(t){var e=literalType(t);return void 0!==e?e+"$"+t:"blank"}function hasInputs(t){for(const e in t)return!0;return!1}function compareTransitions(t,e){return"number"==typeof t.rank?"number"!=typeof e.rank||t<e?-1:e<t?1:0:"number"==typeof e.rank?1:hasInputs(t)?hasInputs(e)?0:-1:hasInputs(e)?1:0}const generateToken=function(){let t,e;function r(){t=0,e="token$"+(new Date).valueOf()+"$"}r();return function(){return 1073741824<=t&&r(),e+t++}}();function parseLocale(t){if("string"==typeof t){const e=t.split("-");if(!(e.length<1||3<e.length||e.some(t=>0===t.length))){const r={language:e[0].toLowerCase()};return 2==e.length?2==e[1].length?r.territory=e[1].toUpperCase():r.script=e[1][0].toUpperCase()+e[1].slice(1).toLowerCase():3===e.length&&(r.script=e[1][0].toUpperCase()+e[1].slice(1).toLowerCase(),r.territory=e[2].toUpperCase()),r}}}function canonicalizeLocale(e){e=parseLocale(e);if(e){let t=e.language;return e.script&&(t+="-"+e.script),e.territory&&(t+="-"+e.territory),t}}export{ProgramInspector,IncidentList,ResourceList,ComponentList,FormList,ReferenceList,StepList,TransitionList,parseLocale,canonicalizeLocale};
|
|
1
|
+
import{Dictionary,Iterator,Stash}from"../Collections.js";class ProgramInspector{constructor(t){this.incidents=new IncidentList,this.components=new ComponentList(this.incidents),this.forms=new FormList(this.incidents),this.references=new ReferenceList(this.incidents),this.steps=new StepList(this.incidents),this.transitions=new TransitionList(this.incidents),this.program=makeBlankProgram(),this.editorId=t}newId(t){return"number"==typeof t&&(this.incidents.nextId=t),this.incidents.newId()}exists(t){return void 0!==this.incidents.findFor(t)}find(t){t=this.incidents.find(t);return void 0!==t?t.resource:void 0}findComponent(t){return this.components.findWith(t)}findForm(t){return this.forms.findWith(t)}findReference(t){return this.references.findWith(t)}findStep(t){return this.steps.findWith(t)}findTransition(t){return this.transitions.findWith(t)}all(){return iterate(this.incidents)}allComponents(){return this.components.all()}allForms(){return this.forms.all()}allReferences(){return this.references.all()}allSteps(){return this.steps.all()}allTransitions(){return this.transitions.all()}addComponent(){return this.components.add().resource}addForm(){return this.forms.add().resource}addReference(){return this.references.add().resource}addStep(){return this.steps.add().resource}addTransition(r,n){const i=this.steps.findFor(r),s=this.steps.findFor(n);if(void 0!==i&&void 0!==s){let t=i.transitions;void 0===t&&(t=i.transitions=new Dictionary);let e=s.transitions;void 0===e&&(e=s.transitions=new Dictionary);const o=this.transitions.add(),a=o.resource;return o.source=i,a.source=r,t.assign(o.token,o),o.target=s,a.target=n,e.assign(o.token,o),i.branches=void 0,a}}cacheComponents(){return this.components.cache()}cacheForms(){return this.forms.cache()}cacheReference(){return this.references.cache()}cacheSteps(){return this.steps.cache()}cacheTransitions(){return this.transitions.cache()}relate(t,e){const r=1<arguments.length?branchToToken(e):void 0;return Iterator.from(t).map(t=>this.incidents.relate(t,r))}remove(e,n){var r=t=>{let e=0;!1===n&&this.isComponent(t)&&(e+=this.remove(this.relate(t)));const r=this.incidents.findFor(t);return void 0!==r&&(e+=r.master.unlink(r),this.start===r.resource&&(this.start=void 0)),e};if(Array.isArray(e)||e instanceof Iterator){let t=0;const i=Iterator.from(e);for(;i.next();)t+=r(i.current);return t}return 0<r(e)}removeComponent(t){return this.components.removeFor(t)}removeForm(t){return this.forms.removeFor(t)}removeReference(t){return this.references.removeFor(t)}removeStep(t){return!!this.steps.removeFor(t)&&(this.start===t&&(this.start=void 0),!0)}removeTransition(t){return this.transitions.removeFor(t)}shift(t,e){const r=this.incidents.findFor(t);return void 0!==r&&r.master.shift(r,e)}shiftComponent(t,e){return this.components.shiftFor(t,e)}shiftForm(t,e){return this.forms.shiftFor(t,e)}shiftReference(t,e){return this.references.shiftFor(t,e)}shiftStep(t,e){return this.steps.shiftFor(t,e)}shiftTransition(t,e){return this.transitions.shiftFor(t,e)}rename(t,e){const r=this.incidents.findFor(t);return void 0!==r?r.master.rename(r,e):void 0}renameComponent(t,e){return this.components.renameFor(t,e)}renameForm(t,e){return this.forms.renameFor(t,e)}renameReference(t,e){return this.references.renameFor(t,e)}renameStep(t,e){return this.steps.renameFor(t,e)}renameTransition(t,e){return this.transitions.renameFor(t,e)}changeStart(t){return!!this.isStep(t)&&(this.start=t,!0)}changeBranch(t,e){const r=this.transitions.findFor(t);return void 0!==r&&(r.source.branches=void 0,t.branch="string"==typeof e?e:void 0,!0)}changeParent(t,e){let r=this.steps.findFor(t);if(void 0===r&&(r=this.transitions.findFor(t)),void 0===r)return!1;let n;return(null==e||(n=this.components.findFor(e),void 0!==n))&&(r.master.changeParent(r,n),!0)}changeSource(t,e){const r=this.transitions.findFor(t);if(void 0===r)return!1;const n=this.steps.findFor(e);if(void 0===n)return!1;r.source.branches=void 0,r.source!==r.target&&r.source.transitions.remove(r.token);let i=n.transitions;return void 0===i&&(i=n.transitions=new Dictionary),r.source=n,t.source=e,n.branches=void 0,i.assign(r.token,r),!0}changeTarget(t,e){const r=this.transitions.findFor(t);if(void 0===r)return!1;const n=this.steps.findFor(e);if(void 0===n)return!1;r.target!==r.source&&r.target.transitions.remove(r.token);let i=n.transitions;return void 0===i&&(i=n.transitions=new Dictionary),r.target=n,t.target=e,i.assign(r.token,r),!0}isComponent(t){return void 0!==this.components.findFor(t)}isParent(t,e){return this.isActivity(e)&&e.parent===t}isForm(t){return void 0!==this.forms.findFor(t)}isActivity(t){return this.isStep(t)||this.isTransition(t)}isReference(t){return void 0!==this.references.findFor(t)}isStep(t){return void 0!==this.steps.findFor(t)}isTransition(t){return void 0!==this.transitions.findFor(t)}isSource(t,e){return this.isTransition(t)&&t.source===e}isTarget(t,e){return this.isTransition(t)&&t.target===e}getDeploymentConfig(){return this.program.deploymentConfig||{supportedApps:{}}}getDefaultLocale(){return navigator.language||navigator.userLanguage||"inv"}getStrings(t){var e,r=this.program.strings||{};t=t||this.getDefaultLocale();let n={...r.inv||{}};return"inv"===t||(t=canonicalizeLocale(t))&&(t!==(e=parseLocale(t).language)&&e in r&&(n={...n,...r[e]}),t in r&&(n={...n,...r[t]})),n}realize(){this.program.components=this.allComponents().list(),this.program.forms=this.allForms().list(),this.program.references=this.allReferences().list(),this.program.steps=this.allSteps().list(),this.program.transitions=this.allTransitions().list(),this.program.start=this.start;const t=this.allComponents();for(;t.next();)t.current.steps=[],t.current.transitions=[];const e=this.allSteps();for(;e.next();){const n=e.current;n.transitions=[];const i=n.parent;void 0!==i&&i.steps.push(n)}const r=this.allTransitions();for(;r.next();){const s=r.current,o=s.parent;void 0!==o&&o.transitions.push(s),s.source.transitions.push(s),s.target!==s.source&&s.target.transitions.push(s)}}release(){this.program.components=[],this.program.forms=[],this.program.references=[],this.program.steps=[],this.program.transitions=[],this.program.start=void 0;const t=this.allComponents();for(;t.next();)t.current.steps=[],t.current.transitions=[];const e=this.allSteps();for(;e.next();)e.current.transitions=[]}resolveStart(t){if("number"==typeof t)return this.findStep(t);if("string"==typeof t)return this.findStep(t);if("object"!=typeof t||null===t)return this.start;var e=t.id;if("number"==typeof e)return this.findStep(e);t=t.name;return"string"==typeof t?this.findStep(t):void 0}import(t,n,s){if("object"!=typeof(t="string"==typeof t?JSON.parse(t):t)||null===t)return{};"function"!=typeof s&&(s=void 0),n=!1!==n;const i={},o={},a=new Stash,c=(t,e)=>{copyResource(t,e);let r=t.id,n=t.name;void 0!==s&&("number"==typeof(i=s(r,n))?(r=i,n=void 0):"string"==typeof i?(r=void 0,n=i):"object"==typeof i&&null!==i?(r=i.id,n=i.name):!0!==i&&(r=void 0,n=void 0)),"number"==typeof r&&(this.shift(e,r),o[r]=e),"string"==typeof n&&this.rename(e,n);var i="number"==typeof r?"id$"+r:"auto";return a.write(i,t,e),e};function u(t,e,r){var n=e.id;if("number"!=typeof n)return c(e,r());t+=n,n=i[t];return void 0===n?c(e,i[t]=r()):c(e,n)}const r=()=>this.addComponent();function h(t){const e=u("component$",t,r);return y(t.steps,t=>p(t,e)),y(t.transitions,t=>v(t,e)),e}const e=()=>this.addForm();const d=()=>this.addReference();const f=()=>this.addStep(),p=(t,e)=>{const r=u("step$",t,f);return this.changeParent(r,g(t.parent,h)||r.parent||e),y(t.transitions,t=>v(t,n?e:void 0,r)),r},m=this.addStep(),l=()=>this.addTransition(m,m),v=(t,e,r)=>{var n=u("transition$",t,()=>l());this.changeParent(n,g(t.parent,h)||n.parent||e);e=n.source!==m?n.source:void 0;this.changeSource(n,g(t.source,p)||e||r);e=n.target!==m?n.target:void 0;return this.changeTarget(n,g(t.target,p)||e||r),n};function g(t,e){if(isObject(t)){var r=t.id,r="number"==typeof r?"id$"+r:"auto";return a.read(r,t)||e(t)}}function y(t,e){if(Array.isArray(t))for(const r of t)g(r,e)}copyResource(t,this.program),y(t.components,h),y(t.forms,function(t){return u("form$",t,e)}),y(t.references,function(t){return u("reference$",t,d)}),y(t.steps,p),y(t.transitions,v),o.start=g(t.start,p),void 0===s&&(this.start=o.start);let F;var k=t=>(void 0===F&&(F=this.addStep(),this.changeParent(F,t)),F);const L=this.relate(m);for(;L.next();){F=void 0;var b=L.current;b.source===m&&this.changeSource(b,k(b.parent)),b.target===m&&this.changeTarget(b,k(b.parent))}return this.removeStep(m),this.realize(),o}export(){this.realize();const t=new ProgramInspector;t.import(this.program,!1);const e=t.program;e.steps=minifyArray(e.steps,function(e){return e.transitions=minifyArray(e.transitions,function(t){return t.source===e&&t.parent===e.parent&&(t.parent=void 0,t.source=void 0,t.target=t.target!==t.source?{id:t.target.id}:void 0,!0)}),void 0===e.parent}),e.transitions=minifyArray(e.transitions,function(t){return void 0===t.parent&&void 0!==t.source&&(t.source={id:t.source.id},t.target={id:t.target.id},!0)}),e.components=minifyArray(e.components,function(t){return t.steps=minifyArray(t.steps,function(t){return!(t.parent=void 0)}),t.transitions=minifyArray(t.transitions,function(t){return void 0!==t.parent&&(t.parent=void 0,t.source={id:t.source.id},t.target={id:t.target.id},!0)}),!0}),e.forms=minifyArray(e.forms),e.references=minifyArray(e.references);var r=t.start;return e.start=void 0!==r?{id:r.id}:void 0,e}reset(){this.incidents.clear(),this.components.clear(),this.forms.clear(),this.references.clear(),this.steps.clear(),this.transitions.clear(),this.incidents.nextId=1,this.program=makeBlankProgram(),this.start=void 0}toJSON(){return this.export()}}function iterate(t){return void 0===t?Iterator.empty:t.iterate().filter(function(t,e){return 0===String(e).lastIndexOf("token$",0)}).map(t=>t.resource,t=>t.id)}class IncidentList extends Dictionary{constructor(){super(...arguments),this.nextId=1}findFor(t){if(null!=t){var e=this.find(t.id);if(void 0!==e&&e.resource===t)return e}}newId(){let t=this.nextId;for(;this.exists(t);)t++;return this.nextId=t+1,t}relate(t,e){const r=this.findFor(t);return void 0!==r?r.master.relate(r,e):Iterator.empty}}class ResourceList extends Dictionary{constructor(t){super(),this.incidents=t}all(){return iterate(this)}cache(){let t=this.cacheLookup;if(void 0!==t)return t;t=this.cacheLookup={};const e=this.iterate();for(;e.next();){var r=e.current.resource,n=(t[r.id]=r).name;void 0!==n&&(t["$"+n]=r)}return t}findFor(t){t=this.incidents.findFor(t);return this.test(t)?t:void 0}test(t){return void 0!==t&&t.master===this}findWith(t){"string"==typeof t&&(t=this.qualify(t));t=this.incidents.find(t);return this.test(t)?t.resource:void 0}shift(t,e){this.incidents.remove(t.resource.id),"number"!=typeof e&&(e=this.incidents.newId());const r=this.incidents.assign(t.resource.id=e,t);void 0!==r&&this.incidents.assign(r.resource.id=this.incidents.newId(),r),this.cacheLookup=void 0}shiftFor(t,e){t=this.findFor(t);return void 0!==t&&(this.shift(t,e),!0)}rename(t,e){var r=t.resource.name;if(void 0!==r&&this.incidents.remove(this.qualify(r)),"string"==typeof e){e=this.qualify(t.resource.name=e);const n=this.incidents.assign(e,t);void 0!==n&&(n.resource.name=void 0)}else t.resource.name=void 0;return this.cacheLookup=void 0,r}renameFor(t,e){t=this.findFor(t);return void 0!==t&&(this.rename(t,e),!0)}add(){const t={},e=t.resource=this.create();return t.token=generateToken(),t.master=this,e.id=this.incidents.newId(),this.assign(t.token,t),this.incidents.assign(e.id,t),this.cacheLookup=void 0,t}removeFor(t){t=this.findFor(t);return void 0!==t&&(this.unlink(t),!0)}unlink(t){this.remove(t.token),this.cacheLookup=void 0;var e=t.resource.id;this.incidents.remove(e);t=t.resource.name;return void 0!==t&&this.incidents.remove(this.qualify(t)),1}relate(t,e){return Iterator.empty}changeParent(t,e){var r=t.parent;void 0!==r&&this.siblings(r).remove(t.token),void 0!==e?(t.parent=e,t.resource.parent=e.resource,this.siblings(e).assign(t.token,t)):(t.parent=void 0,t.resource.parent=void 0)}}class ComponentList extends ResourceList{create(){return{steps:[],transitions:[]}}qualify(t){return"component$"+t}unlink(t){super.unlink(t);const e=t.steps;if(void 0!==e){const n=e.iterate();for(;n.next();)n.current.resource.parent=void 0}const r=t.transitions;if(void 0!==r){const i=r.iterate();for(;i.next();)i.current.resource.parent=void 0}return 1}relate(t,e){const r=iterate(t.steps);t=iterate(t.transitions);return r.concat(t)}}class FormList extends ResourceList{create(){return{defaults:{},elements:{}}}qualify(t){return"form$"+t}}class ReferenceList extends ResourceList{create(){return{suite:"",path:""}}qualify(t){return"reference$"+t}}class StepList extends ResourceList{create(){return{inputs:{},transitions:[]}}qualify(t){return"activity$"+t}siblings(t){return t.steps||(t.steps=new Dictionary)}unlink(t){let e=super.unlink(t);void 0!==t.parent&&t.parent.steps.remove(t.token);const r=t.transitions;if(void 0!==r){const n=r.iterate();for(;n.next();)e+=n.current.master.unlink(n.current)}return e}relate(t,e){var r=t.transitions;if(void 0===r)return Iterator.empty;if(void 0===e)return iterate(r);let n=t.branches;if(void 0===n){n=t.branches={};for(const s of iterate(r).list().sort(compareTransitions))if(s.source===t.resource){var i=branchToToken(s.branch);const o=n[i];void 0===o?n[i]=s:Array.isArray(o)?o.push(s):n[i]=[o,s]}}return n[e]||Iterator.empty}}class TransitionList extends ResourceList{create(){return{inputs:{}}}qualify(t){return"activity$"+t}siblings(t){return t.transitions||(t.transitions=new Dictionary)}unlink(t){return super.unlink(t),t.source.branches=void 0,t.source.transitions.remove(t.token),t.target.transitions.remove(t.token),void 0!==t.parent&&t.parent.transitions.remove(t.token),1}relate(t,e){return t.source!==t.target?[t.source.resource,t.target.resource]:t.source.resource}}const safeProps={id:!1,name:!1,components:!1,elements:!0,forms:!1,references:!1,steps:!1,transitions:!1,start:!1,parent:!1,source:!1,target:!1,suite:!0,path:!0};function copyResource(t,e){for(const r in t)!1!==safeProps[r]&&(e[r]=deepClone(t[r]))}function deepClone(t){if(null!=t){if(Array.isArray(t))return t.map(deepClone);if("object"!=typeof t)return t;{const r={};for(const n in t){var e=t[n];null!=e&&(r[n]=e)}return r}}}function isObject(t){return!Array.isArray(t)&&("object"==typeof t&&null!==t)}function makeBlankProgram(){return{components:[],forms:[],references:[],steps:[],transitions:[]}}function minifyArray(e,r){let n=0;for(let t=0;t<e.length;t++){var i=e[t];void 0!==r&&!r(i)||(e[n++]=i)}return e.length=n,0<e.length?e:void 0}function branchToToken(t){return void 0!==t?"string$"+t:"blank"}function hasInputs(t){for(const e in t)return!0;return!1}function compareTransitions(t,e){return"number"==typeof t.rank?"number"!=typeof e.rank||t<e?-1:e<t?1:0:"number"==typeof e.rank?1:hasInputs(t)?hasInputs(e)?0:-1:hasInputs(e)?1:0}const generateToken=function(){let t,e;function r(){t=0,e="token$"+(new Date).valueOf()+"$"}r();return function(){return 1073741824<=t&&r(),e+t++}}();function parseLocale(t){if("string"==typeof t){const e=t.split("-");if(!(e.length<1||3<e.length||e.some(t=>0===t.length))){const r={language:e[0].toLowerCase()};return 2==e.length?2==e[1].length?r.territory=e[1].toUpperCase():r.script=e[1][0].toUpperCase()+e[1].slice(1).toLowerCase():3===e.length&&(r.script=e[1][0].toUpperCase()+e[1].slice(1).toLowerCase(),r.territory=e[2].toUpperCase()),r}}}function canonicalizeLocale(e){e=parseLocale(e);if(e){let t=e.language;return e.script&&(t+="-"+e.script),e.territory&&(t+="-"+e.territory),t}}export{ProgramInspector,parseLocale,canonicalizeLocale};
|
|
@@ -3,7 +3,7 @@ import type { Step } from "./Step";
|
|
|
3
3
|
/** Defines a transition. */
|
|
4
4
|
export interface Transition extends Activity {
|
|
5
5
|
/** Indicates the branch of that the transition participates in. */
|
|
6
|
-
branch?:
|
|
6
|
+
branch?: string;
|
|
7
7
|
/** Indicates the source of this transition (what was previous). */
|
|
8
8
|
source?: Step;
|
|
9
9
|
/** Indicates the target of this transition (what is next). */
|
|
@@ -42,10 +42,10 @@ declare abstract class ActivityContext implements IActivityState, IActivityConte
|
|
|
42
42
|
recent?: Recent;
|
|
43
43
|
repeat?: boolean;
|
|
44
44
|
state: any;
|
|
45
|
-
branch?:
|
|
45
|
+
branch?: string;
|
|
46
46
|
callBranch?: boolean;
|
|
47
47
|
forkBranch?: boolean;
|
|
48
|
-
jumpBranch?:
|
|
48
|
+
jumpBranch?: string;
|
|
49
49
|
registeredForErrors?: boolean;
|
|
50
50
|
stateToPersist: any;
|
|
51
51
|
inputs: Record<string, any>;
|
|
@@ -8,7 +8,7 @@ declare class ActivityContextProxy extends Proxy<ActivityContext> implements IAc
|
|
|
8
8
|
get luid(): any;
|
|
9
9
|
get ambient(): import("./AmbientStateProxy").default;
|
|
10
10
|
get action(): string;
|
|
11
|
-
get branch(): string |
|
|
11
|
+
get branch(): string | undefined;
|
|
12
12
|
get cancellationToken(): import("../Task").Task<void>;
|
|
13
13
|
get passes(): number;
|
|
14
14
|
get caught(): Error | undefined;
|
|
@@ -31,6 +31,7 @@ declare class AmbientState implements IDebugSession, IAmbientState {
|
|
|
31
31
|
locale: string | undefined;
|
|
32
32
|
logLevel: LogLevel | undefined;
|
|
33
33
|
outputs: Record<string, any>;
|
|
34
|
+
printingServiceUrl: string | undefined;
|
|
34
35
|
removeExternalEventHandler: (_callback: ExternalEventCallback) => void;
|
|
35
36
|
setExternalEventHandler: (_callback: ExternalEventCallback) => void;
|
|
36
37
|
trivia: Record<string, any> | undefined;
|
|
@@ -65,7 +66,7 @@ declare class AmbientState implements IDebugSession, IAmbientState {
|
|
|
65
66
|
prepare(next: ActivityContext, context?: ActivityContext, caught?: Error): void;
|
|
66
67
|
attempt(transition: Transition): void;
|
|
67
68
|
start(step: Step, context?: ActivityContext, caught?: Error): void;
|
|
68
|
-
enqueue(step: Step, branch?:
|
|
69
|
+
enqueue(step: Step, branch?: string): void;
|
|
69
70
|
goto(frame: MonikerFrame): boolean;
|
|
70
71
|
}
|
|
71
72
|
export {};
|
|
@@ -20,6 +20,7 @@ declare class AmbientStateProxy extends Proxy<AmbientState> implements IAmbientS
|
|
|
20
20
|
get locale(): string | undefined;
|
|
21
21
|
get logLevel(): LogLevel | undefined;
|
|
22
22
|
set logLevel(level: LogLevel | undefined);
|
|
23
|
+
get printingServiceUrl(): string | undefined;
|
|
23
24
|
removeExternalEventHandler(callback: ExternalEventCallback): void;
|
|
24
25
|
get resources(): Record<string, any> | undefined;
|
|
25
26
|
setExternalEventHandler(callback: ExternalEventCallback): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Proxy,{clearGuard}from"./Proxy.js";class AmbientStateProxy extends Proxy{get outputs(){return clearGuard(),this.target.outputs}set outputs(t){clearGuard(),this.target.outputs=t}get error(){return clearGuard(),this.target.error}set error(t){clearGuard(),this.target.error=t}get completion(){return clearGuard(),this.target.completion}complete(t){return clearGuard(),this.target.complete(t)}reject(t){return clearGuard(),this.target.reject(t)}get environment(){return clearGuard(),this.target.environment}get inputs(){return clearGuard(),this.target.inputs}get activityContexts(){return clearGuard(),this.target.activityContexts}get locale(){return clearGuard(),this.target.locale}get logLevel(){return clearGuard(),this.target.logLevel}set logLevel(t){clearGuard(),this.target.logLevel=t}removeExternalEventHandler(t){return clearGuard(),this.target.removeExternalEventHandler(t)}get resources(){return clearGuard(),this.target.resources}setExternalEventHandler(t){return clearGuard(),this.target.setExternalEventHandler(t)}get trivia(){return clearGuard(),this.target.trivia}}export default AmbientStateProxy;
|
|
1
|
+
import Proxy,{clearGuard}from"./Proxy.js";class AmbientStateProxy extends Proxy{get outputs(){return clearGuard(),this.target.outputs}set outputs(t){clearGuard(),this.target.outputs=t}get error(){return clearGuard(),this.target.error}set error(t){clearGuard(),this.target.error=t}get completion(){return clearGuard(),this.target.completion}complete(t){return clearGuard(),this.target.complete(t)}reject(t){return clearGuard(),this.target.reject(t)}get environment(){return clearGuard(),this.target.environment}get inputs(){return clearGuard(),this.target.inputs}get activityContexts(){return clearGuard(),this.target.activityContexts}get locale(){return clearGuard(),this.target.locale}get logLevel(){return clearGuard(),this.target.logLevel}set logLevel(t){clearGuard(),this.target.logLevel=t}get printingServiceUrl(){return clearGuard(),this.target.printingServiceUrl}removeExternalEventHandler(t){return clearGuard(),this.target.removeExternalEventHandler(t)}get resources(){return clearGuard(),this.target.resources}setExternalEventHandler(t){return clearGuard(),this.target.setExternalEventHandler(t)}get trivia(){return clearGuard(),this.target.trivia}}export default AmbientStateProxy;
|
package/execution/Engine.d.ts
CHANGED
|
@@ -17,25 +17,27 @@ export interface RunOptions {
|
|
|
17
17
|
cancellationToken?: PromiseLike<any>;
|
|
18
18
|
/** Indicates a debugger callback. */
|
|
19
19
|
debug?: (session: IDebugSession) => void;
|
|
20
|
+
/** Indicates any environment that may be relevant to the program being run. */
|
|
21
|
+
environment?: {};
|
|
20
22
|
/** Indicates the locale for the program being run. */
|
|
21
23
|
locale?: string;
|
|
22
24
|
/** Indicates the logging level for the program being run. */
|
|
23
25
|
logLevel?: LogLevel;
|
|
24
|
-
/** Indicates any environment that may be relevant to the program being run. */
|
|
25
|
-
environment?: {};
|
|
26
26
|
/** Indicates any inputs that may be relevant to the program being run. */
|
|
27
27
|
inputs?: {};
|
|
28
|
-
/**
|
|
29
|
-
|
|
28
|
+
/** The printing engine URL used for sending print requests. */
|
|
29
|
+
printingServiceUrl?: string;
|
|
30
30
|
/** Indicates the start step to start at. */
|
|
31
31
|
start?: Step | number | string;
|
|
32
32
|
/** Allow a master workflow to pass state to a target workflow. */
|
|
33
33
|
state?: Record<string, any>;
|
|
34
34
|
/** Indicates any language strings that the workflow has access to from the context it is being run in. */
|
|
35
35
|
strings?: Record<string, string>;
|
|
36
|
+
/** Indicates any trivia that may be relevant to the program being run. */
|
|
37
|
+
trivia?: {};
|
|
36
38
|
}
|
|
37
39
|
/** Represents an activity handler class. */
|
|
38
|
-
|
|
40
|
+
interface ActivityHandlerClass {
|
|
39
41
|
new (): IActivityHandler;
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
@@ -101,3 +103,4 @@ export declare class Engine {
|
|
|
101
103
|
*/
|
|
102
104
|
enqueueExternalEvent(event: ExternalEvent): void;
|
|
103
105
|
}
|
|
106
|
+
export {};
|
package/execution/Engine.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Bluebird from"bluebird";import{Activator}from"../Activator.js";import{getStringsForProgram}from"../LanguageStringUtils.js";import{Task}from"../Task.js";import{
|
|
1
|
+
import Bluebird from"bluebird";import{Activator}from"../Activator.js";import{getStringsForProgram}from"../LanguageStringUtils.js";import{Task}from"../Task.js";import{ProgramInspector,canonicalizeLocale}from"../definition/ProgramInspector.js";import{getCachedFormElements}from"../execution/ActivityLoader.js";import{BuiltInFormElements}from"../forms/manifest.js";import{check as checkLicense}from"../licensing/LicenseChecker.js";import{run}from"./ProgramRunner.js";class Engine{constructor(e){this._getFormElementRegistration=e=>this.formElements[e],this._registerFormElement=e=>{var t,r=e["id"];this.formElements[r]?(t={...this.formElements[r],...e},this.formElements[r]=t):this.formElements[r]=e},this.activator=new Activator,this.environment={},this.trivia={getFormElementRegistration:this._getFormElementRegistration,registerFormElement:this._registerFormElement},this.factories=[],this.implementations={},this.formElements={...getCachedFormElements(),...BuiltInFormElements},this.appSkuCode=e}setExternalEventHandler(e){this.externalEventCallback=e}removeExternalEventHandler(e){e===this.externalEventCallback&&(this.externalEventCallback=void 0)}static buildOptions(e,t){(t={...t||{}}).locale=canonicalizeLocale(t.locale),t.locale||(t.locale=e.getDefaultLocale()),t.logLevel=t.logLevel||"log";var r=new Proxy({},{get(e,t,r){return t}});const n=getStringsForProgram(e,t);return t.environment={activities:r,encodeHtml:function(e){return"string"==typeof e?e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""},getText:function(e){if("string"==typeof e&&"@"===e.charAt(0)){var t=e.slice(1);if(t in n)return n[t]}return e},strings:n,...t.environment||{}},t}createHandler(e,t){var r=this.implementations[e];if(void 0!==r){const i=Bluebird.resolve(r);return i.isFulfilled()?new(i.value()):i.then(function(e){return Bluebird.attempt(function(){return new e})})}for(const o of this.factories){var n=o.create(e,this._registerFormElement,t);if(void 0!==n)return n}}run(r,n){return Task.attempt(()=>{let e;r instanceof ProgramInspector?e=r:(e=new ProgramInspector,e.import(r)),checkLicense(e.program,this.appSkuCode),n=Engine.buildOptions(e,n);var t=e.resolveStart(n?n.start:void 0);return run(this,e,n,t)})}enqueueExternalEvent(e){this.externalEventCallback&&this.externalEventCallback(e)}}export{Engine};
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
/** Defines the loader which is passed into the main method of an activity pack. */
|
|
2
|
-
export interface Loader {
|
|
3
|
-
(path: string, require: Function, callback?: Function): PromiseLike<{}>;
|
|
4
|
-
}
|
|
5
|
-
/** Defines the module which may contain a main method. */
|
|
6
|
-
export interface Module {
|
|
7
|
-
main?(load: Loader, options: {}, prefix: string): PromiseLike<{}> | {};
|
|
8
|
-
}
|
|
9
|
-
/** Defines the concept of a global scope. */
|
|
10
|
-
export interface Global {
|
|
11
|
-
/** RequireJS compatible define method. */
|
|
12
|
-
define: Function;
|
|
13
|
-
/** RequireJS compatible require method. */
|
|
14
|
-
require: Function;
|
|
15
|
-
/** A+ Promise compatible class. */
|
|
16
|
-
Promise: PromiseConstructor;
|
|
17
|
-
}
|
|
18
|
-
/** Exposes the global object. */
|
|
19
|
-
export declare const global: Global;
|
|
20
|
-
/**
|
|
21
|
-
* Loads a module using the base module loader.
|
|
22
|
-
* WARNING: This function is passed to legacy activity packs as a parameter.
|
|
23
|
-
* Changes to the parameters could introduce bugs.
|
|
24
|
-
* @param path The path to load.
|
|
25
|
-
* @param require The require method to use.
|
|
26
|
-
* @param callback The callback to invoke.
|
|
27
|
-
*/
|
|
28
|
-
export declare function load(path: string, require?: Function, callback?: Function): Promise<Module>;
|
|
29
1
|
/**
|
|
30
2
|
* Dynamically adds a unique module name to the require paths
|
|
31
3
|
* for the given url, so that dependencies can be loaded
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Task}from"../Task.js";import*as Activities from"../activities/main.js";const global=new Function("return this")();function getRequireString(){return"require"}async function load(e,o
|
|
1
|
+
import{Task}from"../Task.js";import*as Activities from"../activities/main.js";const global=new Function("return this")();function getRequireString(){return"require"}async function load(e,i,o){"function"!=typeof i&&(i=global[getRequireString()]);var t=new Task(function(t){i([e],function(e){t(e),"function"==typeof o&&o(e)})});return Task.race([t,new Task((e,t)=>setTimeout(t,9e4))])}"function"!=typeof global.Promise&&(global.Promise=Promise);let nextId=0;const moduleNames={};function registerModuleName(e){let t=moduleNames[e];if(void 0!==t)return t;t=`@vertigis/workflow/externals/ext-${nextId++}`;var i="/"===e[e.length-1]?e.substring(0,e.length-1):e;return global[getRequireString()]({map:{"*":{"@geocortex/workflow":"@vertigis/workflow"}},paths:{[t]:i}}),moduleNames[e]=t}async function importModule(e,t,i){let o;return o="@vertigis/workflow/activities/main"===e?Activities:await load(e),void 0!==o&&null!==o&&"function"==typeof o.main?o.main.call(global,load,t,i):o}export{registerModuleName,importModule};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Bluebird from"bluebird";import{GenericActivityError,ProgramStartError}from"../Errors.js";import{Task}from"../Task.js";import AmbientState from"./AmbientState.js";import AmbientStateProxy from"./AmbientStateProxy.js";import{newSymbol}from"./util.js";function combine(e,t){return{...e||{},...t||{}}}function run(i,o,a,c){const
|
|
1
|
+
import Bluebird from"bluebird";import{GenericActivityError,ProgramStartError}from"../Errors.js";import{Task}from"../Task.js";import AmbientState from"./AmbientState.js";import AmbientStateProxy from"./AmbientStateProxy.js";import{newSymbol}from"./util.js";function combine(e,t){return{...e||{},...t||{}}}function run(i,o,a,c){const l=e=>{var t=o.findStep(e);if(!t)throw new GenericActivityError(`The workflow does not contain a step with the id ${e}.`);return t},s=()=>{const t=u.frame.current.action;return o.allReferences().filter(e=>void 0!==e.suite&&t.startsWith(e.suite)).peek()?.path},m=(e,t,r,n)=>{e=l(e);const i=l(t);if(!i.transitions.some(e=>"content"===e.branch||"try"===e.branch))throw new GenericActivityError(`The ${t} step is not a Container, Subworkflow, or Try Catch activity.`);r=`${n}$${r}`;f(e,i,r)},v=e=>{var t=u.frame.current.activity,r=l(e);if("gcx:wf:core::Subworkflow"!==r.action)throw new GenericActivityError(`The target step ${e} is not a Subworkflow activity.`);f(t,r,"default")},f=(e,t,r)=>{var n=o.relate(e,r).peek();void 0!==n&&o.remove(n);const i=o.addTransition(e,t);i.branch=r},u=new AmbientState;return u.completion=new Bluebird((e,t)=>{u.resolveCompletion=e,u.rejectCompletion=t}),u.cancellationToken=new Task(e=>u.cancellationResolve=e),u.execute(function(){if(o.isStep(c)){a=a||{},u.engine=i,u.inspector=o,u.id=newSymbol(),u.debug=a.debug||(()=>{}),u.environment=combine(i.environment,a.environment),u.inputs=a.inputs||{},u.locale=a.locale,u.logLevel=a.logLevel,u.outputs={},u.printingServiceUrl=a.printingServiceUrl,u.removeExternalEventHandler=i.removeExternalEventHandler.bind(i),u.resources={forms:o.cacheForms()},u.setExternalEventHandler=i.setExternalEventHandler.bind(i),u.trivia=combine(i.trivia,a.trivia),u.trivia.getActivityPackUrl=s,u.trivia.setFormElementEvent=m,u.trivia.setSubworkflowTransition=v,u.proxy=new AmbientStateProxy(u);const t=u.trivia.isDescendantOf;t?u.trivia.isDescendantOf=e=>e===u.proxy||t(e):u.trivia.isDescendantOf=e=>e===u.proxy;const r=u.frame;r.index=0,r.cancellationToken=u.cancellationToken,r.state=a.state||{};var e=a.cancellationToken;if(null!=e){const n=Task.race([e,u.cancellationToken]);n.isPending()?(e=()=>u.cancel(),n.then(e,e)):u.cancel()}u.start(c)}else u.reject(new ProgramStartError)}),u.completion}export{run};
|
package/execution/util.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const reservedIdentifiers=["
|
|
1
|
+
const reservedIdentifiers=["Array","Date","Intl","JSON","Math","Object","Set","decodeURIComponent","document","encodeURIComponent","isNaN","parseFloat","parseInt","resources","values","window"];function isAccessor(n){return!("string"!=typeof n||n.length<1)&&(!(0<=n.indexOf("."))&&!reservedIdentifiers.some(e=>e===n))}function isExpression(e){var n=e.type;return null==n&&"string"==typeof e.code}function isLiteral(e){switch(typeof e){case"boolean":case"number":case"string":return!0}return!1}let nextSymbol,nextSymbolPrefix;function newSymbol(){return void 0!==nextSymbol&&1073741824<=nextSymbol&&(nextSymbol=void 0),void 0===nextSymbol&&(nextSymbol=0,nextSymbolPrefix=(new Date).valueOf()+":"),nextSymbolPrefix+nextSymbol++}export{isAccessor,isExpression,isLiteral,newSymbol};
|
package/forms/Calendar.d.ts
CHANGED