@friggframework/core 1.0.1-v1-alpha.2 → 1.0.1-v1-alpha.4

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/database/index.js CHANGED
@@ -1,14 +1,20 @@
1
- const mongo = require('./mongo');
2
- const { mongoose } = require('./mongoose');
3
- const { IndividualUser } = require('./models/IndividualUser');
4
- const { OrganizationUser } = require('./models/OrganizationUser');
5
- const { State } = require('./models/State');
6
- const { Token } = require('./models/Token');
7
- const { UserModel } = require('./models/UserModel');
1
+ const { mongoose} = require('./mongoose');
2
+ const {
3
+ connectToDatabase,
4
+ disconnectFromDatabase,
5
+ createObjectId,
6
+ } = require('./mongo');
7
+ const {IndividualUser} = require('./models/IndividualUser');
8
+ const {OrganizationUser} = require('./models/OrganizationUser');
9
+ const {State} = require('./models/State');
10
+ const {Token} = require('./models/Token');
11
+ const {UserModel} = require('./models/UserModel');
8
12
 
9
13
  module.exports = {
10
- ...mongo,
11
14
  mongoose,
15
+ connectToDatabase,
16
+ disconnectFromDatabase,
17
+ createObjectId,
12
18
  IndividualUser,
13
19
  OrganizationUser,
14
20
  State,
@@ -15,12 +15,14 @@ const findOneEvents = [
15
15
  ];
16
16
 
17
17
  const shouldBypassEncryption = (STAGE) => {
18
- if (!process.env.BYPASS_ENCRYPTION_STAGE) {
19
- return false;
20
- }
21
-
22
- const bypassStages = process.env.BYPASS_ENCRYPTION_STAGE.split(',').map((stage) => stage.trim());
23
- return bypassStages.indexOf(STAGE) > -1;
18
+ const defaultBypassStages = ['dev', 'test', 'local'];
19
+ const bypassStageEnv = process.env.BYPASS_ENCRYPTION_STAGE;
20
+ // If the env is set to anything or an empty string, use the env. Otherwise, use the default array
21
+ const useEnv = !String(bypassStageEnv) || !!bypassStageEnv;
22
+ const bypassStages = useEnv
23
+ ? bypassStageEnv.split(',').map((stage) => stage.trim())
24
+ : defaultBypassStages;
25
+ return bypassStages.includes(STAGE);
24
26
  };
25
27
 
26
28
  // The Mongoose plug-in function
package/encrypt/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  const { Encrypt } = require('./encrypt');
2
+ const { Cryptor } = require('./Cryptor');
2
3
 
3
- module.exports = { Encrypt };
4
+ module.exports = { Encrypt, Cryptor };
package/index.js CHANGED
@@ -1,24 +1,124 @@
1
-
2
- const core = require('./core/index');
3
- const database = require('./database/index');
4
- const assertions = require('./assertions/index');
5
- const integrations = require('./integrations/index');
6
- const errors = require('./errors/index');
7
- const encrypt = require('./encrypt/encrypt');
8
- const lambda = require('./lambda/index');
9
- const logs = require('./logs/index');
10
- const modulePlugin = require('./module-plugin/index');
1
+ const {
2
+ expectShallowEqualDbObject,
3
+ get,
4
+ getAll,
5
+ verifyType,
6
+ getParamAndVerifyParamType,
7
+ getArrayParamAndVerifyParamType,
8
+ getAndVerifyType,
9
+ } = require('./assertions/index');
10
+ const { Delegate, Worker, loadInstalledModules, createHandler } = require('./core/index');
11
+ const {
12
+ mongoose,
13
+ connectToDatabase,
14
+ disconnectFromDatabase,
15
+ createObjectId,
16
+ IndividualUser,
17
+ OrganizationUser,
18
+ State,
19
+ Token,
20
+ UserModel
21
+ } = require('./database/index');
22
+ const { Encrypt, Cryptor } = require('./encrypt/encrypt');
23
+ const {
24
+ BaseError,
25
+ FetchError,
26
+ HaltError,
27
+ RequiredPropertyError,
28
+ ParameterTypeError,
29
+ } = require('./errors/index');
30
+ const {
31
+ IntegrationBase,
32
+ IntegrationModel,
33
+ Options,
34
+ IntegrationMapping,
35
+ IntegrationFactory,
36
+ IntegrationHelper,
37
+ createIntegrationRouter,
38
+ checkRequiredParams,
39
+ createFriggBackend
40
+ } = require('./integrations/index');
41
+ const { TimeoutCatcher } = require('./lambda/index');
42
+ const {
43
+ debug,
44
+ initDebugLog,
45
+ flushDebugLog
46
+ } = require('./logs/index');
47
+ const {
48
+ Credential,
49
+ EntityManager,
50
+ Entity,
51
+ ModuleManager,
52
+ ApiKeyRequester,
53
+ BasicAuthRequester,
54
+ OAuth2Requester,
55
+ Requester,
56
+ ModuleConstants,
57
+ ModuleFactory,
58
+ Auther
59
+ } = require('./module-plugin/index');
11
60
 
12
61
  // const {Sync } = require('./syncs/model');
13
62
 
14
63
  module.exports = {
15
- ...core,
16
- ...database,
17
- ...assertions,
18
- ...integrations,
19
- ...errors,
20
- ...encrypt,
21
- ...lambda,
22
- ...logs,
23
- ...modulePlugin,
64
+ // assertions
65
+ expectShallowEqualDbObject,
66
+ get,
67
+ getAll,
68
+ verifyType,
69
+ getParamAndVerifyParamType,
70
+ getArrayParamAndVerifyParamType,
71
+ getAndVerifyType,
72
+ // core
73
+ Delegate,
74
+ Worker,
75
+ loadInstalledModules,
76
+ createHandler,
77
+ // database
78
+ mongoose,
79
+ connectToDatabase,
80
+ disconnectFromDatabase,
81
+ createObjectId,
82
+ IndividualUser,
83
+ OrganizationUser,
84
+ State,
85
+ Token,
86
+ UserModel,
87
+ // encrypt
88
+ Encrypt,
89
+ Cryptor,
90
+ // errors
91
+ BaseError,
92
+ FetchError,
93
+ HaltError,
94
+ RequiredPropertyError,
95
+ ParameterTypeError,
96
+ // integrations
97
+ IntegrationBase,
98
+ IntegrationModel,
99
+ Options,
100
+ IntegrationMapping,
101
+ IntegrationFactory,
102
+ IntegrationHelper,
103
+ checkRequiredParams,
104
+ createIntegrationRouter,
105
+ createFriggBackend,
106
+ // lambda
107
+ TimeoutCatcher,
108
+ // logs
109
+ debug,
110
+ initDebugLog,
111
+ flushDebugLog,
112
+ // module plugin
113
+ Credential,
114
+ EntityManager,
115
+ Entity,
116
+ ModuleManager,
117
+ ApiKeyRequester,
118
+ BasicAuthRequester,
119
+ OAuth2Requester,
120
+ Requester,
121
+ ModuleConstants,
122
+ ModuleFactory,
123
+ Auther
24
124
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "1.0.1-v1-alpha.2",
4
+ "version": "1.0.1-v1-alpha.4",
5
5
  "dependencies": {
6
6
  "@hapi/boom": "^10.0.1",
7
7
  "aws-sdk": "^2.1200.0",
@@ -15,7 +15,7 @@
15
15
  "node-fetch": "^2.6.7"
16
16
  },
17
17
  "devDependencies": {
18
- "@friggframework/devtools": "1.0.1-v1-alpha.2",
18
+ "@friggframework/devtools": "1.0.1-v1-alpha.4",
19
19
  "@types/lodash": "^4.14.191",
20
20
  "@typescript-eslint/eslint-plugin": "^5.55.0",
21
21
  "chai": "^4.3.6",
@@ -47,5 +47,5 @@
47
47
  },
48
48
  "homepage": "https://github.com/friggframework/frigg#readme",
49
49
  "description": "",
50
- "gitHead": "be81c23e498aa754340786c3e81c23880360ec71"
50
+ "gitHead": "5953d80c28f25a142b1252a20119128c243e4217"
51
51
  }