@friggframework/core 2.0.0--canary.461.bb7fcba.0 → 2.0.0--canary.461.5767fa4.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/generated/prisma-mongodb/client.d.ts +1 -0
- package/generated/prisma-mongodb/client.js +4 -0
- package/generated/prisma-mongodb/default.d.ts +1 -0
- package/generated/prisma-mongodb/default.js +4 -0
- package/generated/prisma-mongodb/edge.d.ts +1 -0
- package/generated/prisma-mongodb/edge.js +336 -0
- package/generated/prisma-mongodb/index-browser.js +318 -0
- package/generated/prisma-mongodb/index.d.ts +22993 -0
- package/generated/prisma-mongodb/index.js +361 -0
- package/generated/prisma-mongodb/package.json +183 -0
- package/generated/prisma-mongodb/query-engine-debian-openssl-3.0.x +0 -0
- package/generated/prisma-mongodb/query-engine-rhel-openssl-3.0.x +0 -0
- package/generated/prisma-mongodb/runtime/binary.d.ts +1 -0
- package/generated/prisma-mongodb/runtime/binary.js +289 -0
- package/generated/prisma-mongodb/runtime/edge-esm.js +34 -0
- package/generated/prisma-mongodb/runtime/edge.js +34 -0
- package/generated/prisma-mongodb/runtime/index-browser.d.ts +370 -0
- package/generated/prisma-mongodb/runtime/index-browser.js +16 -0
- package/generated/prisma-mongodb/runtime/library.d.ts +3977 -0
- package/generated/prisma-mongodb/runtime/react-native.js +83 -0
- package/generated/prisma-mongodb/runtime/wasm-compiler-edge.js +84 -0
- package/generated/prisma-mongodb/runtime/wasm-engine-edge.js +36 -0
- package/generated/prisma-mongodb/schema.prisma +364 -0
- package/generated/prisma-mongodb/wasm-edge-light-loader.mjs +4 -0
- package/generated/prisma-mongodb/wasm-worker-loader.mjs +4 -0
- package/generated/prisma-mongodb/wasm.d.ts +1 -0
- package/generated/prisma-mongodb/wasm.js +343 -0
- package/generated/prisma-postgresql/client.d.ts +1 -0
- package/generated/prisma-postgresql/client.js +4 -0
- package/generated/prisma-postgresql/default.d.ts +1 -0
- package/generated/prisma-postgresql/default.js +4 -0
- package/generated/prisma-postgresql/edge.d.ts +1 -0
- package/generated/prisma-postgresql/edge.js +358 -0
- package/generated/prisma-postgresql/index-browser.js +340 -0
- package/generated/prisma-postgresql/index.d.ts +25171 -0
- package/generated/prisma-postgresql/index.js +383 -0
- package/generated/prisma-postgresql/package.json +183 -0
- package/generated/prisma-postgresql/query-engine-debian-openssl-3.0.x +0 -0
- package/generated/prisma-postgresql/query-engine-rhel-openssl-3.0.x +0 -0
- package/generated/prisma-postgresql/query_engine_bg.js +2 -0
- package/generated/prisma-postgresql/query_engine_bg.wasm +0 -0
- package/generated/prisma-postgresql/runtime/binary.d.ts +1 -0
- package/generated/prisma-postgresql/runtime/binary.js +289 -0
- package/generated/prisma-postgresql/runtime/edge-esm.js +34 -0
- package/generated/prisma-postgresql/runtime/edge.js +34 -0
- package/generated/prisma-postgresql/runtime/index-browser.d.ts +370 -0
- package/generated/prisma-postgresql/runtime/index-browser.js +16 -0
- package/generated/prisma-postgresql/runtime/library.d.ts +3977 -0
- package/generated/prisma-postgresql/runtime/react-native.js +83 -0
- package/generated/prisma-postgresql/runtime/wasm-compiler-edge.js +84 -0
- package/generated/prisma-postgresql/runtime/wasm-engine-edge.js +36 -0
- package/generated/prisma-postgresql/schema.prisma +347 -0
- package/generated/prisma-postgresql/wasm-edge-light-loader.mjs +4 -0
- package/generated/prisma-postgresql/wasm-worker-loader.mjs +4 -0
- package/generated/prisma-postgresql/wasm.d.ts +1 -0
- package/generated/prisma-postgresql/wasm.js +365 -0
- package/package.json +5 -5
- package/application/commands/integration-commands.test.js +0 -123
- package/core/Worker.test.js +0 -159
- package/database/encryption/encryption-integration.test.js +0 -553
- package/database/encryption/encryption-schema-registry.test.js +0 -392
- package/database/encryption/field-encryption-service.test.js +0 -525
- package/database/encryption/mongo-decryption-fix-verification.test.js +0 -348
- package/database/encryption/postgres-decryption-fix-verification.test.js +0 -371
- package/database/encryption/postgres-relation-decryption.test.js +0 -245
- package/database/encryption/prisma-encryption-extension.test.js +0 -439
- package/database/repositories/migration-status-repository-s3.test.js +0 -158
- package/database/use-cases/check-encryption-health-use-case.test.js +0 -192
- package/database/use-cases/get-migration-status-use-case.test.js +0 -171
- package/database/use-cases/run-database-migration-use-case.test.js +0 -310
- package/database/use-cases/trigger-database-migration-use-case.test.js +0 -250
- package/database/utils/prisma-runner.test.js +0 -486
- package/encrypt/Cryptor.test.js +0 -144
- package/errors/base-error.test.js +0 -32
- package/errors/fetch-error.test.js +0 -79
- package/errors/halt-error.test.js +0 -11
- package/errors/validation-errors.test.js +0 -120
- package/handlers/auth-flow.integration.test.js +0 -147
- package/handlers/integration-event-dispatcher.test.js +0 -209
- package/handlers/routers/db-migration.test.js +0 -51
- package/handlers/routers/health.test.js +0 -210
- package/handlers/routers/integration-webhook-routers.test.js +0 -126
- package/handlers/use-cases/check-integrations-health-use-case.test.js +0 -125
- package/handlers/webhook-flow.integration.test.js +0 -356
- package/handlers/workers/db-migration.test.js +0 -50
- package/handlers/workers/integration-defined-workers.test.js +0 -184
- package/integrations/tests/integration-router-multi-auth.test.js +0 -369
- package/integrations/tests/use-cases/create-integration.test.js +0 -131
- package/integrations/tests/use-cases/delete-integration-for-user.test.js +0 -150
- package/integrations/tests/use-cases/find-integration-context-by-external-entity-id.test.js +0 -92
- package/integrations/tests/use-cases/get-integration-for-user.test.js +0 -150
- package/integrations/tests/use-cases/get-integration-instance.test.js +0 -176
- package/integrations/tests/use-cases/get-integrations-for-user.test.js +0 -176
- package/integrations/tests/use-cases/get-possible-integrations.test.js +0 -188
- package/integrations/tests/use-cases/update-integration-messages.test.js +0 -142
- package/integrations/tests/use-cases/update-integration-status.test.js +0 -103
- package/integrations/tests/use-cases/update-integration.test.js +0 -141
- package/integrations/use-cases/create-process.test.js +0 -178
- package/integrations/use-cases/get-process.test.js +0 -190
- package/integrations/use-cases/load-integration-context-full.test.js +0 -329
- package/integrations/use-cases/load-integration-context.test.js +0 -114
- package/integrations/use-cases/update-process-metrics.test.js +0 -308
- package/integrations/use-cases/update-process-state.test.js +0 -256
- package/lambda/TimeoutCatcher.test.js +0 -68
- package/logs/logger.test.js +0 -76
- package/modules/module-hydration.test.js +0 -205
- package/modules/requester/requester.test.js +0 -28
- package/queues/queuer-util.test.js +0 -132
- package/user/tests/use-cases/create-individual-user.test.js +0 -24
- package/user/tests/use-cases/create-organization-user.test.js +0 -28
- package/user/tests/use-cases/create-token-for-user-id.test.js +0 -19
- package/user/tests/use-cases/get-user-from-adopter-jwt.test.js +0 -113
- package/user/tests/use-cases/get-user-from-bearer-token.test.js +0 -64
- package/user/tests/use-cases/get-user-from-x-frigg-headers.test.js +0 -346
- package/user/tests/use-cases/login-user.test.js +0 -220
- package/user/tests/user-password-encryption-isolation.test.js +0 -237
- package/user/tests/user-password-hashing.test.js +0 -235
- package/websocket/repositories/websocket-connection-repository.test.js +0 -227
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tests for WebSocket Connection Repository - AWS SDK v3 Migration
|
|
3
|
-
*
|
|
4
|
-
* Tests API Gateway Management API operations using aws-sdk-client-mock
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const { mockClient } = require('aws-sdk-client-mock');
|
|
8
|
-
const { ApiGatewayManagementApiClient, PostToConnectionCommand } = require('@aws-sdk/client-apigatewaymanagementapi');
|
|
9
|
-
const { WebsocketConnectionRepository } = require('./websocket-connection-repository');
|
|
10
|
-
|
|
11
|
-
// Mock Prisma
|
|
12
|
-
jest.mock('../../database/prisma', () => ({
|
|
13
|
-
prisma: {
|
|
14
|
-
websocketConnection: {
|
|
15
|
-
create: jest.fn(),
|
|
16
|
-
delete: jest.fn(),
|
|
17
|
-
findMany: jest.fn(),
|
|
18
|
-
findFirst: jest.fn(),
|
|
19
|
-
findUnique: jest.fn(),
|
|
20
|
-
deleteMany: jest.fn(),
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
}));
|
|
24
|
-
|
|
25
|
-
const { prisma } = require('../../database/prisma');
|
|
26
|
-
|
|
27
|
-
describe('WebsocketConnectionRepository - AWS SDK v3', () => {
|
|
28
|
-
let apiGatewayMock;
|
|
29
|
-
let repository;
|
|
30
|
-
const originalEnv = process.env;
|
|
31
|
-
|
|
32
|
-
beforeEach(() => {
|
|
33
|
-
apiGatewayMock = mockClient(ApiGatewayManagementApiClient);
|
|
34
|
-
repository = new WebsocketConnectionRepository();
|
|
35
|
-
jest.clearAllMocks();
|
|
36
|
-
process.env = {
|
|
37
|
-
...originalEnv,
|
|
38
|
-
WEBSOCKET_API_ENDPOINT: 'https://test.execute-api.us-east-1.amazonaws.com/dev'
|
|
39
|
-
};
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
afterEach(() => {
|
|
43
|
-
apiGatewayMock.reset();
|
|
44
|
-
process.env = originalEnv;
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
describe('createConnection()', () => {
|
|
48
|
-
it('should create websocket connection record', async () => {
|
|
49
|
-
const mockConnection = { id: '1', connectionId: 'test-connection-123' };
|
|
50
|
-
prisma.websocketConnection.create.mockResolvedValue(mockConnection);
|
|
51
|
-
|
|
52
|
-
const result = await repository.createConnection('test-connection-123');
|
|
53
|
-
|
|
54
|
-
expect(result).toEqual(mockConnection);
|
|
55
|
-
expect(prisma.websocketConnection.create).toHaveBeenCalledWith({
|
|
56
|
-
data: { connectionId: 'test-connection-123' },
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
describe('deleteConnection()', () => {
|
|
62
|
-
it('should delete websocket connection', async () => {
|
|
63
|
-
prisma.websocketConnection.delete.mockResolvedValue({});
|
|
64
|
-
|
|
65
|
-
const result = await repository.deleteConnection('test-connection-123');
|
|
66
|
-
|
|
67
|
-
expect(result).toEqual({ acknowledged: true, deletedCount: 1 });
|
|
68
|
-
expect(prisma.websocketConnection.delete).toHaveBeenCalledWith({
|
|
69
|
-
where: { connectionId: 'test-connection-123' },
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
it('should handle connection not found', async () => {
|
|
74
|
-
const error = new Error('Record not found');
|
|
75
|
-
error.code = 'P2025';
|
|
76
|
-
prisma.websocketConnection.delete.mockRejectedValue(error);
|
|
77
|
-
|
|
78
|
-
const result = await repository.deleteConnection('nonexistent');
|
|
79
|
-
|
|
80
|
-
expect(result).toEqual({ acknowledged: true, deletedCount: 0 });
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
describe('getActiveConnections()', () => {
|
|
85
|
-
it('should return empty array if no WEBSOCKET_API_ENDPOINT', async () => {
|
|
86
|
-
delete process.env.WEBSOCKET_API_ENDPOINT;
|
|
87
|
-
|
|
88
|
-
const result = await repository.getActiveConnections();
|
|
89
|
-
|
|
90
|
-
expect(result).toEqual([]);
|
|
91
|
-
expect(prisma.websocketConnection.findMany).not.toHaveBeenCalled();
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('should get active connections with send capability', async () => {
|
|
95
|
-
prisma.websocketConnection.findMany.mockResolvedValue([
|
|
96
|
-
{ connectionId: 'conn-1' },
|
|
97
|
-
{ connectionId: 'conn-2' },
|
|
98
|
-
]);
|
|
99
|
-
|
|
100
|
-
apiGatewayMock.on(PostToConnectionCommand).resolves({});
|
|
101
|
-
|
|
102
|
-
const connections = await repository.getActiveConnections();
|
|
103
|
-
|
|
104
|
-
expect(connections).toHaveLength(2);
|
|
105
|
-
expect(connections[0].connectionId).toBe('conn-1');
|
|
106
|
-
expect(connections[1].connectionId).toBe('conn-2');
|
|
107
|
-
expect(typeof connections[0].send).toBe('function');
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
it('should send data through API Gateway Management API', async () => {
|
|
111
|
-
prisma.websocketConnection.findMany.mockResolvedValue([
|
|
112
|
-
{ connectionId: 'conn-test' },
|
|
113
|
-
]);
|
|
114
|
-
|
|
115
|
-
apiGatewayMock.on(PostToConnectionCommand).resolves({});
|
|
116
|
-
|
|
117
|
-
const connections = await repository.getActiveConnections();
|
|
118
|
-
await connections[0].send({ message: 'hello' });
|
|
119
|
-
|
|
120
|
-
expect(apiGatewayMock.calls()).toHaveLength(1);
|
|
121
|
-
|
|
122
|
-
const call = apiGatewayMock.call(0);
|
|
123
|
-
expect(call.args[0].input).toMatchObject({
|
|
124
|
-
ConnectionId: 'conn-test',
|
|
125
|
-
Data: JSON.stringify({ message: 'hello' }),
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('should delete stale connection on 410 error', async () => {
|
|
130
|
-
prisma.websocketConnection.findMany.mockResolvedValue([
|
|
131
|
-
{ connectionId: 'stale-conn' },
|
|
132
|
-
]);
|
|
133
|
-
|
|
134
|
-
const error = new Error('Gone');
|
|
135
|
-
error.statusCode = 410;
|
|
136
|
-
apiGatewayMock.on(PostToConnectionCommand).rejects(error);
|
|
137
|
-
|
|
138
|
-
prisma.websocketConnection.deleteMany.mockResolvedValue({ count: 1 });
|
|
139
|
-
|
|
140
|
-
const connections = await repository.getActiveConnections();
|
|
141
|
-
await connections[0].send({ message: 'test' });
|
|
142
|
-
|
|
143
|
-
// Should have called deleteMany to remove stale connection
|
|
144
|
-
expect(prisma.websocketConnection.deleteMany).toHaveBeenCalledWith({
|
|
145
|
-
where: { connectionId: 'stale-conn' },
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('should delete stale connection on 410 error (v3 metadata format)', async () => {
|
|
150
|
-
prisma.websocketConnection.findMany.mockResolvedValue([
|
|
151
|
-
{ connectionId: 'stale-conn' },
|
|
152
|
-
]);
|
|
153
|
-
|
|
154
|
-
const error = new Error('Gone');
|
|
155
|
-
error.$metadata = { httpStatusCode: 410 };
|
|
156
|
-
apiGatewayMock.on(PostToConnectionCommand).rejects(error);
|
|
157
|
-
|
|
158
|
-
prisma.websocketConnection.deleteMany.mockResolvedValue({ count: 1 });
|
|
159
|
-
|
|
160
|
-
const connections = await repository.getActiveConnections();
|
|
161
|
-
await connections[0].send({ message: 'test' });
|
|
162
|
-
|
|
163
|
-
expect(prisma.websocketConnection.deleteMany).toHaveBeenCalledWith({
|
|
164
|
-
where: { connectionId: 'stale-conn' },
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
it('should throw non-410 errors', async () => {
|
|
169
|
-
prisma.websocketConnection.findMany.mockResolvedValue([
|
|
170
|
-
{ connectionId: 'conn-1' },
|
|
171
|
-
]);
|
|
172
|
-
|
|
173
|
-
apiGatewayMock.on(PostToConnectionCommand).rejects(new Error('Network error'));
|
|
174
|
-
|
|
175
|
-
const connections = await repository.getActiveConnections();
|
|
176
|
-
|
|
177
|
-
await expect(connections[0].send({ message: 'test' })).rejects.toThrow('Network error');
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
describe('findConnection()', () => {
|
|
182
|
-
it('should find connection by connectionId', async () => {
|
|
183
|
-
const mockConnection = { id: '1', connectionId: 'conn-123' };
|
|
184
|
-
prisma.websocketConnection.findFirst.mockResolvedValue(mockConnection);
|
|
185
|
-
|
|
186
|
-
const result = await repository.findConnection('conn-123');
|
|
187
|
-
|
|
188
|
-
expect(result).toEqual(mockConnection);
|
|
189
|
-
expect(prisma.websocketConnection.findFirst).toHaveBeenCalledWith({
|
|
190
|
-
where: { connectionId: 'conn-123' },
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
it('should return null if not found', async () => {
|
|
195
|
-
prisma.websocketConnection.findFirst.mockResolvedValue(null);
|
|
196
|
-
|
|
197
|
-
const result = await repository.findConnection('nonexistent');
|
|
198
|
-
|
|
199
|
-
expect(result).toBeNull();
|
|
200
|
-
});
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
describe('getAllConnections()', () => {
|
|
204
|
-
it('should get all connections', async () => {
|
|
205
|
-
const mockConnections = [
|
|
206
|
-
{ id: '1', connectionId: 'conn-1' },
|
|
207
|
-
{ id: '2', connectionId: 'conn-2' },
|
|
208
|
-
];
|
|
209
|
-
prisma.websocketConnection.findMany.mockResolvedValue(mockConnections);
|
|
210
|
-
|
|
211
|
-
const result = await repository.getAllConnections();
|
|
212
|
-
|
|
213
|
-
expect(result).toEqual(mockConnections);
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
describe('deleteAllConnections()', () => {
|
|
218
|
-
it('should delete all connections', async () => {
|
|
219
|
-
prisma.websocketConnection.deleteMany.mockResolvedValue({ count: 5 });
|
|
220
|
-
|
|
221
|
-
const result = await repository.deleteAllConnections();
|
|
222
|
-
|
|
223
|
-
expect(result).toEqual({ acknowledged: true, deletedCount: 5 });
|
|
224
|
-
});
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
|