@formio/appserver 1.2.10 → 2.0.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ /// <reference types="express" />
1
2
  declare const _default: {
2
3
  save: {
3
4
  readonly info: {
package/lib/server.d.ts CHANGED
@@ -1,14 +1,14 @@
1
+ /// <reference types="express" />
1
2
  import { Server as CoreServer } from '@formio/appserver-core';
2
3
  import { Database, Auth } from "./modules";
3
4
  import Actions from "./actions";
4
- import { Processor } from "./process";
5
5
  import { Prepper } from './prepare';
6
- import { AppServerScope, Processor as ProcessorType, Prepper as PrepperType } from '@formio/appserver-types';
6
+ import { AppServerScope } from '@formio/appserver-types';
7
7
  export declare const Modules: {
8
8
  db: typeof Database;
9
9
  auth: typeof Auth;
10
- processor: ProcessorType;
11
- prepper: PrepperType;
10
+ processors: ProcessTarget;
11
+ prepper: import("@formio/appserver-types").Prepper;
12
12
  actions: {
13
13
  save: {
14
14
  readonly info: {
@@ -172,7 +172,6 @@ export declare class Server extends CoreServer {
172
172
  constructor(config?: AppServerScope);
173
173
  }
174
174
  export { Prepper };
175
- export { Processor };
176
175
  export { Database };
177
176
  export { Auth };
178
177
  export { Actions };
package/lib/server.js CHANGED
@@ -3,14 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Actions = exports.Auth = exports.Database = exports.Processor = exports.Prepper = exports.Server = exports.Modules = void 0;
6
+ exports.Actions = exports.Auth = exports.Database = exports.Prepper = exports.Server = exports.Modules = void 0;
7
7
  // Load the license key.
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const get_1 = __importDefault(require("lodash/get"));
10
10
  let licenseKey = (0, get_1.default)(process.env, 'LICENSE_KEY', '');
11
11
  if (!licenseKey) {
12
12
  try {
13
- licenseKey = fs_1.default.readFileSync(path_1.default.join((0, process_2.cwd)(), 'license.txt'), 'utf8');
13
+ licenseKey = fs_1.default.readFileSync(path_1.default.join((0, process_1.cwd)(), 'license.txt'), 'utf8');
14
14
  }
15
15
  catch (err) {
16
16
  console.log('No license key found. Please set the LICENSE_KEY environment variable or create a license.txt file in the root of the project.');
@@ -22,27 +22,26 @@ Object.defineProperty(exports, "Database", { enumerable: true, get: function ()
22
22
  Object.defineProperty(exports, "Auth", { enumerable: true, get: function () { return modules_1.Auth; } });
23
23
  const actions_1 = __importDefault(require("./actions"));
24
24
  exports.Actions = actions_1.default;
25
- const process_1 = require("./process");
26
- Object.defineProperty(exports, "Processor", { enumerable: true, get: function () { return process_1.Processor; } });
27
25
  const prepare_1 = require("./prepare");
28
26
  Object.defineProperty(exports, "Prepper", { enumerable: true, get: function () { return prepare_1.Prepper; } });
29
- const process_2 = require("process");
27
+ const process_1 = require("process");
30
28
  const path_1 = __importDefault(require("path"));
31
29
  const defaultsDeep_1 = __importDefault(require("lodash/defaultsDeep"));
30
+ const core_1 = require("@formio/core");
32
31
  const packageJson = require('../package.json');
33
32
  const appCorePackage = require('@formio/appserver-core/package.json');
34
33
  const corePackage = require('@formio/core');
35
34
  exports.Modules = {
36
35
  db: modules_1.Database,
37
36
  auth: modules_1.Auth,
38
- processor: process_1.Processor,
37
+ processors: core_1.ProcessTargets,
39
38
  prepper: prepare_1.Prepper,
40
39
  actions: actions_1.default
41
40
  };
42
41
  class Server extends appserver_core_1.Server {
43
42
  constructor(config = {}) {
44
43
  if (config.processors) {
45
- exports.Modules.processor.processors = config.processors;
44
+ exports.Modules.processors = config.processors;
46
45
  }
47
46
  if (config.preppers) {
48
47
  exports.Modules.prepper.preppers = config.preppers;
@@ -55,7 +54,7 @@ class Server extends appserver_core_1.Server {
55
54
  url: (0, get_1.default)(process.env, 'MONGO', "mongodb://localhost:27017/appserver"),
56
55
  config: (0, get_1.default)(process.env, 'MONGO_CONFIG', "{}")
57
56
  }),
58
- processor: exports.Modules.processor,
57
+ processors: exports.Modules.processors,
59
58
  prepper: exports.Modules.prepper,
60
59
  auth: config.auth || new exports.Modules.auth(),
61
60
  actions: Object.assign(Object.assign({}, exports.Modules.actions), config.actions),
@@ -1,6 +1,7 @@
1
1
  import { FormScope } from "./form";
2
- import { PrepScope, ProcessScope } from "./submission";
2
+ import { PrepScope } from "./submission";
3
3
  import { OfflineLicenseStruct } from '@formio/license';
4
+ import { ValidationContext, ProcessTarget } from "@formio/core/types";
4
5
  export interface ProjectConfig {
5
6
  url: string;
6
7
  key: string;
@@ -58,15 +59,12 @@ export interface ServerDB {
58
59
  formCollection: (scope: FormScope) => Promise<any>;
59
60
  addIndexes: (scope: FormScope, indexes: string[]) => Promise<any>;
60
61
  removeIndexes: (scope: FormScope, indexes: string[]) => Promise<any>;
62
+ isUnique: (scope: FormScope, context: ValidationContext, value: any) => Promise<boolean | string>;
61
63
  }
62
64
  export interface AuthModule {
63
65
  token: (user: AuthToken, secret: string, expire: number) => Promise<string>;
64
66
  user: (token: string, secret: string) => Promise<AuthToken | null>;
65
67
  }
66
- export interface Processor {
67
- processors: Array<(scope: ProcessScope) => Promise<any[]>>;
68
- process: (scope: ProcessScope) => Promise<any>;
69
- }
70
68
  export interface Preppers {
71
69
  save: Array<(scope: PrepScope) => Promise<any>>;
72
70
  read: Array<(scope: PrepScope) => Promise<any>>;
@@ -80,7 +78,7 @@ export interface ServerScope {
80
78
  db: ServerDB;
81
79
  auth: AuthModule;
82
80
  actions: any;
83
- processor: Processor;
81
+ processors: ProcessTarget;
84
82
  prepper: Prepper;
85
83
  access?: any;
86
84
  hooks?: any;
@@ -94,7 +92,7 @@ export interface AppServerScope {
94
92
  config?: ServerConfig;
95
93
  db?: ServerDB;
96
94
  auth?: AuthModule;
97
- processors?: Array<(scope: ProcessScope) => Promise<any[]>>;
95
+ processors?: ProcessTarget;
98
96
  preppers?: Preppers;
99
97
  actions?: any;
100
98
  hooks?: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formio/appserver",
3
- "version": "1.2.10",
3
+ "version": "2.0.0-dev.2",
4
4
  "description": "A highly performant and extensible Application Server for Form.io Multi-Tenant Deployments.",
5
5
  "main": "server.js",
6
6
  "scripts": {
@@ -29,10 +29,11 @@
29
29
  ],
30
30
  "homepage": "https://github.com/formio/appserver#readme",
31
31
  "dependencies": {
32
- "@formio/appserver-auth-jwt": "^1.0.1",
33
- "@formio/appserver-core": "^1.4.10",
34
- "@formio/appserver-db-mongodb": "^1.0.5",
35
- "@formio/appserver-types": "^1.2.5",
32
+ "@formio/appserver-auth-jwt": "^2.0.0-dev.1",
33
+ "@formio/appserver-core": "^2.0.0-dev.3",
34
+ "@formio/appserver-db-mongodb": "^2.0.0-dev.1",
35
+ "@formio/appserver-types": "^2.0.0-dev.1",
36
+ "@formio/core": "^2.0.0-dev.3",
36
37
  "async": "^3.2.4",
37
38
  "bcryptjs": "^2.4.3",
38
39
  "debug": "^4.3.4",