@friggframework/devtools 2.0.0--canary.545.ae2019f.0 → 2.0.0--canary.549.a579cca.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 (127) hide show
  1. package/frigg-cli/README.md +1 -1
  2. package/frigg-cli/__tests__/unit/commands/build.test.js +1 -1
  3. package/frigg-cli/__tests__/unit/commands/doctor.test.js +2 -0
  4. package/frigg-cli/__tests__/unit/commands/install.test.js +19 -23
  5. package/frigg-cli/__tests__/unit/dependencies.test.js +2 -2
  6. package/frigg-cli/build-command/index.js +11 -123
  7. package/frigg-cli/deploy-command/index.js +1 -83
  8. package/frigg-cli/doctor-command/index.js +16 -37
  9. package/frigg-cli/generate-iam-command.js +1 -21
  10. package/frigg-cli/index.js +6 -21
  11. package/frigg-cli/index.test.js +2 -7
  12. package/frigg-cli/init-command/backend-first-handler.js +42 -124
  13. package/frigg-cli/init-command/index.js +1 -2
  14. package/frigg-cli/init-command/template-handler.js +3 -13
  15. package/frigg-cli/install-command/backend-js.js +3 -3
  16. package/frigg-cli/install-command/environment-variables.js +19 -16
  17. package/frigg-cli/install-command/environment-variables.test.js +13 -12
  18. package/frigg-cli/install-command/index.js +9 -14
  19. package/frigg-cli/install-command/integration-file.js +3 -3
  20. package/frigg-cli/install-command/logger.js +12 -0
  21. package/frigg-cli/install-command/validate-package.js +9 -5
  22. package/frigg-cli/jest.config.js +1 -4
  23. package/frigg-cli/repair-command/index.js +128 -121
  24. package/frigg-cli/start-command/index.js +2 -324
  25. package/frigg-cli/ui-command/index.js +36 -58
  26. package/frigg-cli/utils/repo-detection.js +37 -85
  27. package/infrastructure/create-frigg-infrastructure.js +0 -93
  28. package/infrastructure/docs/iam-policy-templates.md +1 -1
  29. package/infrastructure/domains/networking/vpc-builder.test.js +4 -2
  30. package/infrastructure/domains/networking/vpc-resolver.test.js +1 -1
  31. package/infrastructure/domains/shared/resource-discovery.js +5 -5
  32. package/infrastructure/domains/shared/types/app-definition.js +0 -21
  33. package/infrastructure/domains/shared/types/discovery-result.test.js +1 -1
  34. package/infrastructure/domains/shared/utilities/base-definition-factory.js +1 -10
  35. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +2 -2
  36. package/infrastructure/infrastructure-composer.js +0 -2
  37. package/infrastructure/infrastructure-composer.test.js +2 -2
  38. package/management-ui/README.md +109 -245
  39. package/package.json +7 -8
  40. package/frigg-cli/__tests__/application/use-cases/AddApiModuleToIntegrationUseCase.test.js +0 -326
  41. package/frigg-cli/__tests__/application/use-cases/CreateApiModuleUseCase.test.js +0 -337
  42. package/frigg-cli/__tests__/domain/entities/ApiModule.test.js +0 -373
  43. package/frigg-cli/__tests__/domain/entities/AppDefinition.test.js +0 -313
  44. package/frigg-cli/__tests__/domain/services/IntegrationValidator.test.js +0 -269
  45. package/frigg-cli/__tests__/domain/value-objects/IntegrationName.test.js +0 -82
  46. package/frigg-cli/__tests__/infrastructure/adapters/IntegrationJsUpdater.test.js +0 -408
  47. package/frigg-cli/__tests__/infrastructure/repositories/FileSystemApiModuleRepository.test.js +0 -583
  48. package/frigg-cli/__tests__/infrastructure/repositories/FileSystemAppDefinitionRepository.test.js +0 -314
  49. package/frigg-cli/__tests__/infrastructure/repositories/FileSystemIntegrationRepository.test.js +0 -383
  50. package/frigg-cli/__tests__/unit/commands/init.test.js +0 -406
  51. package/frigg-cli/__tests__/unit/commands/provider-dispatch.test.js +0 -383
  52. package/frigg-cli/__tests__/unit/commands/repair.test.js +0 -275
  53. package/frigg-cli/__tests__/unit/start-command/application/RunPreflightChecksUseCase.test.js +0 -411
  54. package/frigg-cli/__tests__/unit/start-command/infrastructure/DatabaseAdapter.test.js +0 -405
  55. package/frigg-cli/__tests__/unit/start-command/infrastructure/DockerAdapter.test.js +0 -496
  56. package/frigg-cli/__tests__/unit/start-command/presentation/InteractivePromptAdapter.test.js +0 -474
  57. package/frigg-cli/__tests__/unit/utils/output.test.js +0 -196
  58. package/frigg-cli/application/use-cases/AddApiModuleToIntegrationUseCase.js +0 -93
  59. package/frigg-cli/application/use-cases/CreateApiModuleUseCase.js +0 -93
  60. package/frigg-cli/application/use-cases/CreateIntegrationUseCase.js +0 -103
  61. package/frigg-cli/container.js +0 -172
  62. package/frigg-cli/docs/OUTPUT_MIGRATION_GUIDE.md +0 -286
  63. package/frigg-cli/domain/entities/ApiModule.js +0 -272
  64. package/frigg-cli/domain/entities/AppDefinition.js +0 -227
  65. package/frigg-cli/domain/entities/Integration.js +0 -198
  66. package/frigg-cli/domain/exceptions/DomainException.js +0 -24
  67. package/frigg-cli/domain/ports/IApiModuleRepository.js +0 -53
  68. package/frigg-cli/domain/ports/IAppDefinitionRepository.js +0 -43
  69. package/frigg-cli/domain/ports/IIntegrationRepository.js +0 -61
  70. package/frigg-cli/domain/services/IntegrationValidator.js +0 -185
  71. package/frigg-cli/domain/value-objects/IntegrationId.js +0 -42
  72. package/frigg-cli/domain/value-objects/IntegrationName.js +0 -60
  73. package/frigg-cli/domain/value-objects/SemanticVersion.js +0 -70
  74. package/frigg-cli/infrastructure/UnitOfWork.js +0 -46
  75. package/frigg-cli/infrastructure/adapters/BackendJsUpdater.js +0 -197
  76. package/frigg-cli/infrastructure/adapters/FileSystemAdapter.js +0 -224
  77. package/frigg-cli/infrastructure/adapters/IntegrationJsUpdater.js +0 -249
  78. package/frigg-cli/infrastructure/adapters/SchemaValidator.js +0 -92
  79. package/frigg-cli/infrastructure/repositories/FileSystemApiModuleRepository.js +0 -373
  80. package/frigg-cli/infrastructure/repositories/FileSystemAppDefinitionRepository.js +0 -116
  81. package/frigg-cli/infrastructure/repositories/FileSystemIntegrationRepository.js +0 -277
  82. package/frigg-cli/package-lock.json +0 -16226
  83. package/frigg-cli/start-command/application/RunPreflightChecksUseCase.js +0 -376
  84. package/frigg-cli/start-command/infrastructure/DatabaseAdapter.js +0 -591
  85. package/frigg-cli/start-command/infrastructure/DockerAdapter.js +0 -306
  86. package/frigg-cli/start-command/presentation/InteractivePromptAdapter.js +0 -329
  87. package/frigg-cli/templates/backend/.env.example +0 -62
  88. package/frigg-cli/templates/backend/.eslintrc.json +0 -12
  89. package/frigg-cli/templates/backend/.prettierrc +0 -6
  90. package/frigg-cli/templates/backend/docker-compose.yml +0 -22
  91. package/frigg-cli/templates/backend/index.js +0 -96
  92. package/frigg-cli/templates/backend/infrastructure.js +0 -12
  93. package/frigg-cli/templates/backend/jest.config.js +0 -17
  94. package/frigg-cli/templates/backend/package.json +0 -50
  95. package/frigg-cli/templates/backend/src/api-modules/.gitkeep +0 -10
  96. package/frigg-cli/templates/backend/src/base/.gitkeep +0 -7
  97. package/frigg-cli/templates/backend/src/integrations/.gitkeep +0 -10
  98. package/frigg-cli/templates/backend/src/integrations/ExampleIntegration.js +0 -65
  99. package/frigg-cli/templates/backend/src/utils/.gitkeep +0 -7
  100. package/frigg-cli/templates/backend/test/setup.js +0 -30
  101. package/frigg-cli/templates/backend/ui-extensions/.gitkeep +0 -0
  102. package/frigg-cli/templates/backend/ui-extensions/README.md +0 -77
  103. package/frigg-cli/utils/__tests__/provider-helper.test.js +0 -55
  104. package/frigg-cli/utils/__tests__/repo-detection.test.js +0 -436
  105. package/frigg-cli/utils/output.js +0 -382
  106. package/frigg-cli/utils/provider-helper.js +0 -75
  107. package/frigg-cli/validate-command/__tests__/adapters/validate-command.test.js +0 -205
  108. package/frigg-cli/validate-command/__tests__/application/validate-app-use-case.test.js +0 -104
  109. package/frigg-cli/validate-command/__tests__/domain/fix-suggestion.test.js +0 -153
  110. package/frigg-cli/validate-command/__tests__/domain/validation-error.test.js +0 -162
  111. package/frigg-cli/validate-command/__tests__/domain/validation-result.test.js +0 -152
  112. package/frigg-cli/validate-command/__tests__/infrastructure/api-module-validator.test.js +0 -332
  113. package/frigg-cli/validate-command/__tests__/infrastructure/app-definition-validator.test.js +0 -191
  114. package/frigg-cli/validate-command/__tests__/infrastructure/integration-class-validator.test.js +0 -146
  115. package/frigg-cli/validate-command/__tests__/infrastructure/template-validation.test.js +0 -155
  116. package/frigg-cli/validate-command/adapters/cli/validate-command.js +0 -199
  117. package/frigg-cli/validate-command/application/use-cases/validate-app-use-case.js +0 -35
  118. package/frigg-cli/validate-command/domain/entities/validation-result.js +0 -74
  119. package/frigg-cli/validate-command/domain/value-objects/fix-suggestion.js +0 -74
  120. package/frigg-cli/validate-command/domain/value-objects/validation-error.js +0 -68
  121. package/frigg-cli/validate-command/infrastructure/validators/api-module-validator.js +0 -181
  122. package/frigg-cli/validate-command/infrastructure/validators/app-definition-validator.js +0 -128
  123. package/frigg-cli/validate-command/infrastructure/validators/integration-class-validator.js +0 -113
  124. package/infrastructure/domains/admin-scripts/admin-script-builder.js +0 -200
  125. package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +0 -499
  126. package/infrastructure/domains/admin-scripts/index.js +0 -5
  127. package/infrastructure/jest.config.js +0 -16
@@ -1,277 +0,0 @@
1
- const path = require('path');
2
- const {IIntegrationRepository} = require('../../domain/ports/IIntegrationRepository');
3
- const {Integration} = require('../../domain/entities/Integration');
4
- const {IntegrationName} = require('../../domain/value-objects/IntegrationName');
5
-
6
- /**
7
- * FileSystemIntegrationRepository
8
- * Persists Integration entities to the file system
9
- */
10
- class FileSystemIntegrationRepository extends IIntegrationRepository {
11
- constructor(fileSystemAdapter, backendPath, schemaValidator, templateEngine = null) {
12
- super();
13
- this.fileSystemAdapter = fileSystemAdapter;
14
- this.backendPath = backendPath;
15
- this.schemaValidator = schemaValidator;
16
- this.templateEngine = templateEngine;
17
- this.integrationsDir = path.join(backendPath, 'src/integrations');
18
- }
19
-
20
- /**
21
- * Save integration to file system
22
- */
23
- async save(integration) {
24
- // Validate domain entity
25
- const validation = integration.validate();
26
- if (!validation.isValid) {
27
- throw new Error(`Invalid integration: ${validation.errors.join(', ')}`);
28
- }
29
-
30
- // Convert to persistence format
31
- const persistenceData = this._toPersistenceFormat(integration);
32
-
33
- // Validate against schema
34
- const schemaValidation = await this.schemaValidator.validate(
35
- 'integration-definition',
36
- persistenceData.definition
37
- );
38
-
39
- if (!schemaValidation.valid) {
40
- throw new Error(`Schema validation failed: ${schemaValidation.errors.join(', ')}`);
41
- }
42
-
43
- // Ensure integrations directory exists
44
- await this.fileSystemAdapter.ensureDirectory(this.integrationsDir);
45
-
46
- // Write single Integration.js file
47
- // Note: Integration.js should only be written on creation, not on updates
48
- // to preserve manual edits and module additions
49
- const integrationJsPath = this._getIntegrationFilePath(integration.name.value);
50
- const integrationJsExists = await this.fileSystemAdapter.exists(integrationJsPath);
51
-
52
- if (!integrationJsExists) {
53
- await this.fileSystemAdapter.writeFile(integrationJsPath, persistenceData.classFile);
54
- }
55
-
56
- return integration;
57
- }
58
-
59
- /**
60
- * Find integration by name
61
- */
62
- async findByName(name) {
63
- const nameStr = typeof name === 'string' ? name : name.value;
64
- const integrationPath = this._getIntegrationFilePath(nameStr);
65
-
66
- if (!await this.fileSystemAdapter.exists(integrationPath)) {
67
- return null;
68
- }
69
-
70
- // Read the Integration.js file and extract static Definition
71
- const content = await this.fileSystemAdapter.readFile(integrationPath);
72
-
73
- // Parse the static Definition from the file
74
- // This is a simple implementation - could be enhanced with AST parsing
75
- const definitionMatch = content.match(/static Definition = ({[\s\S]*?});/);
76
- if (!definitionMatch) {
77
- return null;
78
- }
79
-
80
- try {
81
- // Evaluate the definition object (be careful - this is simplified)
82
- const definitionStr = definitionMatch[1];
83
- // For now, just extract basic info using regex
84
- const nameMatch = definitionStr.match(/name:\s*['"]([^'"]+)['"]/);
85
- const versionMatch = definitionStr.match(/version:\s*['"]([^'"]+)['"]/);
86
-
87
- if (!nameMatch || !versionMatch) {
88
- return null;
89
- }
90
-
91
- return new Integration({
92
- name: nameMatch[1],
93
- version: versionMatch[1],
94
- displayName: nameStr,
95
- description: '',
96
- });
97
- } catch (error) {
98
- return null;
99
- }
100
- }
101
-
102
- /**
103
- * Check if integration exists
104
- */
105
- async exists(name) {
106
- const nameStr = typeof name === 'string' ? name : name.value;
107
- const integrationPath = this._getIntegrationFilePath(nameStr);
108
- return await this.fileSystemAdapter.exists(integrationPath);
109
- }
110
-
111
- /**
112
- * Get the file path for an integration
113
- */
114
- _getIntegrationFilePath(name) {
115
- const className = this._toClassName(name);
116
- return path.join(this.integrationsDir, `${className}Integration.js`);
117
- }
118
-
119
- /**
120
- * Convert kebab-case name to ClassName
121
- */
122
- _toClassName(name) {
123
- return name
124
- .split('-')
125
- .map(word => word.charAt(0).toUpperCase() + word.slice(1))
126
- .join('');
127
- }
128
-
129
- /**
130
- * List all integrations by reading Integration.js files
131
- */
132
- async list() {
133
- if (!await this.fileSystemAdapter.exists(this.integrationsDir)) {
134
- return [];
135
- }
136
-
137
- const files = await this.fileSystemAdapter.listFiles(this.integrationsDir, '*.js');
138
- const integrations = [];
139
-
140
- for (const fileName of files) {
141
- // Only process files matching {Name}Integration.js pattern
142
- if (!fileName.endsWith('Integration.js')) {
143
- continue;
144
- }
145
-
146
- try {
147
- // Extract integration name from filename
148
- const className = fileName.replace('.js', '').replace('Integration', '');
149
- const kebabName = this._toKebabCase(className);
150
-
151
- const integration = await this.findByName(kebabName);
152
- if (integration) {
153
- integrations.push(integration);
154
- }
155
- } catch (error) {
156
- console.warn(`Failed to load integration ${fileName}:`, error.message);
157
- }
158
- }
159
-
160
- return integrations;
161
- }
162
-
163
- /**
164
- * Convert ClassName to kebab-case
165
- */
166
- _toKebabCase(className) {
167
- return className
168
- .replace(/([a-z])([A-Z])/g, '$1-$2')
169
- .toLowerCase();
170
- }
171
-
172
- /**
173
- * Convert domain entity to persistence format
174
- */
175
- _toPersistenceFormat(integration) {
176
- const json = integration.toJSON();
177
-
178
- return {
179
- classFile: this._generateIntegrationClass(integration),
180
- definition: json, // Still needed for schema validation
181
- };
182
- }
183
-
184
- /**
185
- * Convert persistence data to domain entity
186
- */
187
- _toDomainEntity(persistenceData) {
188
- return new Integration({
189
- name: persistenceData.name,
190
- version: persistenceData.version,
191
- displayName: persistenceData.display?.name,
192
- description: persistenceData.display?.description,
193
- type: persistenceData.options?.type || 'custom',
194
- category: persistenceData.display?.category,
195
- tags: persistenceData.display?.tags || [],
196
- entities: persistenceData.entities || {},
197
- apiModules: [], // Would need to extract from somewhere
198
- capabilities: persistenceData.capabilities || {},
199
- requirements: persistenceData.requirements || {},
200
- options: persistenceData.options || {}
201
- });
202
- }
203
-
204
- /**
205
- * Generate Integration.js class file
206
- */
207
- _generateIntegrationClass(integration) {
208
- const className = integration.name.value
209
- .split('-')
210
- .map(word => word.charAt(0).toUpperCase() + word.slice(1))
211
- .join('');
212
-
213
- const obj = integration.toObject();
214
-
215
- return `const { IntegrationBase } = require('@friggframework/core');
216
-
217
- /**
218
- * ${integration.displayName} Integration
219
- * ${integration.description || 'No description provided'}
220
- */
221
- class ${className}Integration extends IntegrationBase {
222
- static Definition = {
223
- name: '${obj.name}',
224
- version: '${obj.version}',
225
- supportedVersions: ['${obj.version}'],
226
- hasUserConfig: false,
227
-
228
- display: {
229
- label: '${integration.displayName}',
230
- description: '${integration.description || 'No description provided'}',
231
- category: '${integration.category || 'Other'}',
232
- detailsUrl: '',
233
- icon: '',
234
- },
235
- modules: {
236
- // Add your API modules here
237
- // Example:
238
- // myModule: {
239
- // definition: myModule.Definition,
240
- // },
241
- },
242
- routes: [
243
- // Define your integration routes here
244
- // Example:
245
- // {
246
- // path: '/auth',
247
- // method: 'GET',
248
- // event: 'AUTH_REQUEST',
249
- // },
250
- ],
251
- };
252
-
253
- constructor() {
254
- super();
255
- this.events = {
256
- // Define your event handlers here
257
- // Example:
258
- // AUTH_REQUEST: {
259
- // handler: this.authRequest.bind(this),
260
- // },
261
- };
262
- }
263
-
264
- // TODO: Add your integration methods here
265
- // Example:
266
- // async authRequest({ res }) {
267
- // return res.json({ url: 'https://example.com/auth' });
268
- // }
269
- }
270
-
271
- module.exports = ${className}Integration;
272
- `;
273
- }
274
-
275
- }
276
-
277
- module.exports = {FileSystemIntegrationRepository};