@formio/appserver 2.0.0-rc.1 → 2.0.0-rc.3

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 (46) hide show
  1. package/README.md +12 -6
  2. package/lib/actions/index.d.ts +11 -11
  3. package/lib/actions/login/LoginAction.d.ts +3 -2
  4. package/lib/actions/login/LoginAction.spec.d.ts +1 -0
  5. package/lib/actions/login/LoginAction.spec.js +15 -0
  6. package/lib/actions/role/RoleAction.spec.d.ts +1 -0
  7. package/lib/actions/role/RoleAction.spec.js +15 -0
  8. package/lib/actions/save/SaveAction.spec.d.ts +1 -0
  9. package/lib/actions/save/SaveAction.spec.js +15 -0
  10. package/lib/modules/auth/auth.spec.d.ts +1 -0
  11. package/lib/modules/auth/auth.spec.js +93 -0
  12. package/lib/modules/index.d.ts +1 -1
  13. package/lib/modules/index.js +2 -2
  14. package/lib/modules/mongodb/db.d.ts +128 -0
  15. package/lib/modules/mongodb/db.js +706 -0
  16. package/lib/modules/mongodb/db.spec.d.ts +1 -0
  17. package/lib/modules/mongodb/db.spec.js +714 -0
  18. package/lib/server.d.ts +3 -6
  19. package/lib/server.js +8 -12
  20. package/package.json +20 -20
  21. package/lib/prepare/access.d.ts +0 -3
  22. package/lib/prepare/access.js +0 -62
  23. package/lib/prepare/bcrypt.d.ts +0 -3
  24. package/lib/prepare/bcrypt.js +0 -25
  25. package/lib/prepare/index.d.ts +0 -11
  26. package/lib/prepare/index.js +0 -60
  27. package/lib/prepare/password.d.ts +0 -3
  28. package/lib/prepare/password.js +0 -27
  29. package/lib/prepare/persist.d.ts +0 -3
  30. package/lib/prepare/persist.js +0 -24
  31. package/lib/prepare/protect.d.ts +0 -3
  32. package/lib/prepare/protect.js +0 -28
  33. package/lib/prepare/reference.d.ts +0 -3
  34. package/lib/prepare/reference.js +0 -71
  35. package/lib/types/action.d.ts +0 -7
  36. package/lib/types/action.js +0 -2
  37. package/lib/types/form.d.ts +0 -4
  38. package/lib/types/form.js +0 -2
  39. package/lib/types/index.d.ts +0 -5
  40. package/lib/types/index.js +0 -21
  41. package/lib/types/project.d.ts +0 -4
  42. package/lib/types/project.js +0 -2
  43. package/lib/types/server.d.ts +0 -102
  44. package/lib/types/server.js +0 -2
  45. package/lib/types/submission.d.ts +0 -47
  46. package/lib/types/submission.js +0 -2
@@ -1,102 +0,0 @@
1
- import { FormScope } from "./form";
2
- import { PrepScope } from "./submission";
3
- import { OfflineLicenseStruct } from '@formio/license';
4
- import { ValidationContext, ProcessTarget } from "@formio/core/types";
5
- export interface ProjectConfig {
6
- url: string;
7
- key: string;
8
- }
9
- export interface User {
10
- _id: string;
11
- data: any;
12
- roles: string[];
13
- form: string;
14
- project: string;
15
- metadata: any;
16
- }
17
- export interface AuthToken {
18
- iat?: number;
19
- exp?: number;
20
- user: User;
21
- form: {
22
- _id: string;
23
- };
24
- project: {
25
- _id: string;
26
- };
27
- }
28
- export interface AuthConfig {
29
- portal: string;
30
- secret: string;
31
- expire: number;
32
- }
33
- export interface ServerConfig {
34
- project: ProjectConfig;
35
- auth: AuthConfig;
36
- license: string;
37
- status: any;
38
- cache: boolean;
39
- maxBodySize: string;
40
- }
41
- export interface DBConfig {
42
- url: string;
43
- ttl?: number;
44
- dropOnConnect?: boolean;
45
- config: any;
46
- }
47
- export interface ServerDB {
48
- config: DBConfig;
49
- connect: (prefix?: string) => Promise<void>;
50
- saveOne: (collection: string, doc: any) => Promise<any>;
51
- save: (collection: string, doc: any) => Promise<any>;
52
- load: (collection: string, query?: any) => Promise<any>;
53
- remove: (collection: string, query?: any) => Promise<any>;
54
- index: (scope: FormScope, query: any) => Promise<any>;
55
- create: (scope: FormScope, doc: any, allowFields?: string[]) => Promise<any>;
56
- read: (scope: FormScope, id: string) => Promise<any>;
57
- update: (scope: FormScope, id: string, doc: any, allowFields?: string[]) => Promise<any>;
58
- delete: (scope: FormScope, id: string) => Promise<any>;
59
- find: (scope: FormScope, query: any) => Promise<any>;
60
- findOne: (scope: FormScope, query: any) => Promise<any>;
61
- formCollection: (scope: FormScope) => Promise<any>;
62
- addIndexes: (scope: FormScope, indexes: string[]) => Promise<any>;
63
- removeIndexes: (scope: FormScope, indexes: string[]) => Promise<any>;
64
- isUnique: (scope: FormScope, context: ValidationContext, value: any) => Promise<boolean | string>;
65
- }
66
- export interface AuthModule {
67
- token: (user: AuthToken, secret: string, expire: number) => Promise<string>;
68
- user: (token: string, secret: string) => Promise<AuthToken | null>;
69
- }
70
- export interface Preppers {
71
- save: Array<(scope: PrepScope) => Promise<any>>;
72
- read: Array<(scope: PrepScope) => Promise<any>>;
73
- }
74
- export interface Prepper {
75
- preppers: Preppers;
76
- prepare: (scope: PrepScope) => Promise<any>;
77
- }
78
- export interface ServerScope {
79
- config: ServerConfig;
80
- db: ServerDB;
81
- auth: AuthModule;
82
- actions: any;
83
- processors: ProcessTarget;
84
- prepper: Prepper;
85
- access?: any;
86
- hooks?: any;
87
- template?: any;
88
- utils?: any;
89
- util?: any;
90
- server?: any;
91
- hook?: (name: string, ...args: any[]) => void;
92
- licenseKey?: OfflineLicenseStruct;
93
- }
94
- export interface AppServerScope {
95
- config?: ServerConfig;
96
- db?: ServerDB;
97
- auth?: AuthModule;
98
- processors?: ProcessTarget;
99
- preppers?: Preppers;
100
- actions?: any;
101
- hooks?: any;
102
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,47 +0,0 @@
1
- import { Request, Response } from 'express';
2
- import { FormScope } from './form';
3
- import { ServerScope } from './server';
4
- import { ProjectScope } from './project';
5
- export interface SubmissionResponse extends Response {
6
- resource?: any;
7
- proxyRes: (res: any) => void;
8
- }
9
- export interface SubmissionScope extends FormScope {
10
- submission: any;
11
- }
12
- export interface SubmissionRequest extends Request {
13
- user: any;
14
- token: any;
15
- decoded: any;
16
- scope: any;
17
- admin: any;
18
- headers: any;
19
- serverScope: ServerScope;
20
- projectScope: ProjectScope;
21
- formScope: FormScope;
22
- submissionScope: SubmissionScope;
23
- childRequests: number;
24
- skipSave: boolean;
25
- allowProxy: boolean;
26
- dbQuery: any;
27
- }
28
- export interface ProcessScope extends SubmissionScope {
29
- component: any;
30
- row: any;
31
- value: any;
32
- data: any;
33
- req: SubmissionRequest;
34
- res: SubmissionResponse;
35
- }
36
- export interface PrepScope extends ProcessScope {
37
- type: string;
38
- path: string;
39
- current: any;
40
- }
41
- export interface Mail {
42
- to: string;
43
- from: string;
44
- subject: string;
45
- text: string;
46
- html: string;
47
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });