@friggframework/core 0.2.31-v1-alpha-package-update.0 → 1.0.1-canary.a414ea2.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.
Files changed (156) 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/bump0.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 +23 -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 +78 -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 +13 -0
  43. package/encrypt/aes.js +27 -0
  44. package/encrypt/bump3.txt +0 -0
  45. package/encrypt/encrypt.js +132 -0
  46. package/encrypt/encrypt.test.js +1069 -0
  47. package/encrypt/index.js +4 -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 +76 -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/index.js +123 -5
  67. package/integrations/.eslintrc.json +3 -0
  68. package/integrations/CHANGELOG.md +244 -0
  69. package/integrations/LICENSE.md +9 -0
  70. package/integrations/README.md +3 -0
  71. package/integrations/bump3.txt +0 -0
  72. package/integrations/create-frigg-backend.js +31 -0
  73. package/integrations/index.js +19 -0
  74. package/integrations/integration-base.js +162 -0
  75. package/integrations/integration-factory.js +166 -0
  76. package/integrations/integration-mapping.js +43 -0
  77. package/integrations/integration-model.js +42 -0
  78. package/integrations/integration-router.js +367 -0
  79. package/integrations/integration-user.js +144 -0
  80. package/integrations/jest-setup.js +2 -0
  81. package/integrations/jest-teardown.js +2 -0
  82. package/integrations/jest.config.js +12 -0
  83. package/integrations/options.js +54 -0
  84. package/integrations/test/integration-base.test.js +143 -0
  85. package/lambda/README.md +3 -0
  86. package/lambda/TimeoutCatcher.js +43 -0
  87. package/lambda/TimeoutCatcher.test.js +68 -0
  88. package/lambda/bump3.txt +0 -0
  89. package/lambda/index.js +3 -0
  90. package/lambda/jest.config.js +3 -0
  91. package/logs/.eslintrc.json +3 -0
  92. package/logs/CHANGELOG.md +57 -0
  93. package/logs/LICENSE.md +9 -0
  94. package/logs/README.md +3 -0
  95. package/logs/bump3.txt +0 -0
  96. package/logs/index.js +7 -0
  97. package/logs/jest.config.js +5 -0
  98. package/logs/logger.js +69 -0
  99. package/logs/logger.test.js +76 -0
  100. package/module-plugin/.eslintrc.json +3 -0
  101. package/module-plugin/CHANGELOG.md +224 -0
  102. package/module-plugin/LICENSE.md +9 -0
  103. package/module-plugin/ModuleConstants.js +10 -0
  104. package/module-plugin/README.md +3 -0
  105. package/module-plugin/auther.js +342 -0
  106. package/module-plugin/bump3.txt +0 -0
  107. package/module-plugin/credential.js +22 -0
  108. package/module-plugin/entity-manager.js +70 -0
  109. package/module-plugin/entity.js +46 -0
  110. package/module-plugin/index.js +25 -0
  111. package/module-plugin/jest-setup.js +3 -0
  112. package/module-plugin/jest-teardown.js +2 -0
  113. package/module-plugin/jest.config.js +20 -0
  114. package/module-plugin/manager.js +169 -0
  115. package/module-plugin/module-factory.js +60 -0
  116. package/module-plugin/requester/api-key.js +36 -0
  117. package/module-plugin/requester/basic.js +43 -0
  118. package/module-plugin/requester/oauth-2.js +219 -0
  119. package/module-plugin/requester/requester.js +151 -0
  120. package/module-plugin/requester/requester.test.js +28 -0
  121. package/module-plugin/test/auther.test.js +97 -0
  122. package/module-plugin/test/mock-api/api.js +29 -0
  123. package/module-plugin/test/mock-api/definition.js +48 -0
  124. package/module-plugin/test/mock-api/mocks/hubspot.js +43 -0
  125. package/package.json +28 -12
  126. package/syncs/README.md +3 -0
  127. package/syncs/bump3.txt +0 -0
  128. package/syncs/jest.config.js +5 -0
  129. package/syncs/manager.js +464 -0
  130. package/syncs/model.js +62 -0
  131. package/syncs/sync.js +114 -0
  132. package/types/CHANGELOG.md +49 -0
  133. package/types/README.md +24 -0
  134. package/types/assertions/index.d.ts +83 -0
  135. package/types/associations/index.d.ts +74 -0
  136. package/types/bump3.txt +0 -0
  137. package/types/core/index.d.ts +54 -0
  138. package/types/database/index.d.ts +3 -0
  139. package/types/encrypt/index.d.ts +5 -0
  140. package/types/errors/index.d.ts +66 -0
  141. package/types/eslint-config/index.d.ts +41 -0
  142. package/types/index.d.ts +14 -0
  143. package/types/integrations/index.d.ts +191 -0
  144. package/types/lambda/index.d.ts +31 -0
  145. package/types/logs/index.d.ts +5 -0
  146. package/types/module-plugin/index.d.ts +293 -0
  147. package/types/prettier-config/index.d.ts +6 -0
  148. package/types/syncs/index.d.ts +128 -0
  149. package/types/test-environment/index.d.ts +17 -0
  150. package/types/tsconfig.json +103 -0
  151. /package/{.eslintrc.json → assertions/.eslintrc.json} +0 -0
  152. /package/{bump3.txt → assertions/bump3.txt} +0 -0
  153. /package/{jest.config.js → assertions/jest.config.js} +0 -0
  154. /package/{CHANGELOG.md → core/CHANGELOG.md} +0 -0
  155. /package/{README.md → core/README.md} +0 -0
  156. /package/{load-installed-modules.js → core/load-installed-modules.js} +0 -0
@@ -0,0 +1,87 @@
1
+ # v1.0.8 (Tue Apr 04 2023)
2
+
3
+ :tada: This release contains work from a new contributor! :tada:
4
+
5
+ Thank you, null[@debbie-yu](https://github.com/debbie-yu), for all your work!
6
+
7
+ #### 🐛 Bug Fix
8
+
9
+ - Adding new IntegrationMapping collection [#142](https://github.com/friggframework/frigg/pull/142) ([@debbie-yu](https://github.com/debbie-yu))
10
+ - Merge branch 'main' of https://github.com/friggframework/frigg into debbie.yu/integration-mapping ([@debbie-yu](https://github.com/debbie-yu))
11
+ - addressing PR feedback and adding unit tests around IntegrationMapping ([@debbie-yu](https://github.com/debbie-yu))
12
+ - Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
13
+
14
+ #### Authors: 2
15
+
16
+ - [@debbie-yu](https://github.com/debbie-yu)
17
+ - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
18
+
19
+ ---
20
+
21
+ # v1.0.7 (Tue Jan 10 2023)
22
+
23
+ :tada: This release contains work from a new contributor! :tada:
24
+
25
+ Thank you, Jonathan O'Donnell ([@joncodo](https://github.com/joncodo)), for all your work!
26
+
27
+ #### 🐛 Bug Fix
28
+
29
+ - strKey is not defined [#90](https://github.com/friggframework/frigg/pull/90) ([@seanspeaks](https://github.com/seanspeaks))
30
+ - strKey is not defined ([@seanspeaks](https://github.com/seanspeaks))
31
+ - Merge branch 'main' of github.com:friggframework/frigg into doc-updates ([@joncodo](https://github.com/joncodo))
32
+ - Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
33
+
34
+ #### Authors: 2
35
+
36
+ - Jonathan O'Donnell ([@joncodo](https://github.com/joncodo))
37
+ - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
38
+
39
+ ---
40
+
41
+ # v1.0.6 (Mon Jan 09 2023)
42
+
43
+ :tada: This release contains work from new contributors! :tada:
44
+
45
+ Thanks for all your work!
46
+
47
+ :heart: null[@cgenesoniSouthWorks](https://github.com/cgenesoniSouthWorks)
48
+
49
+ :heart: Gregorio Martin ([@gregoriomartin](https://github.com/gregoriomartin))
50
+
51
+ #### 🐛 Bug Fix
52
+
53
+ - Merge remote-tracking branch 'origin/main' into gitbook-updates [#48](https://github.com/friggframework/frigg/pull/48) ([@seanspeaks](https://github.com/seanspeaks))
54
+ - Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
55
+ - Updates to managers [#24](https://github.com/friggframework/frigg/pull/24) ([@seanspeaks](https://github.com/seanspeaks))
56
+ - replace local references [#22](https://github.com/friggframework/frigg/pull/22) ([@cgenesoniSouthWorks](https://github.com/cgenesoniSouthWorks) [@gregoriomartin](https://github.com/gregoriomartin))
57
+ - replace local references ([@cgenesoniSouthWorks](https://github.com/cgenesoniSouthWorks))
58
+ - Merge remote-tracking branch 'origin/main' into simplify-mongoose-models ([@seanspeaks](https://github.com/seanspeaks))
59
+ - Add READMEs for all packages and api-modules [#20](https://github.com/friggframework/frigg/pull/20) ([@seanspeaks](https://github.com/seanspeaks))
60
+ - Add READMEs for all packages and api-modules ([@seanspeaks](https://github.com/seanspeaks))
61
+
62
+ #### ⚠️ Pushed to `main`
63
+
64
+ - Merge branch 'main' into gitbook-updates ([@seanspeaks](https://github.com/seanspeaks))
65
+ - Add lodash.get as a dependency ([@seanspeaks](https://github.com/seanspeaks))
66
+ - Refactored for more conventional naming (at least for packages) ([@seanspeaks](https://github.com/seanspeaks))
67
+
68
+ #### Authors: 3
69
+
70
+ - [@cgenesoniSouthWorks](https://github.com/cgenesoniSouthWorks)
71
+ - Gregorio Martin ([@gregoriomartin](https://github.com/gregoriomartin))
72
+ - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
73
+
74
+ ---
75
+
76
+ # v1.0.5 (Thu Oct 13 2022)
77
+
78
+ #### 🐛 Bug Fix
79
+
80
+ - Bf/ironclad credential entity bug [#54](https://github.com/friggframework/frigg/pull/54) ([@JonathanEdMoore](https://github.com/JonathanEdMoore) [@sheehantoufiq](https://github.com/sheehantoufiq))
81
+ - merge conflicts ([@sheehantoufiq](https://github.com/sheehantoufiq))
82
+ - slack module changes ([@sheehantoufiq](https://github.com/sheehantoufiq))
83
+
84
+ #### Authors: 2
85
+
86
+ - Jonathan Moore ([@JonathanEdMoore](https://github.com/JonathanEdMoore))
87
+ - Sheehan Toufiq Khan ([@sheehantoufiq](https://github.com/sheehantoufiq))
@@ -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
+ # assertions
2
+
3
+ This package exports the `assertions` helpers used in [Frigg](https://friggframework.org). You can find its documentation [on Frigg's website](https://docs.friggframework.org/packages/assertions).
@@ -0,0 +1 @@
1
+ 0
@@ -0,0 +1,139 @@
1
+ const lodashGet = require('lodash.get');
2
+ const {
3
+ RequiredPropertyError,
4
+ ParameterTypeError,
5
+ } = require('../errors');
6
+
7
+ const get = (o, key, defaultValue) => {
8
+ const value = lodashGet(o, key, defaultValue);
9
+
10
+ if (value !== undefined) {
11
+ return value;
12
+ }
13
+
14
+ if (defaultValue === undefined) {
15
+ throw new RequiredPropertyError({
16
+ parent: this,
17
+ key,
18
+ });
19
+ }
20
+
21
+ return defaultValue;
22
+ };
23
+
24
+ const getAll = (o, requiredKeys) => {
25
+ const missingKeys = [];
26
+ const returnDict = {};
27
+
28
+ for (const key of requiredKeys) {
29
+ const val = lodashGet(o, key);
30
+
31
+ if (val) {
32
+ returnDict[key] = val;
33
+ } else {
34
+ missingKeys.push(key);
35
+ }
36
+ }
37
+
38
+ if (missingKeys.length > 0) {
39
+ throw new Error(
40
+ `Missing Parameter${
41
+ missingKeys.length == 1 ? '' : 's'
42
+ }: ${missingKeys.join(', ')} ${
43
+ missingKeys.length == 1 ? 'is' : 'are'
44
+ } required.`
45
+ );
46
+ }
47
+
48
+ return returnDict;
49
+ };
50
+
51
+ const getAndVerifyType = (params, strKey, classType, defaultValue) => {
52
+ const val = get(params, strKey, defaultValue);
53
+
54
+ if (Array.isArray(val)) {
55
+ // then check that each of the items in the array are of the classType
56
+ for (const index in val) {
57
+ if (
58
+ (val[index].prototype &&
59
+ !(val[index].prototype instanceof classType)) ||
60
+ (!val[index].prototype && !(val[index] instanceof classType))
61
+ ) {
62
+ throw new ParameterTypeError({
63
+ parent: this,
64
+ key: `${strKey}[${index}]`,
65
+ value: val,
66
+ expectedType: classType.constructor,
67
+ });
68
+ }
69
+ }
70
+ } else if (
71
+ (val.prototype && !(val.prototype instanceof classType)) ||
72
+ (!val.prototype && !(val instanceof classType))
73
+ ) {
74
+ throw new ParameterTypeError({
75
+ parent: this,
76
+ key: strKey,
77
+ value: val,
78
+ expectedType: classType.constructor,
79
+ });
80
+ }
81
+ return val;
82
+ };
83
+
84
+ const getArrayParamAndVerifyParamType = (
85
+ params,
86
+ strKey,
87
+ paramType,
88
+ defaultValue
89
+ ) => {
90
+ const val = get(params, strKey, defaultValue);
91
+
92
+ if (Array.isArray(val)) {
93
+ for (const index in val) {
94
+ getParamAndVerifyParamType(val, index, paramType, defaultValue);
95
+ }
96
+ } else {
97
+ throw new ParameterTypeError({
98
+ parent: this,
99
+ key: strKey,
100
+ value: val,
101
+ expectedType: Array,
102
+ });
103
+ }
104
+ return val;
105
+ };
106
+
107
+ const getParamAndVerifyParamType = (
108
+ params,
109
+ strKey,
110
+ paramType,
111
+ defaultValue
112
+ ) => {
113
+ const val = get(params, strKey, defaultValue);
114
+
115
+ if (Array.isArray(val)) {
116
+ throw new Error(`${strKey} should not be an array`);
117
+ }
118
+ verifyType(val, paramType);
119
+ return val;
120
+ };
121
+
122
+ const verifyType = (val, paramType) => {
123
+ if (typeof val !== paramType) {
124
+ throw new ParameterTypeError({
125
+ parent: this,
126
+ value: val,
127
+ expectedType: paramType,
128
+ });
129
+ }
130
+ };
131
+
132
+ module.exports = {
133
+ get,
134
+ getAll,
135
+ verifyType,
136
+ getParamAndVerifyParamType,
137
+ getArrayParamAndVerifyParamType,
138
+ getAndVerifyType,
139
+ };
@@ -0,0 +1,19 @@
1
+ const {
2
+ get,
3
+ getAll,
4
+ verifyType,
5
+ getParamAndVerifyParamType,
6
+ getArrayParamAndVerifyParamType,
7
+ getAndVerifyType,
8
+ } = require('./get');
9
+ const { expectShallowEqualDbObject } = require('./is-equal');
10
+
11
+ module.exports = {
12
+ expectShallowEqualDbObject,
13
+ get,
14
+ getAll,
15
+ verifyType,
16
+ getParamAndVerifyParamType,
17
+ getArrayParamAndVerifyParamType,
18
+ getAndVerifyType,
19
+ };
@@ -0,0 +1,17 @@
1
+ const expectShallowEqualDbObject = (modelObject, compareObject) => {
2
+ for (const key in compareObject) {
3
+ let objVal = modelObject[key];
4
+
5
+ if (objVal instanceof Date) {
6
+ objVal = objVal.toISOString();
7
+ } else if (objVal instanceof mongoose.Types.ObjectId) {
8
+ objVal = objVal._id.toString();
9
+ }
10
+
11
+ expect(compareObject[key]).toBe(objVal);
12
+ }
13
+ };
14
+
15
+ // TODO not sure how much this is needed, but could rewrite with _.isEqualWith for deep equality with custom checks.
16
+
17
+ module.exports = { expectShallowEqualDbObject };
@@ -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
+ # associations
2
+
3
+ This package exports the `associations` mongoose model used in [Frigg](https://friggframework.org). You can find its documentation [on Frigg's website](https://docs.friggframework.org/packages/associations).
@@ -0,0 +1,78 @@
1
+ const md5 = require("md5");
2
+ const { get } = require('../assertions');
3
+
4
+ /**
5
+ * @file This file is meant to be the thing that enforces proper use of
6
+ * the Association model.
7
+ * For now, we're going to use the model directly and worry about proper use
8
+ * later...
9
+ */
10
+ class Association {
11
+ static Config = {
12
+ name: "Association",
13
+
14
+ reverseModuleMap: {},
15
+ };
16
+ constructor(params) {
17
+ this.data = {};
18
+
19
+ let data = get(params, "data");
20
+ this.moduleName = get(params, "moduleName");
21
+ this.dataIdentifier = get(params, "dataIdentifier");
22
+
23
+ this.dataIdentifierHash = this.constructor.hashJSON(this.dataIdentifier);
24
+
25
+ for (let key of this.constructor.Config.keys) {
26
+ this.data[key] =
27
+ this.constructor.Config.moduleMap[this.moduleName][key](data);
28
+ }
29
+
30
+ // matchHash is used to find matches between two sync objects
31
+ let matchHashData = [];
32
+ for (let key of this.constructor.Config.matchOn) {
33
+ matchHashData.push(this.data[key]);
34
+ }
35
+ this.matchHash = this.constructor.hashJSON(matchHashData);
36
+
37
+ this.syncId = null;
38
+ }
39
+
40
+ equals(syncObj) {
41
+ return this.matchHash === syncObj.matchHash;
42
+ }
43
+ dataKeyIsReplaceable(key) {
44
+ return this.data[key] === null || this.data[key] === "";
45
+ }
46
+
47
+ isModuleInMap(moduleName) {
48
+ return this.constructor.Config.moduleMap[name];
49
+ }
50
+
51
+ getName() {
52
+ return this.name;
53
+ }
54
+
55
+ getHashData() {
56
+ let orderedData = [];
57
+ for (let key of this.constructor.Config.keys) {
58
+ orderedData.push(this.data[key]);
59
+ }
60
+
61
+ return this.constructor.hashJSON(orderedData);
62
+ }
63
+
64
+ setSyncId(syncId) {
65
+ this.syncId = syncId;
66
+ }
67
+
68
+ reverseModuleMap(moduleName) {
69
+ return this.constructor.Config.reverseModuleMap[moduleName](this.data);
70
+ }
71
+
72
+ static hashJSON(data) {
73
+ let dataString = JSON.stringify(data, null, 2);
74
+ return md5(dataString);
75
+ }
76
+ }
77
+
78
+ module.exports = Association;
File without changes
@@ -0,0 +1,5 @@
1
+ module.exports = async () => {
2
+ return {
3
+ preset: "@friggframework/test-environment",
4
+ };
5
+ };
@@ -0,0 +1,54 @@
1
+ const mongoose = require("mongoose");
2
+
3
+ const schema = new mongoose.Schema({
4
+ integration: {
5
+ type: mongoose.Schema.Types.ObjectId,
6
+ ref: "Integration",
7
+ required: true,
8
+ },
9
+ name: { type: String, required: true },
10
+ type: {
11
+ type: String,
12
+ enum: ["ONE_TO_MANY", "ONE_TO_ONE", "MANY_TO_ONE"],
13
+ required: true,
14
+ },
15
+ primaryObject: { type: String, required: true },
16
+ objects: [
17
+ {
18
+ entity: {
19
+ type: mongoose.Schema.Types.ObjectId,
20
+ ref: "Entity",
21
+ required: true,
22
+ },
23
+ objectType: { type: String, required: true },
24
+ objId: { type: String, required: true },
25
+ metadata: { type: Object, required: false },
26
+ },
27
+ ],
28
+ });
29
+
30
+ schema.statics({
31
+ addAssociation: async function (id, object) {
32
+ return this.update({ _id: id }, { $push: { objects: object } });
33
+ },
34
+ findAssociation: async function (name, dataIdentifierHash) {
35
+ const syncList = await this.list({
36
+ name: name,
37
+ "dataIdentifiers.hash": dataIdentifierHash,
38
+ });
39
+
40
+ if (syncList.length === 1) {
41
+ return syncList[0];
42
+ } else if (syncList.length === 0) {
43
+ return null;
44
+ } else {
45
+ throw new Error(
46
+ `there are multiple sync objects with the name ${name}, for entities [${entities}]`
47
+ );
48
+ }
49
+ },
50
+ });
51
+
52
+ const Association =
53
+ mongoose.models.Association || mongoose.model("Association", schema);
54
+ module.exports = { Association };
package/bump0.txt ADDED
@@ -0,0 +1 @@
1
+ 2
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@friggframework/eslint-config"
3
+ }
@@ -1,4 +1,4 @@
1
- const { get } = require('@friggframework/assertions');
1
+ const { get } = require('../assertions');
2
2
 
3
3
  class Delegate {
4
4
  constructor(params) {
@@ -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.
@@ -1,7 +1,7 @@
1
1
  const AWS = require('aws-sdk');
2
2
  const _ = require('lodash');
3
- const { RequiredPropertyError } = require('@friggframework/errors');
4
- const { get } = require('@friggframework/assertions');
3
+ const { RequiredPropertyError } = require('../errors');
4
+ const { get } = require('../assertions');
5
5
 
6
6
  AWS.config.update({ region: process.env.AWS_REGION });
7
7
  const sqs = new AWS.SQS({ apiVersion: '2012-11-05' });
package/core/bump3.txt ADDED
File without changes
@@ -1,8 +1,8 @@
1
1
  // This line should be at the top of the webpacked output, so be sure to require createHandler first in any handlers. "Soon" sourcemaps will be built into Node... after that, this package won't be needed.
2
2
  require('source-map-support').install();
3
3
 
4
- const { connectToDatabase } = require('@friggframework/database/mongo');
5
- const { initDebugLog, flushDebugLog } = require('@friggframework/logs');
4
+ const { connectToDatabase } = require('../database/mongo');
5
+ const { initDebugLog, flushDebugLog } = require('../logs');
6
6
 
7
7
  const createHandler = (optionByName = {}) => {
8
8
  const {
package/core/index.js ADDED
@@ -0,0 +1,6 @@
1
+ const { Delegate } = require('./Delegate');
2
+ const { Worker } = require('./Worker');
3
+ const { loadInstalledModules } = require('./load-installed-modules');
4
+ const { createHandler } = require('./create-handler');
5
+
6
+ module.exports = { Delegate, Worker, loadInstalledModules, createHandler };
@@ -0,0 +1,5 @@
1
+ module.exports = async () => {
2
+ return {
3
+ preset: '@friggframework/test-environment',
4
+ };
5
+ };
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@friggframework/eslint-config"
3
+ }
@@ -0,0 +1,97 @@
1
+ # v1.0.12 (Tue Apr 04 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
6
+
7
+ #### Authors: 1
8
+
9
+ - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
10
+
11
+ ---
12
+
13
+ # v1.0.11 (Sun Feb 12 2023)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - StrictQuery issue resolution [#127](https://github.com/friggframework/frigg/pull/127) ([@seanspeaks](https://github.com/seanspeaks))
18
+ - strictQuery is false by default in mongoose 5, changed in mongoose 6 (which gives weird behavior as it just returns all documents when a query filter statement is null or missing), and will be reverted back to false in 7. So, stick to false and override locally if need be. ([@seanspeaks](https://github.com/seanspeaks))
19
+
20
+ #### Authors: 1
21
+
22
+ - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
23
+
24
+ ---
25
+
26
+ # v1.0.10 (Tue Jan 31 2023)
27
+
28
+ #### 🐛 Bug Fix
29
+
30
+ - Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
31
+
32
+ #### Authors: 1
33
+
34
+ - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
35
+
36
+ ---
37
+
38
+ # v1.0.9 (Mon Jan 09 2023)
39
+
40
+ #### 🐛 Bug Fix
41
+
42
+ - Merge remote-tracking branch 'origin/main' into gitbook-updates [#48](https://github.com/friggframework/frigg/pull/48) ([@seanspeaks](https://github.com/seanspeaks))
43
+ - Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
44
+ - A lot of changes all rolled into one [#21](https://github.com/friggframework/frigg/pull/21) ([@seanspeaks](https://github.com/seanspeaks))
45
+ - Merge remote-tracking branch 'origin/main' into simplify-mongoose-models ([@seanspeaks](https://github.com/seanspeaks))
46
+ - Add READMEs for all packages and api-modules [#20](https://github.com/friggframework/frigg/pull/20) ([@seanspeaks](https://github.com/seanspeaks))
47
+ - Add READMEs for all packages and api-modules ([@seanspeaks](https://github.com/seanspeaks))
48
+ - Begin tweaks for mongo/mongoose models ([@seanspeaks](https://github.com/seanspeaks))
49
+
50
+ #### ⚠️ Pushed to `main`
51
+
52
+ - Merge branch 'main' into gitbook-updates ([@seanspeaks](https://github.com/seanspeaks))
53
+ - Refactored for more conventional naming (at least for packages) ([@seanspeaks](https://github.com/seanspeaks))
54
+
55
+ #### Authors: 1
56
+
57
+ - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
58
+
59
+ ---
60
+
61
+ # v1.0.8 (Mon Dec 19 2022)
62
+
63
+ #### 🐛 Bug Fix
64
+
65
+ - Add MIT [#77](https://github.com/friggframework/frigg/pull/77) ([@seanspeaks](https://github.com/seanspeaks))
66
+ - Add MIT ([@seanspeaks](https://github.com/seanspeaks))
67
+
68
+ #### Authors: 1
69
+
70
+ - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
71
+
72
+ ---
73
+
74
+ # v1.0.7 (Tue Dec 06 2022)
75
+
76
+ #### 🐛 Bug Fix
77
+
78
+ - fix modules to @friggframework [#74](https://github.com/friggframework/frigg/pull/74) ([@sheehantoufiq](https://github.com/sheehantoufiq))
79
+ - fix modules to @friggframework ([@sheehantoufiq](https://github.com/sheehantoufiq))
80
+ - Bump independent versions \[skip ci\] ([@seanspeaks](https://github.com/seanspeaks))
81
+
82
+ #### Authors: 2
83
+
84
+ - Sean Matthews ([@seanspeaks](https://github.com/seanspeaks))
85
+ - Sheehan Toufiq Khan ([@sheehantoufiq](https://github.com/sheehantoufiq))
86
+
87
+ ---
88
+
89
+ # v1.0.6 (Mon Sep 19 2022)
90
+
91
+ #### 🐛 Bug Fix
92
+
93
+ - Merge remote-tracking branch 'origin/main' into gitbook-updates [#48](https://github.com/friggframework/frigg/pull/48) ([@seanspeaks](https://github.com/seanspeaks))
94
+
95
+ #### Authors: 1
96
+
97
+ - 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
+ # database
2
+
3
+ This package exports the `database` methods used in [Frigg](https://friggframework.org). You can find its documentation [on Frigg's website](https://docs.friggframework.org/packages/database).
File without changes
@@ -0,0 +1,23 @@
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');
12
+
13
+ module.exports = {
14
+ mongoose,
15
+ connectToDatabase,
16
+ disconnectFromDatabase,
17
+ createObjectId,
18
+ IndividualUser,
19
+ OrganizationUser,
20
+ State,
21
+ Token,
22
+ UserModel
23
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = async () => {
2
+ return {
3
+ preset: '@friggframework/test-environment',
4
+ };
5
+ };