@friggframework/core 2.0.0--canary.546.ce82650.0 → 2.0.0--canary.546.74db90f.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/index.js +3 -0
- package/assertions/is-equal.js +19 -0
- package/database/repositories/health-check-repository-mongodb.js +5 -3
- package/index.js +2 -0
- package/package.json +5 -5
- package/types/associations/index.d.ts +15 -0
- package/types/database/index.d.ts +0 -6
- package/types/module-plugin/index.d.ts +9 -12
- package/types/syncs/index.d.ts +13 -0
package/assertions/index.js
CHANGED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { ObjectId } = require('mongodb');
|
|
2
|
+
|
|
3
|
+
const expectShallowEqualDbObject = (modelObject, compareObject) => {
|
|
4
|
+
for (const key in compareObject) {
|
|
5
|
+
let objVal = modelObject[key];
|
|
6
|
+
|
|
7
|
+
if (objVal instanceof Date) {
|
|
8
|
+
objVal = objVal.toISOString();
|
|
9
|
+
} else if (objVal instanceof ObjectId) {
|
|
10
|
+
objVal = objVal.toString();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
expect(compareObject[key]).toBe(objVal);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// TODO not sure how much this is needed, but could rewrite with _.isEqualWith for deep equality with custom checks.
|
|
18
|
+
|
|
19
|
+
module.exports = { expectShallowEqualDbObject };
|
|
@@ -67,16 +67,18 @@ class HealthCheckRepositoryMongoDB extends HealthCheckRepositoryInterface {
|
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* Get raw credential from database bypassing Prisma encryption extension.
|
|
70
|
-
* Uses
|
|
70
|
+
* Uses $runCommandRaw to query MongoDB directly.
|
|
71
71
|
* @param {string} id
|
|
72
72
|
* @returns {Promise<Object|null>}
|
|
73
73
|
*/
|
|
74
74
|
async getRawCredentialById(id) {
|
|
75
75
|
if (!id) return null;
|
|
76
|
-
const
|
|
76
|
+
const result = await this.prisma.$runCommandRaw({
|
|
77
|
+
find: 'Credential',
|
|
77
78
|
filter: { _id: { $oid: id } },
|
|
79
|
+
limit: 1,
|
|
78
80
|
});
|
|
79
|
-
return
|
|
81
|
+
return result.cursor?.firstBatch?.[0] || null;
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
async deleteCredential(id) {
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/core",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.546.
|
|
4
|
+
"version": "2.0.0--canary.546.74db90f.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.588.0",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@friggframework/eslint-config": "2.0.0--canary.546.
|
|
42
|
-
"@friggframework/prettier-config": "2.0.0--canary.546.
|
|
43
|
-
"@friggframework/test": "2.0.0--canary.546.
|
|
41
|
+
"@friggframework/eslint-config": "2.0.0--canary.546.74db90f.0",
|
|
42
|
+
"@friggframework/prettier-config": "2.0.0--canary.546.74db90f.0",
|
|
43
|
+
"@friggframework/test": "2.0.0--canary.546.74db90f.0",
|
|
44
44
|
"@prisma/client": "^6.17.0",
|
|
45
45
|
"@types/lodash": "4.17.15",
|
|
46
46
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
@@ -80,5 +80,5 @@
|
|
|
80
80
|
"publishConfig": {
|
|
81
81
|
"access": "public"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "74db90fe2fb36fe451acf167b78fe8bbae5300ca"
|
|
84
84
|
}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
declare module "@friggframework/associations/model" {
|
|
2
|
+
export interface Association {
|
|
3
|
+
integrationId: string;
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
primaryObject: string;
|
|
7
|
+
objects: {
|
|
8
|
+
entityId: string;
|
|
9
|
+
objectType: string;
|
|
10
|
+
objId: string;
|
|
11
|
+
metadata?: object;
|
|
12
|
+
}[];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
1
16
|
declare module "@friggframework/associations/association" {
|
|
2
17
|
export default class Association implements IFriggAssociation {
|
|
3
18
|
data: any;
|
|
@@ -2,10 +2,4 @@ declare module "@friggframework/database" {
|
|
|
2
2
|
export const prisma: any;
|
|
3
3
|
export function connectPrisma(): Promise<any>;
|
|
4
4
|
export function disconnectPrisma(): Promise<void>;
|
|
5
|
-
export class TokenRepository {
|
|
6
|
-
constructor(params: { prismaClient: any });
|
|
7
|
-
}
|
|
8
|
-
export class WebsocketConnectionRepository {
|
|
9
|
-
constructor(params: { prismaClient: any });
|
|
10
|
-
}
|
|
11
5
|
}
|
|
@@ -2,21 +2,18 @@ declare module "@friggframework/module-plugin" {
|
|
|
2
2
|
import { Delegate, IFriggDelegate } from "@friggframework/core";
|
|
3
3
|
|
|
4
4
|
export interface Credential {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
externalId?: string;
|
|
9
|
-
data?: any;
|
|
5
|
+
userId: string;
|
|
6
|
+
authIsValid: boolean;
|
|
7
|
+
externalId: string;
|
|
10
8
|
}
|
|
11
9
|
|
|
10
|
+
interface IFriggEntityManager { }
|
|
11
|
+
|
|
12
12
|
export interface Entity {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
moduleName?: string;
|
|
18
|
-
externalId?: string;
|
|
19
|
-
data?: any;
|
|
13
|
+
credentialId: string;
|
|
14
|
+
userId: string;
|
|
15
|
+
name: string;
|
|
16
|
+
externalId: string;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
export type MappedEntity = Entity & { id: string; type: any };
|
package/types/syncs/index.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
declare module "@friggframework/syncs/model" {
|
|
2
|
+
export interface Sync {
|
|
3
|
+
entities: any[];
|
|
4
|
+
hash: string;
|
|
5
|
+
name: string;
|
|
6
|
+
dataIdentifiers: {
|
|
7
|
+
entity: any;
|
|
8
|
+
id: object;
|
|
9
|
+
hash: string;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
1
14
|
declare module "@friggframework/syncs/manager" {
|
|
2
15
|
import Sync from "@friggframework/syncs/sync";
|
|
3
16
|
|