@friggframework/core 2.0.0--canary.522.cbd3d5a.0 → 2.0.0--canary.517.35ee143.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/CHANGELOG.md +67 -66
- package/CLAUDE.md +124 -148
- package/README.md +130 -165
- package/admin-scripts/index.js +16 -30
- package/admin-scripts/repositories/{admin-api-key-repository-documentdb.js → admin-process-repository-documentdb.js} +5 -5
- package/admin-scripts/repositories/{admin-api-key-repository-factory.js → admin-process-repository-factory.js} +15 -19
- package/admin-scripts/repositories/admin-process-repository-interface.js +150 -0
- package/admin-scripts/repositories/admin-process-repository-mongo.js +213 -0
- package/admin-scripts/repositories/admin-process-repository-postgres.js +251 -0
- package/admin-scripts/repositories/script-schedule-repository-factory.js +2 -6
- package/admin-scripts/repositories/script-schedule-repository-interface.js +14 -36
- package/admin-scripts/repositories/script-schedule-repository-mongo.js +13 -25
- package/admin-scripts/repositories/script-schedule-repository-postgres.js +13 -25
- package/application/commands/admin-script-commands.js +102 -266
- package/application/commands/integration-commands.js +6 -12
- package/application/index.js +3 -1
- package/assertions/get.js +4 -1
- package/associations/association.js +57 -59
- package/associations/model.js +41 -41
- package/core/CLAUDE.md +156 -222
- package/core/Worker.js +1 -5
- package/credential/repositories/credential-repository-documentdb.js +1 -71
- package/credential/repositories/credential-repository-interface.js +2 -8
- package/credential/repositories/credential-repository-mongo.js +4 -45
- package/credential/repositories/credential-repository-postgres.js +3 -44
- package/credential/repositories/credential-repository.js +4 -6
- package/credential/use-cases/get-credential-for-user.js +3 -21
- package/credential/use-cases/update-authentication-status.js +2 -5
- package/database/MONGODB_TRANSACTION_FIX.md +52 -72
- package/database/adapters/lambda-invoker.js +7 -8
- package/database/config.js +13 -15
- package/database/documentdb-encryption-service.js +13 -29
- package/database/documentdb-utils.js +12 -21
- package/database/encryption/README.md +36 -53
- package/database/encryption/encryption-schema-registry.js +9 -21
- package/database/encryption/field-encryption-service.js +4 -15
- package/database/encryption/logger.js +2 -3
- package/database/encryption/prisma-encryption-extension.js +8 -5
- package/database/index.js +2 -4
- package/database/models/IndividualUser.js +15 -15
- package/database/models/OrganizationUser.js +4 -6
- package/database/models/UserModel.js +2 -2
- package/database/models/WebsocketConnection.js +1 -4
- package/database/mongoose.js +2 -2
- package/database/prisma.js +14 -22
- package/database/repositories/health-check-repository-documentdb.js +7 -22
- package/database/repositories/health-check-repository-factory.js +3 -9
- package/database/repositories/health-check-repository-interface.js +5 -15
- package/database/repositories/health-check-repository-mongodb.js +6 -9
- package/database/repositories/health-check-repository-postgres.js +1 -1
- package/database/repositories/migration-status-repository-s3.js +5 -10
- package/database/use-cases/check-database-health-use-case.js +2 -3
- package/database/use-cases/check-database-state-use-case.js +7 -9
- package/database/use-cases/get-database-state-via-worker-use-case.js +12 -15
- package/database/use-cases/get-migration-status-use-case.js +2 -4
- package/database/use-cases/run-database-migration-use-case.js +9 -41
- package/database/use-cases/test-encryption-use-case.js +5 -4
- package/database/use-cases/trigger-database-migration-use-case.js +8 -9
- package/database/utils/mongodb-collection-utils.js +3 -11
- package/database/utils/mongodb-schema-init.js +4 -10
- package/database/utils/prisma-runner.js +74 -144
- package/database/utils/prisma-schema-parser.js +2 -2
- package/docs/PROCESS_MANAGEMENT_QUEUE_SPEC.md +80 -135
- package/encrypt/Cryptor.js +2 -8
- package/errors/fetch-error.js +1 -1
- package/generated/prisma-mongodb/edge.js +16 -59
- package/generated/prisma-mongodb/index-browser.js +12 -62
- package/generated/prisma-mongodb/index.d.ts +4850 -8136
- package/generated/prisma-mongodb/index.js +16 -59
- package/generated/prisma-mongodb/package.json +1 -1
- package/generated/prisma-mongodb/schema.prisma +33 -75
- package/generated/prisma-mongodb/wasm.js +16 -59
- package/generated/prisma-postgresql/edge.js +15 -59
- package/generated/prisma-postgresql/index-browser.js +11 -62
- package/generated/prisma-postgresql/index.d.ts +5963 -8930
- package/generated/prisma-postgresql/index.js +15 -59
- package/generated/prisma-postgresql/package.json +1 -1
- package/generated/prisma-postgresql/schema.prisma +33 -73
- package/generated/prisma-postgresql/wasm.js +15 -59
- package/handlers/WEBHOOKS.md +81 -104
- package/handlers/app-definition-loader.js +1 -1
- package/handlers/app-handler-helpers.js +2 -14
- package/handlers/backend-utils.js +1 -0
- package/handlers/database-migration-handler.js +45 -64
- package/handlers/middleware/admin-auth.js +53 -0
- package/handlers/routers/HEALTHCHECK.md +135 -170
- package/handlers/routers/auth.js +2 -23
- package/handlers/routers/db-migration.handler.js +3 -2
- package/handlers/routers/db-migration.js +33 -69
- package/handlers/routers/health.js +8 -23
- package/handlers/routers/integration-defined-routers.js +4 -4
- package/handlers/routers/integration-webhook-routers.js +7 -17
- package/handlers/routers/websocket.js +3 -9
- package/handlers/use-cases/check-integrations-health-use-case.js +6 -13
- package/handlers/workers/db-migration.js +26 -54
- package/index.js +9 -5
- package/integrations/WEBHOOK-QUICKSTART.md +14 -21
- package/integrations/index.js +0 -4
- package/integrations/integration-base.js +6 -9
- package/integrations/integration-router.js +146 -1817
- package/integrations/options.js +20 -47
- package/integrations/repositories/integration-repository-documentdb.js +24 -53
- package/integrations/repositories/integration-repository-factory.js +2 -6
- package/integrations/repositories/integration-repository-interface.js +9 -27
- package/integrations/repositories/integration-repository-postgres.js +3 -3
- package/integrations/repositories/process-repository-factory.js +1 -0
- package/integrations/repositories/process-repository-interface.js +5 -9
- package/integrations/repositories/process-repository-mongo.js +3 -7
- package/integrations/repositories/process-repository-postgres.js +2 -2
- package/integrations/tests/doubles/config-capturing-integration.js +8 -9
- package/integrations/tests/doubles/dummy-integration-class.js +8 -81
- package/integrations/tests/doubles/test-integration-repository.js +11 -51
- package/integrations/use-cases/create-integration.js +32 -36
- package/integrations/use-cases/create-process.js +9 -20
- package/integrations/use-cases/delete-integration-for-user.js +4 -5
- package/integrations/use-cases/get-integration-for-user.js +10 -25
- package/integrations/use-cases/get-integration-instance-by-definition.js +7 -13
- package/integrations/use-cases/get-integrations-for-user.js +1 -4
- package/integrations/use-cases/get-possible-integrations.js +1 -1
- package/integrations/use-cases/get-process.js +6 -5
- package/integrations/use-cases/index.js +1 -3
- package/integrations/use-cases/load-integration-context.js +5 -1
- package/integrations/use-cases/update-process-state.js +8 -10
- package/integrations/utils/map-integration-dto.js +3 -9
- package/jest-setup.js +1 -1
- package/jest-teardown.js +1 -1
- package/lambda/TimeoutCatcher.js +30 -32
- package/lambda/index.js +1 -1
- package/logs/index.js +3 -3
- package/modules/module.js +1 -3
- package/modules/repositories/module-repository-documentdb.js +48 -114
- package/modules/repositories/module-repository-interface.js +0 -13
- package/modules/repositories/module-repository-mongo.js +6 -46
- package/modules/repositories/module-repository-postgres.js +6 -48
- package/modules/repositories/module-repository.js +1 -34
- package/modules/requester/api-key.js +2 -0
- package/modules/requester/basic.js +1 -0
- package/modules/requester/oauth-2.js +2 -3
- package/modules/test/mock-api/definition.js +10 -15
- package/modules/test/mock-api/mocks/hubspot.js +36 -36
- package/modules/tests/doubles/test-module-factory.js +4 -10
- package/modules/tests/doubles/test-module-repository.js +1 -1
- package/modules/use-cases/get-entities-for-user.js +1 -1
- package/modules/use-cases/get-entity-options-by-id.js +6 -8
- package/modules/use-cases/get-module.js +9 -12
- package/modules/use-cases/process-authorization-callback.js +6 -12
- package/modules/use-cases/refresh-entity-options.js +6 -8
- package/modules/use-cases/test-module-auth.js +6 -8
- package/modules/utils/map-module-dto.js +2 -2
- package/package.json +5 -7
- package/prisma-mongodb/schema.prisma +33 -75
- package/prisma-postgresql/schema.prisma +33 -73
- package/queues/queuer-util.js +1 -5
- package/syncs/model.js +51 -51
- package/syncs/repositories/sync-repository-documentdb.js +19 -39
- package/syncs/repositories/sync-repository-interface.js +2 -6
- package/syncs/repositories/sync-repository-postgres.js +13 -19
- package/syncs/sync.js +100 -104
- package/token/repositories/token-repository-factory.js +3 -1
- package/types/assertions/index.d.ts +72 -72
- package/types/associations/index.d.ts +57 -57
- package/types/core/index.d.ts +53 -59
- package/types/database/index.d.ts +2 -2
- package/types/encrypt/index.d.ts +3 -3
- package/types/errors/index.d.ts +54 -61
- package/types/eslint-config/index.d.ts +40 -40
- package/types/integrations/index.d.ts +183 -185
- package/types/lambda/index.d.ts +26 -26
- package/types/logs/index.d.ts +4 -4
- package/types/module-plugin/index.d.ts +237 -239
- package/types/prettier-config/index.d.ts +5 -5
- package/types/syncs/index.d.ts +108 -102
- package/types/test-environment/index.d.ts +14 -14
- package/types/tsconfig.json +93 -95
- package/user/tests/doubles/test-user-repository.js +2 -5
- package/user/use-cases/authenticate-user.js +4 -2
- package/user/use-cases/authenticate-with-shared-secret.js +1 -1
- package/user/use-cases/create-individual-user.js +7 -8
- package/user/use-cases/create-organization-user.js +1 -1
- package/user/use-cases/create-token-for-user-id.js +1 -1
- package/user/use-cases/get-user-from-adopter-jwt.js +2 -0
- package/user/use-cases/get-user-from-bearer-token.js +3 -7
- package/user/use-cases/get-user-from-x-frigg-headers.js +11 -14
- package/user/use-cases/login-user.js +8 -8
- package/user/user.js +4 -18
- package/utils/backend-path.js +2 -2
- package/utils/index.js +1 -4
- package/websocket/repositories/websocket-connection-repository-documentdb.js +8 -21
- package/websocket/repositories/websocket-connection-repository-mongo.js +4 -8
- package/websocket/repositories/websocket-connection-repository-postgres.js +4 -8
- package/websocket/repositories/websocket-connection-repository.js +4 -8
- package/admin-scripts/repositories/admin-api-key-repository-interface.js +0 -121
- package/admin-scripts/repositories/admin-api-key-repository-mongo.js +0 -155
- package/admin-scripts/repositories/admin-api-key-repository-postgres.js +0 -189
- package/admin-scripts/repositories/script-execution-repository-documentdb.js +0 -21
- package/admin-scripts/repositories/script-execution-repository-factory.js +0 -55
- package/admin-scripts/repositories/script-execution-repository-interface.js +0 -193
- package/admin-scripts/repositories/script-execution-repository-mongo.js +0 -278
- package/admin-scripts/repositories/script-execution-repository-postgres.js +0 -320
- package/credential/credential-router.js +0 -262
- package/credential/use-cases/delete-credential-for-user.js +0 -50
- package/credential/use-cases/list-credentials-for-user.js +0 -31
- package/credential/use-cases/reauthorize-credential.js +0 -103
- package/handlers/routers/admin.js +0 -450
- package/handlers/routers/docs.js +0 -180
- package/handlers/routers/middleware/loadUser.js +0 -39
- package/handlers/routers/middleware/requireAdmin.js +0 -41
- package/handlers/routers/middleware/requireLoggedInUser.js +0 -19
- package/integrations/use-cases/execute-proxy-request.js +0 -564
- package/modules/domain/entities/AuthorizationSession.js +0 -131
- package/modules/domain/entities/index.js +0 -10
- package/modules/repositories/authorization-session-repository-factory.js +0 -55
- package/modules/repositories/authorization-session-repository-interface.js +0 -75
- package/modules/repositories/authorization-session-repository-mongo.js +0 -169
- package/modules/repositories/authorization-session-repository-postgres.js +0 -170
- package/modules/use-cases/delete-module-entity.js +0 -23
- package/modules/use-cases/get-authorization-requirements.js +0 -110
- package/modules/use-cases/get-module-entity-by-id.js +0 -16
- package/modules/use-cases/process-authorization-step.js +0 -160
- package/modules/use-cases/start-authorization-session.js +0 -86
- package/modules/use-cases/update-module-entity.js +0 -27
- package/openapi/openapi-spec-generator.js +0 -370
- package/openapi/openapi-v1.yaml +0 -1360
- package/openapi/openapi-v2.yaml +0 -1535
- package/user/use-cases/delete-user.js +0 -47
package/syncs/sync.js
CHANGED
|
@@ -1,117 +1,113 @@
|
|
|
1
|
-
const md5 = require(
|
|
2
|
-
const { debug } = require(
|
|
3
|
-
const { get } = require(
|
|
1
|
+
const md5 = require("md5");
|
|
2
|
+
const { debug } = require("packages/logs");
|
|
3
|
+
const { get } = require("packages/assertions");
|
|
4
4
|
|
|
5
5
|
class Sync {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
} else {
|
|
51
|
-
this.data = data;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// matchHash is used to find matches between two sync objects
|
|
55
|
-
// Match data _has_ to have a value
|
|
56
|
-
const matchHashData = [];
|
|
57
|
-
this.missingMatchData = false;
|
|
58
|
-
for (const key of this.constructor.Config.matchOn) {
|
|
59
|
-
if (!this.data[key]) {
|
|
60
|
-
this.missingMatchData = true;
|
|
61
|
-
debug(`Data key of ${key} was missing from MatchOn`);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
matchHashData.push(this.data[key]);
|
|
65
|
-
}
|
|
66
|
-
this.matchHash = this.constructor.hashJSON(matchHashData);
|
|
67
|
-
|
|
68
|
-
this.syncId = null;
|
|
6
|
+
static Config = {
|
|
7
|
+
name: "Sync",
|
|
8
|
+
|
|
9
|
+
// an array of keys we will use to form an object and then hash it. Order matters here
|
|
10
|
+
// because it will effect how the hash results
|
|
11
|
+
keys: [],
|
|
12
|
+
|
|
13
|
+
// matchOn is an array of keys that make the variable unique when combined together
|
|
14
|
+
// and is used to sync with the other objects
|
|
15
|
+
// matchOn keys _have_ to have a value, otherwise the object is not considered a match
|
|
16
|
+
matchOn: [],
|
|
17
|
+
|
|
18
|
+
// a key value mapping of module to then a list of keys that will map to
|
|
19
|
+
// an a function that takes in the module object and return the value from it
|
|
20
|
+
// format as follows:
|
|
21
|
+
// {
|
|
22
|
+
// ModuleName:{
|
|
23
|
+
// firstName:(moduleObject)=>{moduleObject['name'][0]},
|
|
24
|
+
// lastName:(moduleObject)=>{moduleObject['name'][1]},
|
|
25
|
+
// },
|
|
26
|
+
// ....
|
|
27
|
+
// }
|
|
28
|
+
moduleMap: {},
|
|
29
|
+
reverseModuleMap: {},
|
|
30
|
+
};
|
|
31
|
+
constructor(params) {
|
|
32
|
+
this.data = {};
|
|
33
|
+
|
|
34
|
+
let data = get(params, "data");
|
|
35
|
+
this.moduleName = get(params, "moduleName");
|
|
36
|
+
this.dataIdentifier = get(params, "dataIdentifier");
|
|
37
|
+
this.useMapping = get(params, "useMapping", true); // Use with caution...
|
|
38
|
+
|
|
39
|
+
this.dataIdentifierHash = this.constructor.hashJSON(this.dataIdentifier);
|
|
40
|
+
|
|
41
|
+
if (this.useMapping) {
|
|
42
|
+
for (let key of this.constructor.Config.keys) {
|
|
43
|
+
this.data[key] =
|
|
44
|
+
this.constructor.Config.moduleMap[this.moduleName][key](data);
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
this.data = data;
|
|
69
48
|
}
|
|
70
49
|
|
|
71
|
-
|
|
72
|
-
|
|
50
|
+
// matchHash is used to find matches between two sync objects
|
|
51
|
+
// Match data _has_ to have a value
|
|
52
|
+
const matchHashData = [];
|
|
53
|
+
this.missingMatchData = false;
|
|
54
|
+
for (const key of this.constructor.Config.matchOn) {
|
|
55
|
+
if (!this.data[key]) {
|
|
56
|
+
this.missingMatchData = true;
|
|
57
|
+
debug(`Data key of ${key} was missing from MatchOn`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
matchHashData.push(this.data[key]);
|
|
73
61
|
}
|
|
74
|
-
|
|
75
|
-
|
|
62
|
+
this.matchHash = this.constructor.hashJSON(matchHashData);
|
|
63
|
+
|
|
64
|
+
this.syncId = null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
equals(syncObj) {
|
|
68
|
+
return this.matchHash === syncObj.matchHash;
|
|
69
|
+
}
|
|
70
|
+
dataKeyIsReplaceable(key) {
|
|
71
|
+
return this.data[key] === null || this.data[key] === "";
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
isModuleInMap(moduleName) {
|
|
75
|
+
return this.constructor.Config.moduleMap[name];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
getName() {
|
|
79
|
+
return this.constructor.Config.name;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
getHashData(params) {
|
|
83
|
+
let omitEmptyStringsFromData = get(
|
|
84
|
+
params,
|
|
85
|
+
"omitEmptyStringsFromData",
|
|
86
|
+
false
|
|
87
|
+
);
|
|
88
|
+
let orderedData = [];
|
|
89
|
+
for (let key of this.constructor.Config.keys) {
|
|
90
|
+
if (omitEmptyStringsFromData && this.data[key] === "") {
|
|
91
|
+
this.data[key] = undefined;
|
|
92
|
+
}
|
|
93
|
+
orderedData.push(this.data[key]);
|
|
76
94
|
}
|
|
77
95
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
getName() {
|
|
83
|
-
return this.constructor.Config.name;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
getHashData(params) {
|
|
87
|
-
let omitEmptyStringsFromData = get(
|
|
88
|
-
params,
|
|
89
|
-
'omitEmptyStringsFromData',
|
|
90
|
-
false
|
|
91
|
-
);
|
|
92
|
-
let orderedData = [];
|
|
93
|
-
for (let key of this.constructor.Config.keys) {
|
|
94
|
-
if (omitEmptyStringsFromData && this.data[key] === '') {
|
|
95
|
-
this.data[key] = undefined;
|
|
96
|
-
}
|
|
97
|
-
orderedData.push(this.data[key]);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return this.constructor.hashJSON(orderedData);
|
|
101
|
-
}
|
|
96
|
+
return this.constructor.hashJSON(orderedData);
|
|
97
|
+
}
|
|
102
98
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
setSyncId(syncId) {
|
|
100
|
+
this.syncId = syncId;
|
|
101
|
+
}
|
|
106
102
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
reverseModuleMap(moduleName) {
|
|
104
|
+
return this.constructor.Config.reverseModuleMap[moduleName](this.data);
|
|
105
|
+
}
|
|
110
106
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
static hashJSON(data) {
|
|
108
|
+
let dataString = JSON.stringify(data, null, 2);
|
|
109
|
+
return md5(dataString);
|
|
110
|
+
}
|
|
115
111
|
}
|
|
116
112
|
|
|
117
113
|
module.exports = Sync;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
const { TokenRepositoryMongo } = require('./token-repository-mongo');
|
|
2
2
|
const { TokenRepositoryPostgres } = require('./token-repository-postgres');
|
|
3
|
-
const {
|
|
3
|
+
const {
|
|
4
|
+
TokenRepositoryDocumentDB,
|
|
5
|
+
} = require('./token-repository-documentdb');
|
|
4
6
|
const config = require('../../database/config');
|
|
5
7
|
|
|
6
8
|
/**
|
|
@@ -1,83 +1,83 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
declare module "@friggframework/assertions" {
|
|
2
|
+
type TypeOfType =
|
|
3
|
+
| "undefined"
|
|
4
|
+
| "object"
|
|
5
|
+
| "boolean"
|
|
6
|
+
| "number"
|
|
7
|
+
| "string"
|
|
8
|
+
| "function"
|
|
9
|
+
| "symbol"
|
|
10
|
+
| "bigint";
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
export function get<TObject extends object, TKey extends string, TDefault>(
|
|
13
|
+
object: TObject,
|
|
14
|
+
key: TKey | undefined,
|
|
15
|
+
defaultValue: Exclude<TDefault, undefined>
|
|
16
|
+
): TKey extends keyof TObject ? TObject[TKey] : TDefault;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
export function get<TObject extends object, TKey extends keyof TObject>(
|
|
19
|
+
object: TObject,
|
|
20
|
+
key: TKey
|
|
21
|
+
): TObject[TKey];
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
export function getAll<TObject extends object, TKey extends keyof TObject>(
|
|
24
|
+
object: TObject,
|
|
25
|
+
requiredKeys: TKey[]
|
|
26
|
+
): Partial<TObject>;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
export function verifyType(value: unknown, paramType: TypeOfType): void;
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
30
|
+
export function getParamAndVerifyParamType<
|
|
31
|
+
TObject extends object,
|
|
32
|
+
TKey extends string,
|
|
33
|
+
TKeyType extends TypeOfType,
|
|
34
|
+
TDefault
|
|
35
|
+
>(
|
|
36
|
+
params: TObject,
|
|
37
|
+
key: TKey,
|
|
38
|
+
type: TKeyType,
|
|
39
|
+
defaultValue: TDefault
|
|
40
|
+
): TDefault;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
export function getParamAndVerifyParamType<
|
|
43
|
+
TObject extends object,
|
|
44
|
+
TKey extends keyof TObject,
|
|
45
|
+
TKeyType extends TypeOfType
|
|
46
|
+
>(params: TObject, key: TKey, type: TKeyType): TObject[TKey];
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
export function getArrayParamAndVerifyParamType<
|
|
49
|
+
TObject extends object,
|
|
50
|
+
TKey extends string,
|
|
51
|
+
TKeyType extends TypeOfType,
|
|
52
|
+
TDefault
|
|
53
|
+
>(
|
|
54
|
+
params: TObject,
|
|
55
|
+
key: TKey,
|
|
56
|
+
type: TKeyType,
|
|
57
|
+
defaultValue: TDefault
|
|
58
|
+
): TDefault;
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
export function getArrayParamAndVerifyParamType<
|
|
61
|
+
TObject extends object,
|
|
62
|
+
TKey extends keyof TObject,
|
|
63
|
+
TKeyType extends TypeOfType
|
|
64
|
+
>(params: TObject, key: TKey, type: TKeyType): TObject[TKey];
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
export function getAndVerifyType<
|
|
67
|
+
TObject extends object,
|
|
68
|
+
TKey extends keyof TObject,
|
|
69
|
+
TClassType extends unknown
|
|
70
|
+
>(object: TObject, key: TKey, classType: TClassType): TObject[TKey];
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
export function getAndVerifyType<
|
|
73
|
+
TObject extends object,
|
|
74
|
+
TKey extends string,
|
|
75
|
+
TClassType extends unknown,
|
|
76
|
+
TDefault
|
|
77
|
+
>(
|
|
78
|
+
object: TObject,
|
|
79
|
+
key: TKey,
|
|
80
|
+
classType: TClassType,
|
|
81
|
+
defaultValue: TDefault
|
|
82
|
+
): TKey extends keyof TObject ? TObject[TKey] : TDefault;
|
|
83
83
|
}
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
|
|
1
|
+
declare module "@friggframework/associations/model" {
|
|
2
|
+
import { Model } from "mongoose";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
export class Association extends Model {
|
|
5
|
+
integrationId: string;
|
|
6
|
+
name: string;
|
|
7
|
+
type: string;
|
|
8
|
+
primaryObject: string;
|
|
9
|
+
objects: {
|
|
10
|
+
entityId: string;
|
|
11
|
+
objectType: string;
|
|
12
|
+
objId: string;
|
|
13
|
+
metadata?: object;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
declare module
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
declare module "@friggframework/associations/association" {
|
|
19
|
+
export default class Association implements IFriggAssociation {
|
|
20
|
+
data: any;
|
|
21
|
+
dataIdentifier: any;
|
|
22
|
+
dataIdentifierHash: string;
|
|
23
|
+
matchHash: string;
|
|
24
|
+
moduleName: any;
|
|
25
|
+
syncId: any;
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
static Config: {
|
|
28
|
+
name: "Association";
|
|
29
|
+
reverseModuleMap: {};
|
|
30
|
+
};
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
constructor(params: AssociationConstructor);
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
dataKeyIsReplaceable(key: string): boolean;
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
equals(syncObj: any): boolean;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
getHashData(): string;
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
getName(): any;
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
hashJSON(data: any): string;
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
isModuleInMap(moduleName: any): any;
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
reverseModuleMap(moduleName: any): any;
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
setSyncId(syncId: string): any;
|
|
49
|
+
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
interface IFriggAssociation {
|
|
52
|
+
data: any;
|
|
53
|
+
moduleName: any;
|
|
54
|
+
dataIdentifier: any;
|
|
55
|
+
dataIdentifierHash: string;
|
|
56
|
+
matchHash: string;
|
|
57
|
+
syncId: any;
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
equals(syncObj: any): boolean;
|
|
60
|
+
dataKeyIsReplaceable(key: string): boolean;
|
|
61
|
+
isModuleInMap(moduleName: any): any;
|
|
62
|
+
getName(): any;
|
|
63
|
+
getHashData(): string;
|
|
64
|
+
setSyncId(syncId: string): any;
|
|
65
|
+
reverseModuleMap(moduleName: any): any;
|
|
66
|
+
hashJSON(data: any): string;
|
|
67
|
+
}
|
|
68
68
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
69
|
+
type AssociationConstructor = {
|
|
70
|
+
data: any;
|
|
71
|
+
moduleName: any;
|
|
72
|
+
dataIdentifier: any;
|
|
73
|
+
};
|
|
74
74
|
}
|
package/types/core/index.d.ts
CHANGED
|
@@ -1,60 +1,54 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
type GetQueueURLParams = {
|
|
55
|
-
QueueName: string;
|
|
56
|
-
QueueOwnerAWSAccountId?: string;
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
type SendSQSMessageParams = SendMessageCommandInput;
|
|
1
|
+
declare module "@friggframework/core" {
|
|
2
|
+
import type { SendMessageCommandInput } from "@aws-sdk/client-sqs";
|
|
3
|
+
|
|
4
|
+
export class Delegate implements IFriggDelegate {
|
|
5
|
+
delegate: any;
|
|
6
|
+
delegateTypes: any[];
|
|
7
|
+
|
|
8
|
+
constructor(params: Record<string, unknown> & { delegate?: unknown });
|
|
9
|
+
notify(delegateString: string, object?: any): Promise<any>;
|
|
10
|
+
receiveNotification(
|
|
11
|
+
notifier: any,
|
|
12
|
+
delegateString: string,
|
|
13
|
+
object?: any
|
|
14
|
+
): Promise<any>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface IFriggDelegate {
|
|
18
|
+
delegate: any;
|
|
19
|
+
delegateTypes: any[];
|
|
20
|
+
|
|
21
|
+
notify(delegateString: string, object?: any): Promise<any>;
|
|
22
|
+
receiveNotification(
|
|
23
|
+
notifier: any,
|
|
24
|
+
delegateString: string,
|
|
25
|
+
object?: any
|
|
26
|
+
): Promise<any>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class Worker implements IWorker {
|
|
30
|
+
getQueueURL(params: GetQueueURLParams): Promise<string | undefined>;
|
|
31
|
+
|
|
32
|
+
run(params: { Records: any }): Promise<void>;
|
|
33
|
+
|
|
34
|
+
send(params: object & { QueueUrl: any }, delay?: number): Promise<string>;
|
|
35
|
+
|
|
36
|
+
sendAsyncSQSMessage(params: SendSQSMessageParams): Promise<string>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface IWorker {
|
|
40
|
+
getQueueURL(params: GetQueueURLParams): Promise<string | undefined>;
|
|
41
|
+
run(params: { Records: any }): Promise<void>;
|
|
42
|
+
send(params: object & { QueueUrl: any }, delay?: number): Promise<string>;
|
|
43
|
+
sendAsyncSQSMessage(params: SendSQSMessageParams): Promise<string>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function loadInstalledModules(): any[];
|
|
47
|
+
|
|
48
|
+
type GetQueueURLParams = {
|
|
49
|
+
QueueName: string;
|
|
50
|
+
QueueOwnerAWSAccountId?: string;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
type SendSQSMessageParams = SendMessageCommandInput;
|
|
60
54
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
|
|
1
|
+
declare module "@friggframework/database/mongo" {
|
|
2
|
+
export function connectToDatabase(): Promise<void>;
|
|
3
3
|
}
|
package/types/encrypt/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
declare module
|
|
2
|
-
|
|
1
|
+
declare module "@friggframework/encrypt" {
|
|
2
|
+
import { Schema } from "mongoose";
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
export function Encrypt(schema: Schema, options: any): void;
|
|
5
5
|
}
|