VertiGIS Studio Workflow TypeScript SDK Overview
The VertiGIS Studio Workflow for Web Applications SDK consists of a TypeScript project that eases development of custom Workflow activities and form elements. It produces a Workflow activity pack that can be consumed by web applications that use Workflow.
Overview
The VertiGIS Studio Workflow SDK provides a development toolkit for building custom Workflow activities and form elements into a package that can be deployed to VertiGIS Studio Web called an activity pack. Once the activity pack has been developed, it can then be deployed to your SaaS or on-premises environment.
Requirements
- VertiGIS Studio Workflow 5.31 or later.
- If you are using an older version of Workflow, refer to the previous releases of the SDK.
- The latest LTS version of Node.js.
- A code editor of your choice. We recommend Visual Studio Code.
Getting Started
- Run
npx @vertigis/workflow-sdk@latest create <activity-pack-name>
where<activity-pack-name>
is the name of the directory that will be created in the current working directory- For example:
npx @vertigis/workflow-sdk@latest create test-activity-pack
- For example:
- Open the
activity-pack-name
directory in your favorite IDE. We recommend using Visual Studio Code for the best experience. - Run
npm run generate
and follow the onscreen prompts to create a new activity or form element. - Finally run
npm start
to start the development server.
Project Structure
The created project contains a few important files and directories:
- The
src/index.ts
file which exports all of your custom activities and form elements. uuid.js
which maintains a globally unique identifier that will be used when you create your custom activities and form elements. This enables you to load and use multiple activity packs in a given workflow. This identifier should not be modified.
Browser Support
By default the Workflow SDK targets modern browsers. If you need to support Internet Explorer 11, you'll need to update a few configuration settings in your project.
Update TypeScript Configuration
In the tsconfig.json
of your project you'll need to change the target
to es5
:
{
"extends": "@vertigis/workflow-sdk/config/tsconfig.json",
"compilerOptions": {
"target": "es5"
},
"include": ["src"]
}
Update browserslist
In the package.json
of your project, you'll need to update the browserslist
to include ie 11
:
"browserslist": [
"last 2 chrome versions",
"last 2 edge versions",
"last 2 firefox versions",
"last 2 safari versions",
"ie 11"
]
Development Server
To get started with the development server, run npm start
in the terminal to start the development server. Before you can use the activity pack in your workflows, you will need to register the activity pack in your ArcGIS Portal.
- The activity pack is available at
https://localhost:5000/main.js
by default.- You can change the port by setting the
PORT
environment variable when runningnpm start
.
- You can change the port by setting the
- The HTTPS certificate of the development server is a self-signed certificate that web browsers will warn about. To work around this open
https://localhost:5000/main.js
in a web browser and allow the invalid certificate as an exception. For creating a locally-trusted HTTPS certificate see the Configuring a HTTPS Certificate section. - The development server supports CORS requests from any origin by default.
As localhost
is only accessible to your host machine, activity packs hosted in this manner will not be accessible when running VertiGIS Studio Workflow Designer on a different machine.
Configuring a HTTPS Certificate
You can create a locally-trusted development certificate that is trusted by your system using the mkcert utility. Once installed you can run:
$ mkcert -install
Created a new local CA at "/Users/ian/Library/Application Support/mkcert" 💥
The local CA is now installed in the system trust store! ⚡️
The local CA is now installed in the Firefox trust store (requires browser restart)! 🦊
$ mkcert localhost 127.0.0.1 ::1
Using the local CA at "/Users/ian/Library/Application Support/mkcert" ✨
Created a new certificate valid for the following names 📜
- "localhost"
- "127.0.0.1"
- "::1"
The certificate is at "./localhost+2.pem" and the key at "./localhost+2-key.pem" ✅
Once you've created your locally-trusted development certificate you can provide the paths to the cert
and key
files:
$ npm start -- --cert "./localhost+2.pem" --key "./localhost+2-key.pem"
The extra --
used in the npm start
script is necessary to forward the arguments to the development server process.
Deployment
Deploying Workflow activities consists of two steps:
- Hosting the Workflow activity pack on a server accessible to the VertiGIS Studio Workflow Designer
- Making the Workflow activity pack known to VertiGIS Studio Workflow Designer and Workflow Applications by registering it as an ArcGIS item.
Creating a Production Build
Run npm run build
in the root of your project to create a production build of your activity pack. This creates an optimized production build that is output to the build
folder of your project.
Check out Implement Custom Activities for Web Applications to learn how to make activities for your activity pack.
Host the Activity Pack
The build
folder produced by running npm run build
can be directly hosted with the web server technology that is most appropriate for your use case, such as IIS.
Activity packs must be hosted by a web server that supports HTTPS and CORS.
Server Requirements
- The server must have a valid HTTPS certificate.
- The server must support Cross-Origin Resource Sharing (CORS) and allow CORS requests from the
https://apps.vertigisstudio.com
origin or the origin of your VertiGIS Studio Workflow if running on-premises.
If you sign in to VertiGIS Studio Workflow Designer using Portal for ArcGIS your server will need to allow CORS requests from your custom origin. For example, https://acme.apps.vertigisstudio.com
.
Hosting Workflow activity packs in this manner allows VertiGIS Studio Workflow Designer to read the list of custom activities and their associated metadata.
Register the Activity Pack
To make an activity pack available to workflow authors in VertiGIS Studio Workflow Designer you must create a special item in ArcGIS Online or Portal for ArcGIS that references it.
- Sign in to ArcGIS Online or Portal for ArcGIS.
- Go to My Content.
- Select Add Item > An application.
- Type:
Web Mapping
- Purpose:
Ready To Use
- API:
JavaScript
- URL: The URL to your activity pack manifest
- Use
https://localhost:5000/activitypack.json
for the development server, or the URL to your production server hosting the activity pack such ashttps://myserver.com/custom-activity-pack/activitypack.json
.
- Use
- Title: Your desired title
- Tags: Must include
geocortex-workflow-activity-pack
- Type:
The activity pack will not be registered unless it includes the geocortex-workflow-activity-pack
tag.
Sharing the Activity Pack
As a workflow author, you will see custom activities in VertiGIS Studio Workflow Designer from the activity packs you have registered. You will also see activity packs that have been shared with you via groups you are a member of.
To share an activity pack with other workflow authors in your organization share the ArcGIS item that represents the activity pack with a group that contains the target users.
You do not need to share the activity pack Portal item with the end users of your applications that run workflows containing custom activities. It only affects the visibility of the activity pack in the VertiGIS Studio Workflow Designer.
Upgrading to v4
There is a breaking change in v4 of the SDK that requires manual changes in order to continue to work. We moved the contents of the runtime
folder in the @vertigis/workflow
package to the parent folder. Any new activities or form elements that you create will use the new path, but existing code needs to be updated manually.
- Upgrade the packages.
- Open a command prompt and go to the root directory of your activity pack.
- Run
npm install -D @vertigis/workflow@5.33.0 @vertigis/workflow-sdk@4.0.0
.
- Update existing code.
- Find and replace all instances of
@vertigis/workflow/runtime
with@vertigis/workflow
in your existing code. - Save all changes.
- Find and replace all instances of
Upgrading to v3
There is a breaking change in v3 of the SDK that requires manual changes in order to continue to work. We renamed the @geocortex/workflow
package to @vertigis/workflow
. Any new activities or form elements that you create will use the new @vertigis/workflow
package name, but existing code needs to be updated manually.
- Upgrade the packages.
- Open a command prompt and go to the root directory of your activity pack.
- Run
npm uninstall @geocortex/workflow
. - Run
npm install -D @vertigis/workflow@5.31.0 @vertigis/workflow-sdk@3.0.0
.
- Update existing code.
- Find and replace all instances of
@geocortex/workflow
with@vertigis/workflow
in your existing code. - Save all changes.
- Find and replace all instances of
Migrating from the Legacy SDK
If you're migrating from our previous activity-sdk.zip
there are a few steps you will want to follow to migrate your source code over to the new SDK:
-
Follow the instructions above to create a new project and register the activity pack.
- Note the updated instructions to register the activity pack. The URL should end in
/activitypack.json
.
- Note the updated instructions to register the activity pack. The URL should end in
-
Copy the UUID value from
.build/uuid.txt
in your existing project and overwrite the value inuuid.js
of your new project. -
Copy your activity and form element modules into the
src/activities
directory. -
Add each activity and form element to the
index.ts
exports. For example if you copied over an activity calledsrc/activities/Sum.ts
, you would add the following tosrc/index.ts
:-
export * from "./activities/Sum";
-
-
Check your
main.ts
andinit.ts
logic in your existing project to see if any of it is still relevant. You no longer need to callmapDependencies()
to use third party libraries as the new SDK will handle this for you. -
Test your activity pack to ensure it still behaves as expected.
Next Steps
Implement a Custom Activity
Implement a custom activity for web applications
Implement a Custom Form Element
Implement a custom form element for web applications
Reference a Third Party Library
Reference a third party library in web applications
Integrate the ArcGIS API for JavaScript into custom activities
Integrate the ArcGIS API for JavaScript into custom code