@friggframework/core 0.2.31-v1-alpha-package-update.0 → 1.0.1-canary.278.7b20420.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.
- package/assertions/CHANGELOG.md +87 -0
- package/assertions/LICENSE.md +9 -0
- package/assertions/README.md +3 -0
- package/assertions/bump.txt +1 -0
- package/assertions/get.js +139 -0
- package/assertions/index.js +19 -0
- package/assertions/is-equal.js +17 -0
- package/associations/LICENSE.md +9 -0
- package/associations/README.md +3 -0
- package/associations/association.js +78 -0
- package/associations/bump3.txt +0 -0
- package/associations/jest.config.js +5 -0
- package/associations/model.js +54 -0
- package/bump0.txt +1 -0
- package/core/.eslintrc.json +3 -0
- package/{Delegate.js → core/Delegate.js} +1 -1
- package/core/LICENSE.md +9 -0
- package/{Worker.js → core/Worker.js} +2 -2
- package/core/bump3.txt +0 -0
- package/{create-handler.js → core/create-handler.js} +2 -2
- package/core/index.js +6 -0
- package/core/jest.config.js +5 -0
- package/database/.eslintrc.json +3 -0
- package/database/CHANGELOG.md +97 -0
- package/database/LICENSE.md +9 -0
- package/database/README.md +3 -0
- package/database/bump3.txt +0 -0
- package/database/index.js +23 -0
- package/database/jest.config.js +5 -0
- package/database/models/IndividualUser.js +76 -0
- package/database/models/OrganizationUser.js +29 -0
- package/database/models/State.js +9 -0
- package/database/models/Token.js +70 -0
- package/database/models/UserModel.js +7 -0
- package/database/mongo.js +45 -0
- package/database/mongoose.js +5 -0
- package/encrypt/.eslintrc.json +3 -0
- package/encrypt/CHANGELOG.md +78 -0
- package/encrypt/Cryptor.js +236 -0
- package/encrypt/Cryptor.test.js +32 -0
- package/encrypt/LICENSE.md +9 -0
- package/encrypt/README.md +13 -0
- package/encrypt/aes.js +27 -0
- package/encrypt/bump3.txt +0 -0
- package/encrypt/encrypt.js +132 -0
- package/encrypt/encrypt.test.js +1069 -0
- package/encrypt/index.js +4 -0
- package/encrypt/jest.config.js +5 -0
- package/encrypt/test-encrypt.js +107 -0
- package/errors/.eslintrc.json +3 -0
- package/errors/CHANGELOG.md +44 -0
- package/errors/LICENSE.md +9 -0
- package/errors/README.md +3 -0
- package/errors/base-error.js +23 -0
- package/errors/base-error.test.js +32 -0
- package/errors/bump.txt +1 -0
- package/errors/bump3.txt +0 -0
- package/errors/fetch-error.js +76 -0
- package/errors/fetch-error.test.js +79 -0
- package/errors/halt-error.js +10 -0
- package/errors/halt-error.test.js +11 -0
- package/errors/index.js +15 -0
- package/errors/jest.config.js +5 -0
- package/errors/validation-errors.js +23 -0
- package/errors/validation-errors.test.js +120 -0
- package/index.js +123 -5
- package/integrations/.eslintrc.json +3 -0
- package/integrations/CHANGELOG.md +244 -0
- package/integrations/LICENSE.md +9 -0
- package/integrations/README.md +3 -0
- package/integrations/bump3.txt +0 -0
- package/integrations/create-frigg-backend.js +31 -0
- package/integrations/index.js +19 -0
- package/integrations/integration-base.js +162 -0
- package/integrations/integration-factory.js +166 -0
- package/integrations/integration-mapping.js +43 -0
- package/integrations/integration-model.js +42 -0
- package/integrations/integration-router.js +367 -0
- package/integrations/integration-user.js +144 -0
- package/integrations/jest-setup.js +2 -0
- package/integrations/jest-teardown.js +2 -0
- package/integrations/jest.config.js +12 -0
- package/integrations/options.js +54 -0
- package/integrations/test/integration-base.test.js +143 -0
- package/lambda/README.md +3 -0
- package/lambda/TimeoutCatcher.js +43 -0
- package/lambda/TimeoutCatcher.test.js +68 -0
- package/lambda/bump3.txt +0 -0
- package/lambda/index.js +3 -0
- package/lambda/jest.config.js +3 -0
- package/logs/.eslintrc.json +3 -0
- package/logs/CHANGELOG.md +57 -0
- package/logs/LICENSE.md +9 -0
- package/logs/README.md +3 -0
- package/logs/bump3.txt +0 -0
- package/logs/index.js +7 -0
- package/logs/jest.config.js +5 -0
- package/logs/logger.js +69 -0
- package/logs/logger.test.js +76 -0
- package/module-plugin/.eslintrc.json +3 -0
- package/module-plugin/CHANGELOG.md +224 -0
- package/module-plugin/LICENSE.md +9 -0
- package/module-plugin/ModuleConstants.js +10 -0
- package/module-plugin/README.md +3 -0
- package/module-plugin/auther.js +342 -0
- package/module-plugin/bump3.txt +0 -0
- package/module-plugin/credential.js +22 -0
- package/module-plugin/entity-manager.js +70 -0
- package/module-plugin/entity.js +46 -0
- package/module-plugin/index.js +25 -0
- package/module-plugin/jest-setup.js +3 -0
- package/module-plugin/jest-teardown.js +2 -0
- package/module-plugin/jest.config.js +20 -0
- package/module-plugin/manager.js +169 -0
- package/module-plugin/module-factory.js +60 -0
- package/module-plugin/requester/api-key.js +36 -0
- package/module-plugin/requester/basic.js +43 -0
- package/module-plugin/requester/oauth-2.js +219 -0
- package/module-plugin/requester/requester.js +151 -0
- package/module-plugin/requester/requester.test.js +28 -0
- package/module-plugin/test/auther.test.js +97 -0
- package/module-plugin/test/mock-api/api.js +29 -0
- package/module-plugin/test/mock-api/definition.js +48 -0
- package/module-plugin/test/mock-api/mocks/hubspot.js +43 -0
- package/package.json +28 -12
- package/syncs/README.md +3 -0
- package/syncs/bump3.txt +0 -0
- package/syncs/jest.config.js +5 -0
- package/syncs/manager.js +464 -0
- package/syncs/model.js +62 -0
- package/syncs/sync.js +114 -0
- package/types/CHANGELOG.md +49 -0
- package/types/README.md +24 -0
- package/types/assertions/index.d.ts +83 -0
- package/types/associations/index.d.ts +74 -0
- package/types/bump3.txt +0 -0
- package/types/core/index.d.ts +54 -0
- package/types/database/index.d.ts +3 -0
- package/types/encrypt/index.d.ts +5 -0
- package/types/errors/index.d.ts +66 -0
- package/types/eslint-config/index.d.ts +41 -0
- package/types/index.d.ts +14 -0
- package/types/integrations/index.d.ts +191 -0
- package/types/lambda/index.d.ts +31 -0
- package/types/logs/index.d.ts +5 -0
- package/types/module-plugin/index.d.ts +293 -0
- package/types/prettier-config/index.d.ts +6 -0
- package/types/syncs/index.d.ts +128 -0
- package/types/test-environment/index.d.ts +17 -0
- package/types/tsconfig.json +103 -0
- /package/{.eslintrc.json → assertions/.eslintrc.json} +0 -0
- /package/{bump3.txt → assertions/bump3.txt} +0 -0
- /package/{jest.config.js → assertions/jest.config.js} +0 -0
- /package/{CHANGELOG.md → core/CHANGELOG.md} +0 -0
- /package/{README.md → core/README.md} +0 -0
- /package/{load-installed-modules.js → core/load-installed-modules.js} +0 -0
package/index.js
CHANGED
|
@@ -1,6 +1,124 @@
|
|
|
1
|
-
const {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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');
|
|
5
60
|
|
|
6
|
-
|
|
61
|
+
// const {Sync } = require('./syncs/model');
|
|
62
|
+
|
|
63
|
+
module.exports = {
|
|
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
|
|
124
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# v1.2.0 (Wed Sep 06 2023)
|
|
2
|
+
|
|
3
|
+
#### 🚀 Enhancement
|
|
4
|
+
|
|
5
|
+
- Slack lookup by externalId, remove the user requirement from Mongoose DB models [#218](https://github.com/friggframework/frigg/pull/218) ([@seanspeaks](https://github.com/seanspeaks))
|
|
6
|
+
|
|
7
|
+
#### 🐛 Bug Fix
|
|
8
|
+
|
|
9
|
+
- Looking good ([@seanspeaks](https://github.com/seanspeaks))
|
|
10
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
11
|
+
|
|
12
|
+
#### Authors: 1
|
|
13
|
+
|
|
14
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# v1.1.4 (Thu Aug 03 2023)
|
|
19
|
+
|
|
20
|
+
#### 🐛 Bug Fix
|
|
21
|
+
|
|
22
|
+
- remove check in Options [#206](https://github.com/friggframework/frigg/pull/206) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
|
|
23
|
+
- remove check in Options ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
|
|
24
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
25
|
+
|
|
26
|
+
#### Authors: 2
|
|
27
|
+
|
|
28
|
+
- [@MichaelRyanWebber](https://github.com/MichaelRyanWebber)
|
|
29
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
# v1.1.3 (Thu Jun 15 2023)
|
|
34
|
+
|
|
35
|
+
#### 🐛 Bug Fix
|
|
36
|
+
|
|
37
|
+
- return the mapping object directly from getIntegrationMapping [#157](https://github.com/friggframework/frigg/pull/157) ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
|
|
38
|
+
- potential change to return the mapping object directly from getIntegrationMapping. this is only to provide for cleaner assignment of the mapping when getIntegrationMapping is used. ([@MichaelRyanWebber](https://github.com/MichaelRyanWebber))
|
|
39
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
40
|
+
|
|
41
|
+
#### Authors: 2
|
|
42
|
+
|
|
43
|
+
- [@MichaelRyanWebber](https://github.com/MichaelRyanWebber)
|
|
44
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
# v1.1.2 (Thu Jun 08 2023)
|
|
49
|
+
|
|
50
|
+
#### 🐛 Bug Fix
|
|
51
|
+
|
|
52
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
53
|
+
|
|
54
|
+
#### Authors: 1
|
|
55
|
+
|
|
56
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
# v1.1.1 (Thu May 25 2023)
|
|
61
|
+
|
|
62
|
+
#### 🐛 Bug Fix
|
|
63
|
+
|
|
64
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
65
|
+
|
|
66
|
+
#### Authors: 1
|
|
67
|
+
|
|
68
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
# v1.1.0 (Wed Apr 26 2023)
|
|
73
|
+
|
|
74
|
+
#### 🚀 Enhancement
|
|
75
|
+
|
|
76
|
+
- Add refreshIntegration method for config retrieval inside the integra… [#151](https://github.com/friggframework/frigg/pull/151) ([@seanspeaks](https://github.com/seanspeaks))
|
|
77
|
+
|
|
78
|
+
#### 🐛 Bug Fix
|
|
79
|
+
|
|
80
|
+
- Add refreshIntegration method for config retrieval inside the integrationManager ([@seanspeaks](https://github.com/seanspeaks))
|
|
81
|
+
|
|
82
|
+
#### Authors: 1
|
|
83
|
+
|
|
84
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
# v1.0.24 (Thu Apr 13 2023)
|
|
89
|
+
|
|
90
|
+
#### 🐛 Bug Fix
|
|
91
|
+
|
|
92
|
+
- Fix Slack getChannelHistory call [#147](https://github.com/friggframework/frigg/pull/147) ([@debbie-yu](https://github.com/debbie-yu))
|
|
93
|
+
- Merge branch 'main' of https://github.com/friggframework/frigg into debbie.yu/fix-slack-history [#145](https://github.com/friggframework/frigg/pull/145) ([@debbie-yu](https://github.com/debbie-yu))
|
|
94
|
+
- improve error thrown for invalid integration ([@debbie-yu](https://github.com/debbie-yu))
|
|
95
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
96
|
+
|
|
97
|
+
#### Authors: 2
|
|
98
|
+
|
|
99
|
+
- [@debbie-yu](https://github.com/debbie-yu)
|
|
100
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
# v1.0.23 (Tue Apr 04 2023)
|
|
105
|
+
|
|
106
|
+
:tada: This release contains work from a new contributor! :tada:
|
|
107
|
+
|
|
108
|
+
Thank you, null[@debbie-yu](https://github.com/debbie-yu), for all your work!
|
|
109
|
+
|
|
110
|
+
#### 🐛 Bug Fix
|
|
111
|
+
|
|
112
|
+
- Adding new IntegrationMapping collection [#142](https://github.com/friggframework/frigg/pull/142) ([@debbie-yu](https://github.com/debbie-yu))
|
|
113
|
+
- Merge branch 'main' of https://github.com/friggframework/frigg into debbie.yu/integration-mapping ([@debbie-yu](https://github.com/debbie-yu))
|
|
114
|
+
- addressing PR feedback and adding unit tests around IntegrationMapping ([@debbie-yu](https://github.com/debbie-yu))
|
|
115
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
116
|
+
|
|
117
|
+
#### Authors: 2
|
|
118
|
+
|
|
119
|
+
- [@debbie-yu](https://github.com/debbie-yu)
|
|
120
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
# v1.0.22 (Tue Feb 21 2023)
|
|
125
|
+
|
|
126
|
+
#### 🐛 Bug Fix
|
|
127
|
+
|
|
128
|
+
- Merge branch 'main' into hubspot-updates ([@seanspeaks](https://github.com/seanspeaks))
|
|
129
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
130
|
+
|
|
131
|
+
#### Authors: 1
|
|
132
|
+
|
|
133
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
# v1.0.20 (Tue Jan 31 2023)
|
|
138
|
+
|
|
139
|
+
#### 🐛 Bug Fix
|
|
140
|
+
|
|
141
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
142
|
+
|
|
143
|
+
#### Authors: 1
|
|
144
|
+
|
|
145
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
# v1.0.18 (Thu Jan 12 2023)
|
|
150
|
+
|
|
151
|
+
#### 🐛 Bug Fix
|
|
152
|
+
|
|
153
|
+
- Slack, Ironclad, and "IntegrationManager" updates [#92](https://github.com/friggframework/frigg/pull/92) ([@seanspeaks](https://github.com/seanspeaks))
|
|
154
|
+
- Fix the output from entity hydration on the getFormattedIntegration method ([@seanspeaks](https://github.com/seanspeaks))
|
|
155
|
+
|
|
156
|
+
#### Authors: 1
|
|
157
|
+
|
|
158
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
# v1.0.17 (Wed Jan 11 2023)
|
|
163
|
+
|
|
164
|
+
#### 🐛 Bug Fix
|
|
165
|
+
|
|
166
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
167
|
+
|
|
168
|
+
#### Authors: 1
|
|
169
|
+
|
|
170
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
# v1.0.16 (Tue Jan 10 2023)
|
|
175
|
+
|
|
176
|
+
:tada: This release contains work from a new contributor! :tada:
|
|
177
|
+
|
|
178
|
+
Thank you, Jonathan O'Donnell ([@joncodo](https://github.com/joncodo)), for all your work!
|
|
179
|
+
|
|
180
|
+
#### 🐛 Bug Fix
|
|
181
|
+
|
|
182
|
+
- Merge branch 'main' of github.com:friggframework/frigg into doc-updates ([@joncodo](https://github.com/joncodo))
|
|
183
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
184
|
+
|
|
185
|
+
#### Authors: 2
|
|
186
|
+
|
|
187
|
+
- Jonathan O'Donnell ([@joncodo](https://github.com/joncodo))
|
|
188
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
# v1.0.15 (Mon Jan 09 2023)
|
|
193
|
+
|
|
194
|
+
#### 🐛 Bug Fix
|
|
195
|
+
|
|
196
|
+
- Merge remote-tracking branch 'origin/main' into gitbook-updates [#48](https://github.com/friggframework/frigg/pull/48) ([@seanspeaks](https://github.com/seanspeaks))
|
|
197
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
198
|
+
- Updates to managers [#24](https://github.com/friggframework/frigg/pull/24) ([@seanspeaks](https://github.com/seanspeaks))
|
|
199
|
+
- integrations bump ([@seanspeaks](https://github.com/seanspeaks))
|
|
200
|
+
- Update integrationManager createIntegration function to accept EntityManager param (WIP) (Could be improved) ([@seanspeaks](https://github.com/seanspeaks))
|
|
201
|
+
- Bumped versions with patches ([@seanspeaks](https://github.com/seanspeaks))
|
|
202
|
+
- A lot of changes all rolled into one [#21](https://github.com/friggframework/frigg/pull/21) ([@seanspeaks](https://github.com/seanspeaks))
|
|
203
|
+
- Update integrations (Options) to include module reference/argument ([@seanspeaks](https://github.com/seanspeaks))
|
|
204
|
+
- Weird class, probably needs cleanup ([@seanspeaks](https://github.com/seanspeaks))
|
|
205
|
+
- Mongoose models tweak for sls offline as per https://nesin.io/blog/fix-mongoose-cannot-overwrite-model-once-compiled-error ([@seanspeaks](https://github.com/seanspeaks))
|
|
206
|
+
- Continued updating of references and refactoring API modules ([@seanspeaks](https://github.com/seanspeaks))
|
|
207
|
+
- Merge remote-tracking branch 'origin/main' into simplify-mongoose-models ([@seanspeaks](https://github.com/seanspeaks))
|
|
208
|
+
- Add READMEs for all packages and api-modules [#20](https://github.com/friggframework/frigg/pull/20) ([@seanspeaks](https://github.com/seanspeaks))
|
|
209
|
+
- Add READMEs for all packages and api-modules ([@seanspeaks](https://github.com/seanspeaks))
|
|
210
|
+
|
|
211
|
+
#### ⚠️ Pushed to `main`
|
|
212
|
+
|
|
213
|
+
- Merge branch 'main' into gitbook-updates ([@seanspeaks](https://github.com/seanspeaks))
|
|
214
|
+
- Refactored for more conventional naming (at least for packages) ([@seanspeaks](https://github.com/seanspeaks))
|
|
215
|
+
|
|
216
|
+
#### Authors: 1
|
|
217
|
+
|
|
218
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
# v1.0.12 (Tue Dec 06 2022)
|
|
223
|
+
|
|
224
|
+
#### 🐛 Bug Fix
|
|
225
|
+
|
|
226
|
+
- fix modules to @friggframework [#74](https://github.com/friggframework/frigg/pull/74) ([@sheehantoufiq](https://github.com/sheehantoufiq))
|
|
227
|
+
- Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
|
|
228
|
+
|
|
229
|
+
#### Authors: 2
|
|
230
|
+
|
|
231
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
232
|
+
- Sheehan Toufiq Khan ([@sheehantoufiq](https://github.com/sheehantoufiq))
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
# v1.0.9 (Mon Sep 19 2022)
|
|
237
|
+
|
|
238
|
+
#### 🐛 Bug Fix
|
|
239
|
+
|
|
240
|
+
- Merge remote-tracking branch 'origin/main' into gitbook-updates [#48](https://github.com/friggframework/frigg/pull/48) ([@seanspeaks](https://github.com/seanspeaks))
|
|
241
|
+
|
|
242
|
+
#### Authors: 1
|
|
243
|
+
|
|
244
|
+
- Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Left Hook Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const {IntegrationFactory, IntegrationHelper} = require('./integration-factory');
|
|
2
|
+
const User = require('./integration-user');
|
|
3
|
+
|
|
4
|
+
function createFriggBackend(appDefinition) {
|
|
5
|
+
const {integrations = [], user=null} = appDefinition
|
|
6
|
+
const integrationFactory = new IntegrationFactory(integrations);
|
|
7
|
+
if (user) {
|
|
8
|
+
if (user.usePassword) {
|
|
9
|
+
User.usePassword = true;
|
|
10
|
+
}
|
|
11
|
+
if (user.primary === 'organization') {
|
|
12
|
+
User.primary = User.OrganizationUser
|
|
13
|
+
}
|
|
14
|
+
if (user.individualUserRequired !== undefined) {
|
|
15
|
+
User.individualUserRequired = user.individualUserRequired
|
|
16
|
+
}
|
|
17
|
+
if (user.organizationUserRequired !== undefined) {
|
|
18
|
+
User.organizationUserRequired = user.organizationUserRequired
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
const backend = {
|
|
23
|
+
integrationFactory,
|
|
24
|
+
moduleFactory: integrationFactory.moduleFactory,
|
|
25
|
+
IntegrationHelper,
|
|
26
|
+
User: User
|
|
27
|
+
}
|
|
28
|
+
return backend
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
module.exports = { createFriggBackend }
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { IntegrationBase } = require('./integration-base');
|
|
2
|
+
const { IntegrationModel } = require('./integration-model');
|
|
3
|
+
const { Options } = require('./options');
|
|
4
|
+
const { IntegrationMapping } = require('./integration-mapping');
|
|
5
|
+
const { IntegrationFactory, IntegrationHelper } = require('./integration-factory');
|
|
6
|
+
const { createIntegrationRouter, checkRequiredParams } = require('./integration-router');
|
|
7
|
+
const { createFriggBackend } = require('./create-frigg-backend');
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
IntegrationBase,
|
|
11
|
+
IntegrationModel,
|
|
12
|
+
Options,
|
|
13
|
+
IntegrationMapping,
|
|
14
|
+
IntegrationFactory,
|
|
15
|
+
IntegrationHelper,
|
|
16
|
+
createIntegrationRouter,
|
|
17
|
+
checkRequiredParams,
|
|
18
|
+
createFriggBackend
|
|
19
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
const { IntegrationMapping } = require('./integration-mapping');
|
|
2
|
+
|
|
3
|
+
class IntegrationBase {
|
|
4
|
+
/**
|
|
5
|
+
* CHILDREN SHOULD SPECIFY A CONFIG
|
|
6
|
+
*/
|
|
7
|
+
static Config = {
|
|
8
|
+
name: 'Integration Name',
|
|
9
|
+
version: '0.0.0', // Integration Version, used for migration and storage purposes, as well as display
|
|
10
|
+
supportedVersions: [], // Eventually usable for deprecation and future test version purposes
|
|
11
|
+
|
|
12
|
+
// an array of events that are process(able) by this Integration
|
|
13
|
+
events: [],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
static getName() {
|
|
17
|
+
return this.Config.name;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static getCurrentVersion() {
|
|
21
|
+
return this.Config.version;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
constructor(params) {
|
|
25
|
+
this.delegateTypes = [];
|
|
26
|
+
this.userActions = [];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//psuedo delegate for backwards compatability
|
|
30
|
+
async receiveNotification(notifier, delegateString, object = null) {
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
async notify(delegateString, object = null) {
|
|
35
|
+
if (!this.delegateTypes.includes(delegateString)) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`delegateString:${delegateString} is not defined in delegateTypes`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return this.receiveNotification(
|
|
41
|
+
this,
|
|
42
|
+
delegateString,
|
|
43
|
+
object
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async validateConfig() {
|
|
48
|
+
const configOptions = await this.getConfigOptions();
|
|
49
|
+
const currentConfig = this.record.config;
|
|
50
|
+
let needsConfig = false;
|
|
51
|
+
for (const option of configOptions) {
|
|
52
|
+
if (option.required) {
|
|
53
|
+
// For now, just make sure the key exists. We should add more dynamic/better validation later.
|
|
54
|
+
if (
|
|
55
|
+
!Object.prototype.hasOwnProperty.call(
|
|
56
|
+
currentConfig,
|
|
57
|
+
option.key
|
|
58
|
+
)
|
|
59
|
+
) {
|
|
60
|
+
needsConfig = true;
|
|
61
|
+
this.record.messages.warnings.push({
|
|
62
|
+
title: 'Config Validation Error',
|
|
63
|
+
message: `Missing required field of ${option.label}`,
|
|
64
|
+
timestamp: Date.now(),
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (needsConfig) {
|
|
70
|
+
this.record.status = 'NEEDS_CONFIG';
|
|
71
|
+
await this.record.save();
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async testAuth() {
|
|
76
|
+
let didAuthPass = true;
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
await this.primary.testAuth();
|
|
80
|
+
} catch {
|
|
81
|
+
didAuthPass = false;
|
|
82
|
+
this.record.messages.errors.push({
|
|
83
|
+
title: 'Authentication Error',
|
|
84
|
+
message: `There was an error with your ${this.primary.constructor.getName()} Entity.
|
|
85
|
+
Please reconnect/re-authenticate, or reach out to Support for assistance.`,
|
|
86
|
+
timestamp: Date.now(),
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
await this.target.testAuth();
|
|
92
|
+
} catch {
|
|
93
|
+
didAuthPass = false;
|
|
94
|
+
this.record.messages.errors.push({
|
|
95
|
+
title: 'Authentication Error',
|
|
96
|
+
message: `There was an error with your ${this.target.constructor.getName()} Entity.
|
|
97
|
+
Please reconnect/re-authenticate, or reach out to Support for assistance.`,
|
|
98
|
+
timestamp: Date.now(),
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!didAuthPass) {
|
|
103
|
+
this.record.status = 'ERROR';
|
|
104
|
+
this.record.markModified('messages.error');
|
|
105
|
+
await this.record.save();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async getMapping(sourceId) {
|
|
110
|
+
return IntegrationMapping.findBy(this.record.id, sourceId);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async upsertMapping(sourceId, mapping) {
|
|
114
|
+
if (!sourceId) {
|
|
115
|
+
throw new Error(`sourceId must be set`);
|
|
116
|
+
}
|
|
117
|
+
return await IntegrationMapping.upsert(
|
|
118
|
+
this.record.id,
|
|
119
|
+
sourceId,
|
|
120
|
+
mapping
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
async getAndSetUserActions() {
|
|
125
|
+
this.userActions = await this.getUserActions();
|
|
126
|
+
if (this.record?.config) {
|
|
127
|
+
this.record.config.userActions = this.userActions;
|
|
128
|
+
await this.record.save();
|
|
129
|
+
}
|
|
130
|
+
return this.userActions;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* CHILDREN CAN OVERRIDE THESE CONFIGURATION METHODS
|
|
137
|
+
*/
|
|
138
|
+
async onCreate(params) {
|
|
139
|
+
this.record.status = 'ENABLED';
|
|
140
|
+
await this.record.save();
|
|
141
|
+
return this.record;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async onUpdate(params) {
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async onDelete(params) { }
|
|
148
|
+
|
|
149
|
+
async getConfigOptions() {
|
|
150
|
+
const options = {
|
|
151
|
+
jsonSchema: {},
|
|
152
|
+
uiSchema: {},
|
|
153
|
+
};
|
|
154
|
+
return options;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async getUserActions() {
|
|
158
|
+
return [];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
module.exports = { IntegrationBase };
|