@friggframework/core 0.2.31-v1-alpha-package-update.0 → 1.0.1-v1-alpha-package-update.1

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 (193) hide show
  1. package/assertions/CHANGELOG.md +87 -0
  2. package/assertions/LICENSE.md +9 -0
  3. package/assertions/README.md +3 -0
  4. package/assertions/bump.txt +1 -0
  5. package/assertions/get.js +139 -0
  6. package/assertions/index.js +19 -0
  7. package/assertions/is-equal.js +17 -0
  8. package/associations/LICENSE.md +9 -0
  9. package/associations/README.md +3 -0
  10. package/associations/association.js +78 -0
  11. package/associations/bump3.txt +0 -0
  12. package/associations/jest.config.js +5 -0
  13. package/associations/model.js +54 -0
  14. package/bump.txt +1 -0
  15. package/core/.eslintrc.json +3 -0
  16. package/{Delegate.js → core/Delegate.js} +1 -1
  17. package/core/LICENSE.md +9 -0
  18. package/{Worker.js → core/Worker.js} +2 -2
  19. package/core/bump3.txt +0 -0
  20. package/{create-handler.js → core/create-handler.js} +2 -2
  21. package/core/index.js +6 -0
  22. package/core/jest.config.js +5 -0
  23. package/database/.eslintrc.json +3 -0
  24. package/database/CHANGELOG.md +97 -0
  25. package/database/LICENSE.md +9 -0
  26. package/database/README.md +3 -0
  27. package/database/bump3.txt +0 -0
  28. package/database/index.js +17 -0
  29. package/database/jest.config.js +5 -0
  30. package/database/models/IndividualUser.js +76 -0
  31. package/database/models/OrganizationUser.js +29 -0
  32. package/database/models/State.js +9 -0
  33. package/database/models/Token.js +70 -0
  34. package/database/models/UserModel.js +7 -0
  35. package/database/mongo.js +45 -0
  36. package/database/mongoose.js +5 -0
  37. package/encrypt/.eslintrc.json +3 -0
  38. package/encrypt/CHANGELOG.md +65 -0
  39. package/encrypt/Cryptor.js +236 -0
  40. package/encrypt/Cryptor.test.js +32 -0
  41. package/encrypt/LICENSE.md +9 -0
  42. package/encrypt/README.md +3 -0
  43. package/encrypt/aes.js +27 -0
  44. package/encrypt/bump3.txt +0 -0
  45. package/encrypt/encrypt.js +124 -0
  46. package/encrypt/encrypt.test.js +1068 -0
  47. package/encrypt/index.js +3 -0
  48. package/encrypt/jest.config.js +5 -0
  49. package/encrypt/test-encrypt.js +107 -0
  50. package/errors/.eslintrc.json +3 -0
  51. package/errors/CHANGELOG.md +44 -0
  52. package/errors/LICENSE.md +9 -0
  53. package/errors/README.md +3 -0
  54. package/errors/base-error.js +23 -0
  55. package/errors/base-error.test.js +32 -0
  56. package/errors/bump.txt +1 -0
  57. package/errors/bump3.txt +0 -0
  58. package/errors/fetch-error.js +72 -0
  59. package/errors/fetch-error.test.js +79 -0
  60. package/errors/halt-error.js +10 -0
  61. package/errors/halt-error.test.js +11 -0
  62. package/errors/index.js +15 -0
  63. package/errors/jest.config.js +5 -0
  64. package/errors/validation-errors.js +23 -0
  65. package/errors/validation-errors.test.js +120 -0
  66. package/eslint-config/.eslintrc.json +3 -0
  67. package/eslint-config/CHANGELOG.md +17 -0
  68. package/eslint-config/LICENSE.md +9 -0
  69. package/eslint-config/README.md +3 -0
  70. package/eslint-config/bump3.txt +0 -0
  71. package/eslint-config/index.js +38 -0
  72. package/index.js +29 -5
  73. package/integrations/.eslintrc.json +3 -0
  74. package/integrations/CHANGELOG.md +244 -0
  75. package/integrations/LICENSE.md +9 -0
  76. package/integrations/README.md +3 -0
  77. package/integrations/bump3.txt +0 -0
  78. package/integrations/create-frigg-backend.js +31 -0
  79. package/integrations/index.js +19 -0
  80. package/integrations/integration-base.js +162 -0
  81. package/integrations/integration-factory.js +166 -0
  82. package/integrations/integration-mapping.js +43 -0
  83. package/integrations/integration-model.js +42 -0
  84. package/integrations/integration-router.js +367 -0
  85. package/integrations/integration-user.js +144 -0
  86. package/integrations/jest-setup.js +2 -0
  87. package/integrations/jest-teardown.js +2 -0
  88. package/integrations/jest.config.js +12 -0
  89. package/integrations/options.js +54 -0
  90. package/integrations/test/integration-base.test.js +143 -0
  91. package/lambda/README.md +3 -0
  92. package/lambda/TimeoutCatcher.js +43 -0
  93. package/lambda/TimeoutCatcher.test.js +68 -0
  94. package/lambda/bump3.txt +0 -0
  95. package/lambda/index.js +3 -0
  96. package/lambda/jest.config.js +3 -0
  97. package/logs/.eslintrc.json +3 -0
  98. package/logs/CHANGELOG.md +57 -0
  99. package/logs/LICENSE.md +9 -0
  100. package/logs/README.md +3 -0
  101. package/logs/bump3.txt +0 -0
  102. package/logs/index.js +7 -0
  103. package/logs/jest.config.js +5 -0
  104. package/logs/logger.js +69 -0
  105. package/logs/logger.test.js +76 -0
  106. package/migrations/README.md +3 -0
  107. package/migrations/bump3.txt +0 -0
  108. package/migrations/index.js +9 -0
  109. package/migrations/jest.config.js +3 -0
  110. package/migrations/manager.js +33 -0
  111. package/migrations/migrator.js +170 -0
  112. package/migrations/options.js +28 -0
  113. package/module-plugin/.eslintrc.json +3 -0
  114. package/module-plugin/CHANGELOG.md +224 -0
  115. package/module-plugin/LICENSE.md +9 -0
  116. package/module-plugin/ModuleConstants.js +10 -0
  117. package/module-plugin/README.md +3 -0
  118. package/module-plugin/auther.js +342 -0
  119. package/module-plugin/bump3.txt +0 -0
  120. package/module-plugin/credential.js +22 -0
  121. package/module-plugin/entity-manager.js +70 -0
  122. package/module-plugin/entity.js +46 -0
  123. package/module-plugin/index.js +25 -0
  124. package/module-plugin/jest-setup.js +3 -0
  125. package/module-plugin/jest-teardown.js +2 -0
  126. package/module-plugin/jest.config.js +20 -0
  127. package/module-plugin/manager.js +169 -0
  128. package/module-plugin/module-factory.js +60 -0
  129. package/module-plugin/requester/api-key.js +36 -0
  130. package/module-plugin/requester/basic.js +43 -0
  131. package/module-plugin/requester/oauth-2.js +219 -0
  132. package/module-plugin/requester/requester.js +150 -0
  133. package/module-plugin/requester/requester.test.js +28 -0
  134. package/module-plugin/test/auther.test.js +97 -0
  135. package/module-plugin/test/mock-api/api.js +29 -0
  136. package/module-plugin/test/mock-api/definition.js +48 -0
  137. package/module-plugin/test/mock-api/mocks/hubspot.js +43 -0
  138. package/package.json +37 -12
  139. package/prettier-config/.eslintrc.json +3 -0
  140. package/prettier-config/CHANGELOG.md +17 -0
  141. package/prettier-config/LICENSE.md +9 -0
  142. package/prettier-config/README.md +3 -0
  143. package/prettier-config/bump3.txt +0 -0
  144. package/prettier-config/index.js +6 -0
  145. package/syncs/README.md +3 -0
  146. package/syncs/bump3.txt +0 -0
  147. package/syncs/jest.config.js +5 -0
  148. package/syncs/manager.js +466 -0
  149. package/syncs/model.js +62 -0
  150. package/syncs/sync.js +114 -0
  151. package/test-environment/.eslintrc.json +3 -0
  152. package/test-environment/Authenticator.js +73 -0
  153. package/test-environment/CHANGELOG.md +46 -0
  154. package/test-environment/LICENSE.md +9 -0
  155. package/test-environment/README.md +3 -0
  156. package/test-environment/auther-definition-method-tester.js +45 -0
  157. package/test-environment/auther-definition-tester.js +104 -0
  158. package/test-environment/bump3.txt +0 -0
  159. package/test-environment/index.js +24 -0
  160. package/test-environment/integration-validator.js +2 -0
  161. package/test-environment/jest-global-setup.js +6 -0
  162. package/test-environment/jest-global-teardown.js +3 -0
  163. package/test-environment/jest-preset.js +14 -0
  164. package/test-environment/mock-api-readme.md +102 -0
  165. package/test-environment/mock-api.js +284 -0
  166. package/test-environment/mock-integration.js +82 -0
  167. package/test-environment/mongodb.js +22 -0
  168. package/test-environment/override-environment.js +11 -0
  169. package/types/CHANGELOG.md +49 -0
  170. package/types/README.md +24 -0
  171. package/types/assertions/index.d.ts +83 -0
  172. package/types/associations/index.d.ts +74 -0
  173. package/types/bump3.txt +0 -0
  174. package/types/core/index.d.ts +54 -0
  175. package/types/database/index.d.ts +3 -0
  176. package/types/encrypt/index.d.ts +5 -0
  177. package/types/errors/index.d.ts +66 -0
  178. package/types/eslint-config/index.d.ts +41 -0
  179. package/types/index.d.ts +14 -0
  180. package/types/integrations/index.d.ts +191 -0
  181. package/types/lambda/index.d.ts +31 -0
  182. package/types/logs/index.d.ts +5 -0
  183. package/types/module-plugin/index.d.ts +293 -0
  184. package/types/prettier-config/index.d.ts +6 -0
  185. package/types/syncs/index.d.ts +128 -0
  186. package/types/test-environment/index.d.ts +17 -0
  187. package/types/tsconfig.json +103 -0
  188. /package/{.eslintrc.json → assertions/.eslintrc.json} +0 -0
  189. /package/{bump3.txt → assertions/bump3.txt} +0 -0
  190. /package/{jest.config.js → assertions/jest.config.js} +0 -0
  191. /package/{CHANGELOG.md → core/CHANGELOG.md} +0 -0
  192. /package/{README.md → core/README.md} +0 -0
  193. /package/{load-installed-modules.js → core/load-installed-modules.js} +0 -0
@@ -0,0 +1,38 @@
1
+ module.exports = {
2
+ env: {
3
+ commonjs: true,
4
+ es2020: true,
5
+ jest: true,
6
+ },
7
+ extends: ['prettier', 'plugin:markdown/recommended'],
8
+ parser: '@babel/eslint-parser',
9
+ parserOptions: {
10
+ ecmaVersion: 11,
11
+ requireConfigFile: false,
12
+ },
13
+ plugins: ['no-only-tests'],
14
+ ignorePatterns: ['coverage/', '.nyc_output/'],
15
+ overrides: [
16
+ {
17
+ files: ['*.json'],
18
+ plugins: ['json'],
19
+ extends: ['plugin:json/recommended'],
20
+ },
21
+ {
22
+ files: ['*.yaml', '*.yml'],
23
+ plugins: ['yaml'],
24
+ extends: ['plugin:yaml/recommended'],
25
+ },
26
+ ],
27
+ rules: {
28
+ 'no-only-tests/no-only-tests': ['error', { fix: false }],
29
+ 'no-unused-vars': [
30
+ 'warn',
31
+ { vars: 'all', args: 'after-used', ignoreRestSiblings: false },
32
+ ],
33
+ 'no-console': ['warn'],
34
+ camelcase: ['warn'],
35
+ 'no-mixed-requires': ['warn'],
36
+ 'no-warning-comments': ['warn'],
37
+ },
38
+ };
package/index.js CHANGED
@@ -1,6 +1,30 @@
1
- const { Delegate } = require('./Delegate');
2
- const { Worker } = require('./Worker');
3
- const { loadInstalledModules } = require('./load-installed-modules');
4
- const { createHandler } = require('./create-handler');
1
+ const testEnvironment = require('./test-environment/index');
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');
5
11
 
6
- module.exports = { Delegate, Worker, loadInstalledModules, createHandler };
12
+ const eslintConfig = require('./eslint-config')
13
+ const prettierConfig = require('./prettier-config')
14
+
15
+ // const {Sync } = require('./syncs/model');
16
+
17
+ module.exports = {
18
+ ...testEnvironment,
19
+ ...core,
20
+ ...database,
21
+ ...assertions,
22
+ ...integrations,
23
+ ...errors,
24
+ ...encrypt,
25
+ ...lambda,
26
+ ...logs,
27
+ ...modulePlugin,
28
+ eslintConfig,
29
+ prettierConfig
30
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@friggframework/eslint-config"
3
+ }
@@ -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.
@@ -0,0 +1,3 @@
1
+ # integrations
2
+
3
+ This package exports the `integrations` objects, functions, and models used in [Frigg](https://friggframework.org). You can find its documentation [on Frigg's website](https://docs.friggframework.org/packages/integrations).
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 };