@friggframework/devtools 2.0.0--canary.517.35ee143.0 → 2.0.0--canary.524.06156322a.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 (147) hide show
  1. package/infrastructure/domains/shared/types/app-definition.js +0 -21
  2. package/infrastructure/domains/shared/utilities/base-definition-factory.js +15 -1
  3. package/infrastructure/infrastructure-composer.js +0 -2
  4. package/package.json +15 -7
  5. package/.eslintrc.json +0 -3
  6. package/CHANGELOG.md +0 -132
  7. package/infrastructure/domains/admin-scripts/admin-script-builder.js +0 -200
  8. package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +0 -499
  9. package/infrastructure/domains/admin-scripts/index.js +0 -5
  10. package/layers/prisma/.build-complete +0 -3
  11. package/layers/prisma/nodejs/package.json +0 -8
  12. package/management-ui/.eslintrc.js +0 -22
  13. package/management-ui/components.json +0 -21
  14. package/management-ui/docs/phase2-integration-guide.md +0 -320
  15. package/management-ui/index.html +0 -13
  16. package/management-ui/package.json +0 -76
  17. package/management-ui/packages/devtools/frigg-cli/ui-command/index.js +0 -302
  18. package/management-ui/postcss.config.js +0 -6
  19. package/management-ui/server/api/backend.js +0 -256
  20. package/management-ui/server/api/cli.js +0 -315
  21. package/management-ui/server/api/codegen.js +0 -663
  22. package/management-ui/server/api/connections.js +0 -857
  23. package/management-ui/server/api/discovery.js +0 -185
  24. package/management-ui/server/api/environment/index.js +0 -1
  25. package/management-ui/server/api/environment/router.js +0 -378
  26. package/management-ui/server/api/environment.js +0 -328
  27. package/management-ui/server/api/integrations.js +0 -876
  28. package/management-ui/server/api/logs.js +0 -248
  29. package/management-ui/server/api/monitoring.js +0 -282
  30. package/management-ui/server/api/open-ide.js +0 -31
  31. package/management-ui/server/api/project.js +0 -1029
  32. package/management-ui/server/api/users/sessions.js +0 -371
  33. package/management-ui/server/api/users/simulation.js +0 -254
  34. package/management-ui/server/api/users.js +0 -362
  35. package/management-ui/server/api-contract.md +0 -275
  36. package/management-ui/server/index.js +0 -873
  37. package/management-ui/server/middleware/errorHandler.js +0 -93
  38. package/management-ui/server/middleware/security.js +0 -32
  39. package/management-ui/server/processManager.js +0 -296
  40. package/management-ui/server/server.js +0 -346
  41. package/management-ui/server/services/aws-monitor.js +0 -413
  42. package/management-ui/server/services/npm-registry.js +0 -347
  43. package/management-ui/server/services/template-engine.js +0 -538
  44. package/management-ui/server/utils/cliIntegration.js +0 -220
  45. package/management-ui/server/utils/environment/auditLogger.js +0 -471
  46. package/management-ui/server/utils/environment/awsParameterStore.js +0 -275
  47. package/management-ui/server/utils/environment/encryption.js +0 -278
  48. package/management-ui/server/utils/environment/envFileManager.js +0 -286
  49. package/management-ui/server/utils/import-commonjs.js +0 -28
  50. package/management-ui/server/utils/response.js +0 -83
  51. package/management-ui/server/websocket/handler.js +0 -325
  52. package/management-ui/src/App.jsx +0 -25
  53. package/management-ui/src/assets/FriggLogo.svg +0 -1
  54. package/management-ui/src/components/AppRouter.jsx +0 -65
  55. package/management-ui/src/components/Button.jsx +0 -70
  56. package/management-ui/src/components/Card.jsx +0 -97
  57. package/management-ui/src/components/EnvironmentCompare.jsx +0 -400
  58. package/management-ui/src/components/EnvironmentEditor.jsx +0 -372
  59. package/management-ui/src/components/EnvironmentImportExport.jsx +0 -469
  60. package/management-ui/src/components/EnvironmentSchema.jsx +0 -491
  61. package/management-ui/src/components/EnvironmentSecurity.jsx +0 -463
  62. package/management-ui/src/components/ErrorBoundary.jsx +0 -73
  63. package/management-ui/src/components/IntegrationCard.jsx +0 -481
  64. package/management-ui/src/components/IntegrationCardEnhanced.jsx +0 -770
  65. package/management-ui/src/components/IntegrationExplorer.jsx +0 -379
  66. package/management-ui/src/components/IntegrationStatus.jsx +0 -336
  67. package/management-ui/src/components/Layout.jsx +0 -716
  68. package/management-ui/src/components/LoadingSpinner.jsx +0 -113
  69. package/management-ui/src/components/RepositoryPicker.jsx +0 -248
  70. package/management-ui/src/components/SessionMonitor.jsx +0 -350
  71. package/management-ui/src/components/StatusBadge.jsx +0 -208
  72. package/management-ui/src/components/UserContextSwitcher.jsx +0 -212
  73. package/management-ui/src/components/UserSimulation.jsx +0 -327
  74. package/management-ui/src/components/Welcome.jsx +0 -434
  75. package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +0 -637
  76. package/management-ui/src/components/codegen/APIModuleSelector.jsx +0 -227
  77. package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +0 -247
  78. package/management-ui/src/components/codegen/CodePreviewEditor.jsx +0 -316
  79. package/management-ui/src/components/codegen/DynamicModuleForm.jsx +0 -271
  80. package/management-ui/src/components/codegen/FormBuilder.jsx +0 -737
  81. package/management-ui/src/components/codegen/IntegrationGenerator.jsx +0 -855
  82. package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +0 -797
  83. package/management-ui/src/components/codegen/SchemaBuilder.jsx +0 -303
  84. package/management-ui/src/components/codegen/TemplateSelector.jsx +0 -586
  85. package/management-ui/src/components/codegen/index.js +0 -10
  86. package/management-ui/src/components/connections/ConnectionConfigForm.jsx +0 -362
  87. package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +0 -182
  88. package/management-ui/src/components/connections/ConnectionTester.jsx +0 -200
  89. package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +0 -292
  90. package/management-ui/src/components/connections/OAuthFlow.jsx +0 -204
  91. package/management-ui/src/components/connections/index.js +0 -5
  92. package/management-ui/src/components/index.js +0 -21
  93. package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +0 -222
  94. package/management-ui/src/components/monitoring/LambdaMetrics.jsx +0 -169
  95. package/management-ui/src/components/monitoring/MetricsChart.jsx +0 -197
  96. package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +0 -393
  97. package/management-ui/src/components/monitoring/SQSMetrics.jsx +0 -246
  98. package/management-ui/src/components/monitoring/index.js +0 -6
  99. package/management-ui/src/components/monitoring/monitoring.css +0 -218
  100. package/management-ui/src/components/theme-provider.jsx +0 -52
  101. package/management-ui/src/components/theme-toggle.jsx +0 -39
  102. package/management-ui/src/components/ui/badge.tsx +0 -36
  103. package/management-ui/src/components/ui/button.test.jsx +0 -56
  104. package/management-ui/src/components/ui/button.tsx +0 -57
  105. package/management-ui/src/components/ui/card.tsx +0 -76
  106. package/management-ui/src/components/ui/dropdown-menu.tsx +0 -199
  107. package/management-ui/src/components/ui/select.tsx +0 -157
  108. package/management-ui/src/components/ui/skeleton.jsx +0 -15
  109. package/management-ui/src/hooks/useFrigg.jsx +0 -387
  110. package/management-ui/src/hooks/useSocket.jsx +0 -58
  111. package/management-ui/src/index.css +0 -193
  112. package/management-ui/src/lib/utils.ts +0 -6
  113. package/management-ui/src/main.jsx +0 -10
  114. package/management-ui/src/pages/CodeGeneration.jsx +0 -14
  115. package/management-ui/src/pages/Connections.jsx +0 -252
  116. package/management-ui/src/pages/ConnectionsEnhanced.jsx +0 -633
  117. package/management-ui/src/pages/Dashboard.jsx +0 -311
  118. package/management-ui/src/pages/Environment.jsx +0 -314
  119. package/management-ui/src/pages/IntegrationConfigure.jsx +0 -669
  120. package/management-ui/src/pages/IntegrationDiscovery.jsx +0 -567
  121. package/management-ui/src/pages/IntegrationTest.jsx +0 -742
  122. package/management-ui/src/pages/Integrations.jsx +0 -253
  123. package/management-ui/src/pages/Monitoring.jsx +0 -17
  124. package/management-ui/src/pages/Simulation.jsx +0 -155
  125. package/management-ui/src/pages/Users.jsx +0 -492
  126. package/management-ui/src/services/api.js +0 -41
  127. package/management-ui/src/services/apiModuleService.js +0 -193
  128. package/management-ui/src/services/websocket-handlers.js +0 -120
  129. package/management-ui/src/test/api/project.test.js +0 -273
  130. package/management-ui/src/test/components/Welcome.test.jsx +0 -378
  131. package/management-ui/src/test/mocks/server.js +0 -178
  132. package/management-ui/src/test/setup.js +0 -61
  133. package/management-ui/src/test/utils/test-utils.jsx +0 -134
  134. package/management-ui/src/utils/repository.js +0 -98
  135. package/management-ui/src/utils/repository.test.js +0 -118
  136. package/management-ui/src/workflows/phase2-integration-workflows.js +0 -884
  137. package/management-ui/tailwind.config.js +0 -63
  138. package/management-ui/tsconfig.json +0 -37
  139. package/management-ui/tsconfig.node.json +0 -10
  140. package/management-ui/vite.config.js +0 -26
  141. package/management-ui/vitest.config.js +0 -38
  142. package/test/auther-definition-method-tester.js +0 -45
  143. package/test/index.js +0 -9
  144. package/test/integration-validator.js +0 -2
  145. package/test/mock-api-readme.md +0 -102
  146. package/test/mock-api.js +0 -284
  147. package/test/mock-integration.js +0 -78
@@ -1,499 +0,0 @@
1
- /**
2
- * Tests for Admin Script Builder
3
- *
4
- * Tests admin script infrastructure generation including:
5
- * - SQS queue for script execution
6
- * - Lambda executor function
7
- * - Lambda router function with HTTP routes
8
- * - EventBridge Scheduler resources (optional)
9
- */
10
-
11
- const { AdminScriptBuilder } = require('./admin-script-builder');
12
- const { ValidationResult } = require('../shared/base-builder');
13
-
14
- describe('AdminScriptBuilder', () => {
15
- let adminScriptBuilder;
16
-
17
- beforeEach(() => {
18
- adminScriptBuilder = new AdminScriptBuilder();
19
- });
20
-
21
- describe('shouldExecute()', () => {
22
- it('should return false when no adminScripts', () => {
23
- const appDefinition = {};
24
-
25
- expect(adminScriptBuilder.shouldExecute(appDefinition)).toBe(false);
26
- });
27
-
28
- it('should return false when adminScripts is empty array', () => {
29
- const appDefinition = {
30
- adminScripts: [],
31
- };
32
-
33
- expect(adminScriptBuilder.shouldExecute(appDefinition)).toBe(false);
34
- });
35
-
36
- it('should return true when adminScripts has items', () => {
37
- const appDefinition = {
38
- adminScripts: [
39
- { Definition: { name: 'test-script' } },
40
- ],
41
- };
42
-
43
- expect(adminScriptBuilder.shouldExecute(appDefinition)).toBe(true);
44
- });
45
-
46
- it('should return false when adminScripts is not an array', () => {
47
- const appDefinition = {
48
- adminScripts: { name: 'test' },
49
- };
50
-
51
- expect(adminScriptBuilder.shouldExecute(appDefinition)).toBe(false);
52
- });
53
- });
54
-
55
- describe('getDependencies()', () => {
56
- it('should have no dependencies', () => {
57
- const deps = adminScriptBuilder.getDependencies();
58
-
59
- expect(deps).toEqual([]);
60
- });
61
- });
62
-
63
- describe('validate()', () => {
64
- it('should pass validation with valid adminScripts', () => {
65
- const appDefinition = {
66
- adminScripts: [
67
- { Definition: { name: 'oauth-refresh' } },
68
- { Definition: { name: 'health-check' } },
69
- ],
70
- };
71
-
72
- const result = adminScriptBuilder.validate(appDefinition);
73
-
74
- expect(result).toBeInstanceOf(ValidationResult);
75
- expect(result.valid).toBe(true);
76
- expect(result.errors).toEqual([]);
77
- });
78
-
79
- it('should pass when adminScripts is undefined', () => {
80
- const appDefinition = {};
81
-
82
- const result = adminScriptBuilder.validate(appDefinition);
83
-
84
- expect(result.valid).toBe(true);
85
- });
86
-
87
- it('should fail when adminScripts is not an array', () => {
88
- const appDefinition = {
89
- adminScripts: 'invalid',
90
- };
91
-
92
- const result = adminScriptBuilder.validate(appDefinition);
93
-
94
- expect(result.valid).toBe(false);
95
- expect(result.errors).toContain('adminScripts must be an array');
96
- });
97
-
98
- it('should fail when script missing Definition.name', () => {
99
- const appDefinition = {
100
- adminScripts: [
101
- { Definition: {} },
102
- ],
103
- };
104
-
105
- const result = adminScriptBuilder.validate(appDefinition);
106
-
107
- expect(result.valid).toBe(false);
108
- expect(result.errors).toContain(
109
- 'Admin script at index 0 is missing Definition or name'
110
- );
111
- });
112
-
113
- it('should fail when script missing Definition', () => {
114
- const appDefinition = {
115
- adminScripts: [
116
- { someOtherField: 'value' },
117
- ],
118
- };
119
-
120
- const result = adminScriptBuilder.validate(appDefinition);
121
-
122
- expect(result.valid).toBe(false);
123
- expect(result.errors).toContain(
124
- 'Admin script at index 0 is missing Definition or name'
125
- );
126
- });
127
-
128
- it('should validate all scripts', () => {
129
- const appDefinition = {
130
- adminScripts: [
131
- { Definition: { name: 'valid' } },
132
- { Definition: {} }, // Invalid - no name
133
- { someField: 'value' }, // Invalid - no Definition
134
- ],
135
- };
136
-
137
- const result = adminScriptBuilder.validate(appDefinition);
138
-
139
- expect(result.valid).toBe(false);
140
- expect(result.errors).toHaveLength(2);
141
- });
142
- });
143
-
144
- describe('build()', () => {
145
- it('should create AdminScriptQueue resource', async () => {
146
- const appDefinition = {
147
- adminScripts: [
148
- { Definition: { name: 'test-script' } },
149
- ],
150
- };
151
-
152
- const result = await adminScriptBuilder.build(appDefinition, {});
153
-
154
- expect(result.resources.AdminScriptQueue).toBeDefined();
155
- expect(result.resources.AdminScriptQueue.Type).toBe('AWS::SQS::Queue');
156
- });
157
-
158
- it('should configure AdminScriptQueue with correct retention and timeout', async () => {
159
- const appDefinition = {
160
- adminScripts: [
161
- { Definition: { name: 'test-script' } },
162
- ],
163
- };
164
-
165
- const result = await adminScriptBuilder.build(appDefinition, {});
166
-
167
- expect(result.resources.AdminScriptQueue.Properties.MessageRetentionPeriod).toBe(86400); // 1 day
168
- expect(result.resources.AdminScriptQueue.Properties.VisibilityTimeout).toBe(900); // 15 minutes
169
- });
170
-
171
- it('should configure AdminScriptQueue redrive policy to InternalErrorQueue', async () => {
172
- const appDefinition = {
173
- adminScripts: [
174
- { Definition: { name: 'test-script' } },
175
- ],
176
- };
177
-
178
- const result = await adminScriptBuilder.build(appDefinition, {});
179
-
180
- expect(result.resources.AdminScriptQueue.Properties.RedrivePolicy).toEqual({
181
- maxReceiveCount: 3,
182
- deadLetterTargetArn: {
183
- 'Fn::GetAtt': ['InternalErrorQueue', 'Arn'],
184
- },
185
- });
186
- });
187
-
188
- it('should add ADMIN_SCRIPT_QUEUE_URL to environment variables', async () => {
189
- const appDefinition = {
190
- adminScripts: [
191
- { Definition: { name: 'test-script' } },
192
- ],
193
- };
194
-
195
- const result = await adminScriptBuilder.build(appDefinition, {});
196
-
197
- expect(result.environment.ADMIN_SCRIPT_QUEUE_URL).toEqual({
198
- Ref: 'AdminScriptQueue',
199
- });
200
- });
201
-
202
- it('should create adminScriptExecutor function', async () => {
203
- const appDefinition = {
204
- adminScripts: [
205
- { Definition: { name: 'test-script' } },
206
- ],
207
- };
208
-
209
- const result = await adminScriptBuilder.build(appDefinition, {});
210
-
211
- expect(result.functions.adminScriptExecutor).toBeDefined();
212
- expect(result.functions.adminScriptExecutor.handler).toBe(
213
- 'node_modules/@friggframework/admin-scripts/src/infrastructure/script-executor-handler.handler'
214
- );
215
- });
216
-
217
- it('should configure adminScriptExecutor with SQS event', async () => {
218
- const appDefinition = {
219
- adminScripts: [
220
- { Definition: { name: 'test-script' } },
221
- ],
222
- };
223
-
224
- const result = await adminScriptBuilder.build(appDefinition, {});
225
-
226
- expect(result.functions.adminScriptExecutor.events).toEqual([
227
- {
228
- sqs: {
229
- arn: { 'Fn::GetAtt': ['AdminScriptQueue', 'Arn'] },
230
- batchSize: 1,
231
- },
232
- },
233
- ]);
234
- });
235
-
236
- it('should set adminScriptExecutor timeout to 900 seconds', async () => {
237
- const appDefinition = {
238
- adminScripts: [
239
- { Definition: { name: 'test-script' } },
240
- ],
241
- };
242
-
243
- const result = await adminScriptBuilder.build(appDefinition, {});
244
-
245
- expect(result.functions.adminScriptExecutor.timeout).toBe(900); // 15 minutes (Lambda max)
246
- });
247
-
248
- it('should set adminScriptExecutor memory size', async () => {
249
- const appDefinition = {
250
- adminScripts: [
251
- { Definition: { name: 'test-script' } },
252
- ],
253
- };
254
-
255
- const result = await adminScriptBuilder.build(appDefinition, {});
256
-
257
- expect(result.functions.adminScriptExecutor.memorySize).toBe(1024);
258
- });
259
-
260
- it('should attach Prisma layer to adminScriptExecutor', async () => {
261
- const appDefinition = {
262
- adminScripts: [
263
- { Definition: { name: 'test-script' } },
264
- ],
265
- };
266
-
267
- const result = await adminScriptBuilder.build(appDefinition, {});
268
-
269
- expect(result.functions.adminScriptExecutor.layers).toEqual([
270
- { Ref: 'PrismaLambdaLayer' }
271
- ]);
272
- });
273
-
274
- it('should create adminScriptRouter function', async () => {
275
- const appDefinition = {
276
- adminScripts: [
277
- { Definition: { name: 'test-script' } },
278
- ],
279
- };
280
-
281
- const result = await adminScriptBuilder.build(appDefinition, {});
282
-
283
- expect(result.functions.adminScriptRouter).toBeDefined();
284
- expect(result.functions.adminScriptRouter.handler).toBe(
285
- 'node_modules/@friggframework/admin-scripts/src/infrastructure/admin-script-router.handler'
286
- );
287
- });
288
-
289
- it('should configure adminScriptRouter with correct HTTP routes', async () => {
290
- const appDefinition = {
291
- adminScripts: [
292
- { Definition: { name: 'test-script' } },
293
- ],
294
- };
295
-
296
- const result = await adminScriptBuilder.build(appDefinition, {});
297
-
298
- expect(result.functions.adminScriptRouter.events).toEqual([
299
- // List scripts
300
- { httpApi: { path: '/admin/scripts', method: 'GET' } },
301
- // Get script details
302
- { httpApi: { path: '/admin/scripts/{scriptName}', method: 'GET' } },
303
- // Execute script (sync or async)
304
- { httpApi: { path: '/admin/scripts/{scriptName}/execute', method: 'POST' } },
305
- // Get execution status
306
- { httpApi: { path: '/admin/executions/{executionId}', method: 'GET' } },
307
- // List executions
308
- { httpApi: { path: '/admin/executions', method: 'GET' } },
309
- // Schedule management (Phase 2)
310
- { httpApi: { path: '/admin/scripts/{scriptName}/schedule', method: 'GET' } },
311
- { httpApi: { path: '/admin/scripts/{scriptName}/schedule', method: 'PUT' } },
312
- { httpApi: { path: '/admin/scripts/{scriptName}/schedule', method: 'DELETE' } },
313
- ]);
314
- });
315
-
316
- it('should set adminScriptRouter timeout to 30 seconds', async () => {
317
- const appDefinition = {
318
- adminScripts: [
319
- { Definition: { name: 'test-script' } },
320
- ],
321
- };
322
-
323
- const result = await adminScriptBuilder.build(appDefinition, {});
324
-
325
- expect(result.functions.adminScriptRouter.timeout).toBe(30);
326
- });
327
-
328
- it('should attach Prisma layer to adminScriptRouter', async () => {
329
- const appDefinition = {
330
- adminScripts: [
331
- { Definition: { name: 'test-script' } },
332
- ],
333
- };
334
-
335
- const result = await adminScriptBuilder.build(appDefinition, {});
336
-
337
- expect(result.functions.adminScriptRouter.layers).toEqual([
338
- { Ref: 'PrismaLambdaLayer' }
339
- ]);
340
- });
341
-
342
- it('should create scheduler resources when admin.enableScheduling is true', async () => {
343
- const appDefinition = {
344
- adminScripts: [
345
- { Definition: { name: 'test-script' } },
346
- ],
347
- admin: {
348
- enableScheduling: true,
349
- },
350
- };
351
-
352
- const result = await adminScriptBuilder.build(appDefinition, {});
353
-
354
- // Check for scheduler IAM role
355
- expect(result.resources.AdminScriptSchedulerRole).toBeDefined();
356
- expect(result.resources.AdminScriptSchedulerRole.Type).toBe('AWS::IAM::Role');
357
-
358
- // Check for schedule group
359
- expect(result.resources.AdminScriptScheduleGroup).toBeDefined();
360
- expect(result.resources.AdminScriptScheduleGroup.Type).toBe('AWS::Scheduler::ScheduleGroup');
361
-
362
- // Check for environment variables
363
- expect(result.environment.SCHEDULER_ROLE_ARN).toEqual({
364
- 'Fn::GetAtt': ['AdminScriptSchedulerRole', 'Arn'],
365
- });
366
- expect(result.environment.SCHEDULE_GROUP_NAME).toEqual({
367
- Ref: 'AdminScriptScheduleGroup',
368
- });
369
- });
370
-
371
- it('should not create scheduler resources when enableScheduling is false', async () => {
372
- const appDefinition = {
373
- adminScripts: [
374
- { Definition: { name: 'test-script' } },
375
- ],
376
- admin: {
377
- enableScheduling: false,
378
- },
379
- };
380
-
381
- const result = await adminScriptBuilder.build(appDefinition, {});
382
-
383
- expect(result.resources.AdminScriptSchedulerRole).toBeUndefined();
384
- expect(result.resources.AdminScriptScheduleGroup).toBeUndefined();
385
- expect(result.environment.SCHEDULER_ROLE_ARN).toBeUndefined();
386
- expect(result.environment.SCHEDULE_GROUP_NAME).toBeUndefined();
387
- });
388
-
389
- it('should not create scheduler resources when admin config is not provided', async () => {
390
- const appDefinition = {
391
- adminScripts: [
392
- { Definition: { name: 'test-script' } },
393
- ],
394
- };
395
-
396
- const result = await adminScriptBuilder.build(appDefinition, {});
397
-
398
- expect(result.resources.AdminScriptSchedulerRole).toBeUndefined();
399
- expect(result.resources.AdminScriptScheduleGroup).toBeUndefined();
400
- });
401
-
402
- it('should use skipEsbuild for all functions', async () => {
403
- const appDefinition = {
404
- adminScripts: [
405
- { Definition: { name: 'test-script' } },
406
- ],
407
- };
408
-
409
- const result = await adminScriptBuilder.build(appDefinition, {});
410
-
411
- expect(result.functions.adminScriptExecutor.skipEsbuild).toBe(true);
412
- expect(result.functions.adminScriptRouter.skipEsbuild).toBe(true);
413
- });
414
-
415
- it('should not attach Prisma layer when usePrismaLambdaLayer=false', async () => {
416
- const appDefinition = {
417
- usePrismaLambdaLayer: false,
418
- adminScripts: [
419
- { Definition: { name: 'test-script' } },
420
- ],
421
- };
422
-
423
- const result = await adminScriptBuilder.build(appDefinition, {});
424
-
425
- expect(result.functions.adminScriptExecutor.layers).toBeUndefined();
426
- expect(result.functions.adminScriptRouter.layers).toBeUndefined();
427
- });
428
-
429
- it('should handle multiple admin scripts', async () => {
430
- const appDefinition = {
431
- adminScripts: [
432
- { Definition: { name: 'oauth-refresh' } },
433
- { Definition: { name: 'health-check' } },
434
- { Definition: { name: 'attio-healing' } },
435
- ],
436
- };
437
-
438
- const result = await adminScriptBuilder.build(appDefinition, {});
439
-
440
- // Should still only create one queue and two functions
441
- expect(result.resources.AdminScriptQueue).toBeDefined();
442
- expect(result.functions.adminScriptExecutor).toBeDefined();
443
- expect(result.functions.adminScriptRouter).toBeDefined();
444
-
445
- // Should not create separate resources per script
446
- expect(Object.keys(result.resources)).toHaveLength(1); // Only AdminScriptQueue
447
- expect(Object.keys(result.functions)).toHaveLength(2); // Only executor and router
448
- });
449
-
450
- it('should configure scheduler role with correct trust policy', async () => {
451
- const appDefinition = {
452
- adminScripts: [
453
- { Definition: { name: 'test-script' } },
454
- ],
455
- admin: {
456
- enableScheduling: true,
457
- },
458
- };
459
-
460
- const result = await adminScriptBuilder.build(appDefinition, {});
461
-
462
- const trustPolicy = result.resources.AdminScriptSchedulerRole.Properties.AssumeRolePolicyDocument;
463
-
464
- expect(trustPolicy.Statement[0]).toEqual({
465
- Effect: 'Allow',
466
- Principal: { Service: 'scheduler.amazonaws.com' },
467
- Action: 'sts:AssumeRole',
468
- });
469
- });
470
-
471
- it('should configure scheduler role with Lambda invoke permission', async () => {
472
- const appDefinition = {
473
- adminScripts: [
474
- { Definition: { name: 'test-script' } },
475
- ],
476
- admin: {
477
- enableScheduling: true,
478
- },
479
- };
480
-
481
- const result = await adminScriptBuilder.build(appDefinition, {});
482
-
483
- const policies = result.resources.AdminScriptSchedulerRole.Properties.Policies;
484
-
485
- expect(policies[0].PolicyName).toBe('InvokeLambda');
486
- expect(policies[0].PolicyDocument.Statement[0]).toEqual({
487
- Effect: 'Allow',
488
- Action: 'lambda:InvokeFunction',
489
- Resource: { 'Fn::GetAtt': ['AdminScriptExecutorLambdaFunction', 'Arn'] },
490
- });
491
- });
492
- });
493
-
494
- describe('getName()', () => {
495
- it('should return AdminScriptBuilder', () => {
496
- expect(adminScriptBuilder.getName()).toBe('AdminScriptBuilder');
497
- });
498
- });
499
- });
@@ -1,5 +0,0 @@
1
- const { AdminScriptBuilder } = require('./admin-script-builder');
2
-
3
- module.exports = {
4
- AdminScriptBuilder
5
- };
@@ -1,3 +0,0 @@
1
- Build completed: 2025-11-17T22:06:29.204Z
2
- Node: v20.12.1
3
- Platform: darwin
@@ -1,8 +0,0 @@
1
- {
2
- "name": "prisma-lambda-layer",
3
- "version": "1.0.0",
4
- "private": true,
5
- "dependencies": {
6
- "@prisma/client": "^6.16.3"
7
- }
8
- }
@@ -1,22 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- env: { browser: true, es2020: true },
4
- extends: [
5
- 'eslint:recommended',
6
- '@eslint/js/recommended',
7
- 'plugin:react/recommended',
8
- 'plugin:react/jsx-runtime',
9
- 'plugin:react-hooks/recommended',
10
- ],
11
- ignorePatterns: ['dist', '.eslintrc.js'],
12
- parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
13
- settings: { react: { version: '18.3' } },
14
- plugins: ['react-refresh'],
15
- rules: {
16
- 'react/jsx-no-target-blank': 'off',
17
- 'react-refresh/only-export-components': [
18
- 'warn',
19
- { allowConstantExport: true },
20
- ],
21
- },
22
- }
@@ -1,21 +0,0 @@
1
- {
2
- "$schema": "https://ui.shadcn.com/schema.json",
3
- "style": "new-york",
4
- "rsc": false,
5
- "tsx": true,
6
- "tailwind": {
7
- "config": "tailwind.config.js",
8
- "css": "src/index.css",
9
- "baseColor": "neutral",
10
- "cssVariables": true,
11
- "prefix": ""
12
- },
13
- "aliases": {
14
- "components": "@/components",
15
- "utils": "@/lib/utils",
16
- "ui": "@/components/ui",
17
- "lib": "@/lib",
18
- "hooks": "@/hooks"
19
- },
20
- "iconLibrary": "lucide"
21
- }