@formio/appserver 2.4.0 → 2.5.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.
Files changed (3) hide show
  1. package/LICENSE.txt +1 -1
  2. package/README.md +4 -129
  3. package/package.json +4 -3
package/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  OSL-3.0
2
2
  https://opensource.org/licenses/OSL-3.0
3
- Copyright (c) 2020, Form.io LLC
3
+ Copyright (c) 2025, Form.io LLC
4
4
  All rights reserved.
5
5
 
6
6
  This Open Software License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:
package/README.md CHANGED
@@ -4,14 +4,14 @@ The Form.io App Server is a performant run-time application server used to serve
4
4
  It's goals are as follows:
5
5
  - Provide a single project runtime server where non-submission resources are cached in memory.
6
6
  - Enable multi-tenant / multi-database deployments.
7
- - Provide extensible server-side functionality
7
+ - Provide extensible server-side functionality, like custom actions.
8
8
  - Support other databases besides MongoDB compliant databases for submission data.
9
9
 
10
10
  ### Installation
11
11
  To use this library, you must mount it within an Express.js application. As an example, you can create a simple Express.js application with this library by first creating a new [Express.js application](https://expressjs.com/en/starter/installing.html) and then install and use the Server as follows.
12
12
 
13
13
  ```
14
- npm install --save @formio/appserver@rc
14
+ npm install --save @formio/appserver
15
15
  ```
16
16
 
17
17
  Then within your server.js file, you would add the following.
@@ -24,9 +24,6 @@ const { Server } = require('@formio/appserver');
24
24
  // Create the server.
25
25
  const server = new Server();
26
26
 
27
- // Initialize the server.
28
- await server.init();
29
-
30
27
  // Add the server router.
31
28
  app.use(await server.router());
32
29
 
@@ -65,9 +62,9 @@ This library uses environment variables to configure the configurations required
65
62
  | Variable Name | Required | Description | Example |
66
63
  |--------------|-----|-----------|-----|
67
64
  | MONGO | yes | Your MongoDB Connection string to use the default DB. | mongodb://localhost:27017/appserver |
68
- | PROJECT_ENDPOINT | yes | The endpoint for your deployed Form.io Enterprise project. | https://mydeployment.com/myproject |
65
+ | PROJECT | yes | The endpoint for your deployed Form.io Enterprise project. | https://mydeployment.com/myproject |
69
66
  | PROJECT_KEY | yes | The API Key for your deployed Form.io Enterprise Project. | abc123 |
70
- | LICENSE_KEY | yes | Your License Key for this App Server deployment. | <LONG LICENSE KEY> |
67
+ | APPSERVER_LICENSE | yes | Your License Key for this App Server deployment. | <LONG LICENSE KEY> |
71
68
  | PORT | no | The port that your server will run on. Default 3005 | 3005 |
72
69
  | JWT_SECRET | yes | The key used to protect your JWT authentication tokens. | YOUR_SECRET_KEY |
73
70
  | JWT_EXPIRE_TIME | no | The number of minutes to expire your JWT token. | 240 |
@@ -75,128 +72,6 @@ This library uses environment variables to configure the configurations required
75
72
  | PROJECT_CACHE | no | Disables the cache for project resources (such as Project template, Project Settings, and Access Settings). Default "true" | true |
76
73
  | MONGO_CONFIG | no | Additional configurations to add to the DB connection string | {} |
77
74
 
78
- ### Developer Portal Connection
79
- Once you have the App Server running within your own environment, and connected to your own database, you can now deploy your new changes to your forms, resources, project settings, etc. To accomplish this, you must first run the App Server using the ```PORTAL_SECRET``` described above.
80
-
81
- Once you have this set, you can then log into your Developer Portal, and then navigate to your Project.
82
-
83
- Once there, you will then go to your **Staging | Connect Environment**. Here you will put your App Server endpoint and the PORTAL_SECRET value. You will then want to set the **Project Path Type** to use **Subdirectory**. Then click **Continue**.
84
-
85
- You will then see the next page, where you will select your Stage in the dropdown. You should see it since the App Server connects to the project on bootup.
86
-
87
- Once you are connected, any changes you make within the Developer portal will now be directly reflected within your App Server deployment.
88
-
89
- ### Custom Configuration
90
- The App Server is very extensible, and many things can be altered and modified as well as custom implementations of different components are possible using configurations.
91
-
92
- The following configurations can be provided to the Server instance. Here are some configurations that are supported.
93
-
94
- ```js
95
- const express = require('express');
96
- const app = express();
97
- const { Server, Prepper } = require('@formio/appserver');
98
- const { CustomDB } = require('./customDb');
99
- const { CustomAuth } = require('./customAuth');
100
- const { CustomAction } = require('./actions/custom');
101
- (async function bootup() {
102
- // Create the server.
103
- const server = new Server({
104
- /**
105
- * The "db" configuration provides a way to use a Custom database implementation.
106
- *
107
- * See https://github.com/formio/appserver/blob/main/src/db.ts for an example on
108
- * how to implement your own custom db.
109
- */
110
- db: CustomDB,
111
-
112
- /**
113
- * The "auth" configuration provides a way to implement your own custom Authentication
114
- * system.
115
- *
116
- * See https://github.com/formio/appserver/blob/main/src/auth.ts for an example on
117
- * how to implement one.
118
- */
119
- auth: CustomAuth,
120
-
121
- /**
122
- * The "actions" is a map of new Actions you wish to implement into the application
123
- * server. Each one that is provided will then become available within the Form
124
- * builder and can be configured as an action that is executed when the form is
125
- * submitted.
126
- */
127
- actions: {
128
- custom: CustomAction
129
- },
130
-
131
- /**
132
- * Preppers provide you a way to hook into the data preparation methods that are
133
- * called before the submission is saved into the database, as well as when the data
134
- * is read from the database and sent up to the client. They provide a way to manipulate
135
- * the data before it is transfered. A good example of a prepper is to remove any
136
- * "protected" fields so they are not sent up to the client application.
137
- *
138
- * See https://github.com/formio/appserver/tree/main/src/prepare for examples.
139
- *
140
- * There are two types of preppers... those called on "save" and those called on "read".
141
- *
142
- * - save: Called when the submission is being saved.
143
- * - read: Called when the submission is being read from the database and sent to the
144
- * client application.
145
- *
146
- * The "scope" argument is a PrepScope type. See https://github.com/formio/appserver/blob/main/src/types/submission.ts
147
- */
148
- preppers: {
149
- save: Prepper.preppers.save.concat([
150
- async (scope) => {
151
- const { component, data, value, path } = scope;
152
- // Do something with "data" property to mutate data prepped.
153
- console.log('Save Prepper 1');
154
- }
155
- ]),
156
- read: Prepper.preppers.read.concat([
157
- async (scope) => {
158
- const { component, data, value, path } = scope;
159
- console.log('Read Prepper 1');
160
- }
161
- ])
162
- },
163
-
164
- /**
165
- * Processors provide a way to process data during the Create and Update phase for
166
- * submissions. They should return an "errors" array if there are any errors during the
167
- * processing phase. A good example of a processor is submission validation.
168
- *
169
- * See https://github.com/formio/appserver/tree/main/src/process for other examples.
170
- *
171
- * The "scope" argument is a ProcessScope type. See https://github.com/formio/appserver/blob/main/src/types/submission.ts
172
- */
173
- processors: {
174
- submission: [
175
- (scope) => {},
176
- (scope) => {}
177
- ],
178
- evaluator: [
179
- (scope) => {}
180
- ],
181
- prepare: [
182
- (scope) => {}
183
- ]
184
- }
185
- });
186
-
187
- // Initialize the server.
188
- await server.init();
189
-
190
- // Add the server router.
191
- app.use(await server.router());
192
-
193
- // Start server.
194
- app.listen(process.env.PORT, () => {
195
- console.log(`Server running on port ${process.env.PORT}`);
196
- });
197
- })();
198
- ```
199
-
200
75
  Enjoy
201
76
 
202
77
  - The Form.io Team
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/appserver",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "A highly performant and extensible Application Server for Form.io Multi-Tenant Deployments.",
5
5
  "main": "lib/server.js",
6
6
  "types": "lib/server.d.ts",
@@ -26,11 +26,12 @@
26
26
  "lib",
27
27
  "server.js",
28
28
  "package.json",
29
- "README.md"
29
+ "README.md",
30
+ "LICENSE.txt"
30
31
  ],
31
32
  "homepage": "https://github.com/formio/appserver#readme",
32
33
  "dependencies": {
33
- "@formio/appserver-core": "^2.4.0",
34
+ "@formio/appserver-core": "^2.5.0",
34
35
  "@formio/core": "2.5.1-dev.291.6557e4e",
35
36
  "async": "^3.2.6",
36
37
  "bcryptjs": "^3.0.3",