@friggframework/devtools 2.0.0--canary.545.e256e95.0 → 2.0.0--canary.553.dc5f898.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 (129) 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/integration/integration-builder.js +3 -2
  30. package/infrastructure/domains/integration/integration-builder.test.js +54 -2
  31. package/infrastructure/domains/networking/vpc-builder.test.js +4 -2
  32. package/infrastructure/domains/networking/vpc-resolver.test.js +1 -1
  33. package/infrastructure/domains/shared/resource-discovery.js +5 -5
  34. package/infrastructure/domains/shared/types/app-definition.js +0 -35
  35. package/infrastructure/domains/shared/types/discovery-result.test.js +1 -1
  36. package/infrastructure/domains/shared/utilities/base-definition-factory.js +1 -10
  37. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +2 -2
  38. package/infrastructure/infrastructure-composer.js +0 -2
  39. package/infrastructure/infrastructure-composer.test.js +6 -5
  40. package/management-ui/README.md +109 -245
  41. package/package.json +7 -8
  42. package/frigg-cli/__tests__/application/use-cases/AddApiModuleToIntegrationUseCase.test.js +0 -326
  43. package/frigg-cli/__tests__/application/use-cases/CreateApiModuleUseCase.test.js +0 -337
  44. package/frigg-cli/__tests__/domain/entities/ApiModule.test.js +0 -373
  45. package/frigg-cli/__tests__/domain/entities/AppDefinition.test.js +0 -313
  46. package/frigg-cli/__tests__/domain/services/IntegrationValidator.test.js +0 -269
  47. package/frigg-cli/__tests__/domain/value-objects/IntegrationName.test.js +0 -82
  48. package/frigg-cli/__tests__/infrastructure/adapters/IntegrationJsUpdater.test.js +0 -408
  49. package/frigg-cli/__tests__/infrastructure/repositories/FileSystemApiModuleRepository.test.js +0 -583
  50. package/frigg-cli/__tests__/infrastructure/repositories/FileSystemAppDefinitionRepository.test.js +0 -314
  51. package/frigg-cli/__tests__/infrastructure/repositories/FileSystemIntegrationRepository.test.js +0 -383
  52. package/frigg-cli/__tests__/unit/commands/init.test.js +0 -406
  53. package/frigg-cli/__tests__/unit/commands/provider-dispatch.test.js +0 -383
  54. package/frigg-cli/__tests__/unit/commands/repair.test.js +0 -275
  55. package/frigg-cli/__tests__/unit/start-command/application/RunPreflightChecksUseCase.test.js +0 -411
  56. package/frigg-cli/__tests__/unit/start-command/infrastructure/DatabaseAdapter.test.js +0 -405
  57. package/frigg-cli/__tests__/unit/start-command/infrastructure/DockerAdapter.test.js +0 -496
  58. package/frigg-cli/__tests__/unit/start-command/presentation/InteractivePromptAdapter.test.js +0 -474
  59. package/frigg-cli/__tests__/unit/utils/output.test.js +0 -196
  60. package/frigg-cli/application/use-cases/AddApiModuleToIntegrationUseCase.js +0 -93
  61. package/frigg-cli/application/use-cases/CreateApiModuleUseCase.js +0 -93
  62. package/frigg-cli/application/use-cases/CreateIntegrationUseCase.js +0 -103
  63. package/frigg-cli/container.js +0 -172
  64. package/frigg-cli/docs/OUTPUT_MIGRATION_GUIDE.md +0 -286
  65. package/frigg-cli/domain/entities/ApiModule.js +0 -272
  66. package/frigg-cli/domain/entities/AppDefinition.js +0 -227
  67. package/frigg-cli/domain/entities/Integration.js +0 -198
  68. package/frigg-cli/domain/exceptions/DomainException.js +0 -24
  69. package/frigg-cli/domain/ports/IApiModuleRepository.js +0 -53
  70. package/frigg-cli/domain/ports/IAppDefinitionRepository.js +0 -43
  71. package/frigg-cli/domain/ports/IIntegrationRepository.js +0 -61
  72. package/frigg-cli/domain/services/IntegrationValidator.js +0 -185
  73. package/frigg-cli/domain/value-objects/IntegrationId.js +0 -42
  74. package/frigg-cli/domain/value-objects/IntegrationName.js +0 -60
  75. package/frigg-cli/domain/value-objects/SemanticVersion.js +0 -70
  76. package/frigg-cli/infrastructure/UnitOfWork.js +0 -46
  77. package/frigg-cli/infrastructure/adapters/BackendJsUpdater.js +0 -197
  78. package/frigg-cli/infrastructure/adapters/FileSystemAdapter.js +0 -224
  79. package/frigg-cli/infrastructure/adapters/IntegrationJsUpdater.js +0 -249
  80. package/frigg-cli/infrastructure/adapters/SchemaValidator.js +0 -92
  81. package/frigg-cli/infrastructure/repositories/FileSystemApiModuleRepository.js +0 -373
  82. package/frigg-cli/infrastructure/repositories/FileSystemAppDefinitionRepository.js +0 -116
  83. package/frigg-cli/infrastructure/repositories/FileSystemIntegrationRepository.js +0 -277
  84. package/frigg-cli/package-lock.json +0 -16226
  85. package/frigg-cli/start-command/application/RunPreflightChecksUseCase.js +0 -376
  86. package/frigg-cli/start-command/infrastructure/DatabaseAdapter.js +0 -591
  87. package/frigg-cli/start-command/infrastructure/DockerAdapter.js +0 -306
  88. package/frigg-cli/start-command/presentation/InteractivePromptAdapter.js +0 -329
  89. package/frigg-cli/templates/backend/.env.example +0 -62
  90. package/frigg-cli/templates/backend/.eslintrc.json +0 -12
  91. package/frigg-cli/templates/backend/.prettierrc +0 -6
  92. package/frigg-cli/templates/backend/docker-compose.yml +0 -22
  93. package/frigg-cli/templates/backend/index.js +0 -96
  94. package/frigg-cli/templates/backend/infrastructure.js +0 -12
  95. package/frigg-cli/templates/backend/jest.config.js +0 -17
  96. package/frigg-cli/templates/backend/package.json +0 -50
  97. package/frigg-cli/templates/backend/src/api-modules/.gitkeep +0 -10
  98. package/frigg-cli/templates/backend/src/base/.gitkeep +0 -7
  99. package/frigg-cli/templates/backend/src/integrations/.gitkeep +0 -10
  100. package/frigg-cli/templates/backend/src/integrations/ExampleIntegration.js +0 -65
  101. package/frigg-cli/templates/backend/src/utils/.gitkeep +0 -7
  102. package/frigg-cli/templates/backend/test/setup.js +0 -30
  103. package/frigg-cli/templates/backend/ui-extensions/.gitkeep +0 -0
  104. package/frigg-cli/templates/backend/ui-extensions/README.md +0 -77
  105. package/frigg-cli/utils/__tests__/provider-helper.test.js +0 -55
  106. package/frigg-cli/utils/__tests__/repo-detection.test.js +0 -436
  107. package/frigg-cli/utils/output.js +0 -382
  108. package/frigg-cli/utils/provider-helper.js +0 -75
  109. package/frigg-cli/validate-command/__tests__/adapters/validate-command.test.js +0 -205
  110. package/frigg-cli/validate-command/__tests__/application/validate-app-use-case.test.js +0 -104
  111. package/frigg-cli/validate-command/__tests__/domain/fix-suggestion.test.js +0 -153
  112. package/frigg-cli/validate-command/__tests__/domain/validation-error.test.js +0 -162
  113. package/frigg-cli/validate-command/__tests__/domain/validation-result.test.js +0 -152
  114. package/frigg-cli/validate-command/__tests__/infrastructure/api-module-validator.test.js +0 -332
  115. package/frigg-cli/validate-command/__tests__/infrastructure/app-definition-validator.test.js +0 -191
  116. package/frigg-cli/validate-command/__tests__/infrastructure/integration-class-validator.test.js +0 -146
  117. package/frigg-cli/validate-command/__tests__/infrastructure/template-validation.test.js +0 -155
  118. package/frigg-cli/validate-command/adapters/cli/validate-command.js +0 -199
  119. package/frigg-cli/validate-command/application/use-cases/validate-app-use-case.js +0 -35
  120. package/frigg-cli/validate-command/domain/entities/validation-result.js +0 -74
  121. package/frigg-cli/validate-command/domain/value-objects/fix-suggestion.js +0 -74
  122. package/frigg-cli/validate-command/domain/value-objects/validation-error.js +0 -68
  123. package/frigg-cli/validate-command/infrastructure/validators/api-module-validator.js +0 -181
  124. package/frigg-cli/validate-command/infrastructure/validators/app-definition-validator.js +0 -145
  125. package/frigg-cli/validate-command/infrastructure/validators/integration-class-validator.js +0 -113
  126. package/infrastructure/domains/admin-scripts/admin-script-builder.js +0 -200
  127. package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +0 -499
  128. package/infrastructure/domains/admin-scripts/index.js +0 -5
  129. package/infrastructure/jest.config.js +0 -16
@@ -1,269 +0,0 @@
1
- const {IntegrationValidator} = require('../../../domain/services/IntegrationValidator');
2
- const {Integration} = require('../../../domain/entities/Integration');
3
- const {IntegrationName} = require('../../../domain/value-objects/IntegrationName');
4
-
5
- // Mock repository
6
- class MockIntegrationRepository {
7
- constructor() {
8
- this.integrations = new Map();
9
- }
10
-
11
- async exists(name) {
12
- const nameStr = typeof name === 'string' ? name : name.value;
13
- return this.integrations.has(nameStr);
14
- }
15
-
16
- addIntegration(name) {
17
- this.integrations.set(name, true);
18
- }
19
- }
20
-
21
- describe('IntegrationValidator', () => {
22
- let validator;
23
- let mockRepository;
24
-
25
- beforeEach(() => {
26
- mockRepository = new MockIntegrationRepository();
27
- validator = new IntegrationValidator(mockRepository);
28
- });
29
-
30
- describe('validateUniqueness', () => {
31
- test('passes when integration does not exist', async () => {
32
- const name = new IntegrationName('new-integration');
33
- const result = await validator.validateUniqueness(name);
34
-
35
- expect(result.isValid).toBe(true);
36
- expect(result.errors).toHaveLength(0);
37
- });
38
-
39
- test('fails when integration already exists', async () => {
40
- mockRepository.addIntegration('existing-integration');
41
-
42
- const name = new IntegrationName('existing-integration');
43
- const result = await validator.validateUniqueness(name);
44
-
45
- expect(result.isValid).toBe(false);
46
- expect(result.errors).toHaveLength(1);
47
- expect(result.errors[0]).toContain('already exists');
48
- });
49
- });
50
-
51
- describe('validateDomainRules', () => {
52
- test('passes for valid API integration', () => {
53
- const integration = Integration.create({
54
- name: 'test-api',
55
- displayName: 'Test API',
56
- description: 'Test',
57
- type: 'api',
58
- category: 'CRM',
59
- capabilities: {
60
- auth: ['oauth2']
61
- }
62
- });
63
-
64
- const result = validator.validateDomainRules(integration);
65
-
66
- expect(result.isValid).toBe(true);
67
- expect(result.errors).toHaveLength(0);
68
- });
69
-
70
- test('fails when webhook integration has no webhooks capability', () => {
71
- const integration = Integration.create({
72
- name: 'test-webhook',
73
- displayName: 'Test Webhook',
74
- description: 'Test',
75
- type: 'webhook',
76
- category: 'CRM',
77
- capabilities: {
78
- webhooks: false
79
- }
80
- });
81
-
82
- const result = validator.validateDomainRules(integration);
83
-
84
- expect(result.isValid).toBe(false);
85
- expect(result.errors).toHaveLength(1);
86
- expect(result.errors[0]).toContain('Webhook integrations must have webhooks capability');
87
- });
88
-
89
- test('passes when webhook integration has webhooks capability', () => {
90
- const integration = Integration.create({
91
- name: 'test-webhook',
92
- displayName: 'Test Webhook',
93
- description: 'Test',
94
- type: 'webhook',
95
- category: 'CRM',
96
- capabilities: {
97
- webhooks: true
98
- }
99
- });
100
-
101
- const result = validator.validateDomainRules(integration);
102
-
103
- expect(result.isValid).toBe(true);
104
- expect(result.errors).toHaveLength(0);
105
- });
106
- });
107
-
108
- describe('validate', () => {
109
- test('passes for valid new integration', async () => {
110
- const integration = Integration.create({
111
- name: 'new-integration',
112
- displayName: 'New Integration',
113
- description: 'A new integration',
114
- type: 'api',
115
- category: 'CRM',
116
- capabilities: {}
117
- });
118
-
119
- const result = await validator.validate(integration);
120
-
121
- expect(result.isValid).toBe(true);
122
- expect(result.errors).toHaveLength(0);
123
- });
124
-
125
- test('fails when integration already exists', async () => {
126
- mockRepository.addIntegration('existing-integration');
127
-
128
- const integration = Integration.create({
129
- name: 'existing-integration',
130
- displayName: 'Existing Integration',
131
- description: 'Test',
132
- type: 'api',
133
- category: 'CRM',
134
- capabilities: {}
135
- });
136
-
137
- const result = await validator.validate(integration);
138
-
139
- expect(result.isValid).toBe(false);
140
- expect(result.errors.length).toBeGreaterThan(0);
141
- expect(result.errors.some(e => e.includes('already exists'))).toBe(true);
142
- });
143
-
144
- test('accumulates multiple validation errors', async () => {
145
- mockRepository.addIntegration('existing-webhook');
146
-
147
- const integration = Integration.create({
148
- name: 'existing-webhook',
149
- displayName: 'Ex', // Too short
150
- description: '',
151
- type: 'webhook',
152
- category: 'CRM',
153
- capabilities: {
154
- webhooks: false // Invalid for webhook type
155
- }
156
- });
157
-
158
- const result = await validator.validate(integration);
159
-
160
- expect(result.isValid).toBe(false);
161
- expect(result.errors.length).toBeGreaterThan(1);
162
- });
163
- });
164
-
165
- describe('validateUpdate', () => {
166
- test('passes for valid update', () => {
167
- const existing = Integration.create({
168
- name: 'my-integration',
169
- displayName: 'My Integration',
170
- type: 'api',
171
- category: 'CRM'
172
- });
173
-
174
- const updated = Integration.create({
175
- name: 'my-integration',
176
- displayName: 'My Updated Integration',
177
- type: 'api',
178
- category: 'Marketing'
179
- });
180
-
181
- const result = validator.validateUpdate(existing, updated);
182
-
183
- expect(result.isValid).toBe(true);
184
- expect(result.errors).toHaveLength(0);
185
- });
186
-
187
- test('fails when trying to change integration name', () => {
188
- const existing = Integration.create({
189
- name: 'original-name',
190
- displayName: 'Original',
191
- type: 'api'
192
- });
193
-
194
- const updated = Integration.create({
195
- name: 'new-name',
196
- displayName: 'Updated',
197
- type: 'api'
198
- });
199
-
200
- const result = validator.validateUpdate(existing, updated);
201
-
202
- expect(result.isValid).toBe(false);
203
- expect(result.errors).toContain('Integration name cannot be changed after creation');
204
- });
205
-
206
- test('fails when trying to downgrade version', () => {
207
- const existing = Integration.create({
208
- name: 'my-integration',
209
- displayName: 'My Integration',
210
- type: 'api',
211
- version: '2.0.0'
212
- });
213
-
214
- const updated = Integration.create({
215
- name: 'my-integration',
216
- displayName: 'My Integration',
217
- type: 'api',
218
- version: '1.0.0'
219
- });
220
-
221
- const result = validator.validateUpdate(existing, updated);
222
-
223
- expect(result.isValid).toBe(false);
224
- expect(result.errors.some(e => e.includes('Cannot downgrade'))).toBe(true);
225
- });
226
- });
227
-
228
- describe('validateApiModuleAddition', () => {
229
- test('passes for valid API module addition', () => {
230
- const integration = Integration.create({
231
- name: 'my-integration',
232
- displayName: 'My Integration',
233
- type: 'api'
234
- });
235
-
236
- const result = validator.validateApiModuleAddition(integration, 'new-module', '1.0.0');
237
-
238
- expect(result.isValid).toBe(true);
239
- expect(result.errors).toHaveLength(0);
240
- });
241
-
242
- test('fails when module already exists', () => {
243
- const integration = Integration.create({
244
- name: 'my-integration',
245
- displayName: 'My Integration',
246
- type: 'api'
247
- });
248
- integration.addApiModule('existing-module', '1.0.0');
249
-
250
- const result = validator.validateApiModuleAddition(integration, 'existing-module', '2.0.0');
251
-
252
- expect(result.isValid).toBe(false);
253
- expect(result.errors).toContain("API module 'existing-module' is already added to this integration");
254
- });
255
-
256
- test('fails for invalid version format', () => {
257
- const integration = Integration.create({
258
- name: 'my-integration',
259
- displayName: 'My Integration',
260
- type: 'api'
261
- });
262
-
263
- const result = validator.validateApiModuleAddition(integration, 'my-module', 'invalid-version');
264
-
265
- expect(result.isValid).toBe(false);
266
- expect(result.errors.some(e => e.includes('Invalid API module version format'))).toBe(true);
267
- });
268
- });
269
- });
@@ -1,82 +0,0 @@
1
- const {IntegrationName} = require('../../../domain/value-objects/IntegrationName');
2
- const {DomainException} = require('../../../domain/exceptions/DomainException');
3
-
4
- describe('IntegrationName Value Object', () => {
5
- describe('valid names', () => {
6
- test('accepts valid kebab-case name', () => {
7
- const name = new IntegrationName('salesforce-sync');
8
- expect(name.value).toBe('salesforce-sync');
9
- });
10
-
11
- test('accepts name with numbers', () => {
12
- const name = new IntegrationName('api-module-v2');
13
- expect(name.value).toBe('api-module-v2');
14
- });
15
-
16
- test('accepts two-character name', () => {
17
- const name = new IntegrationName('ab');
18
- expect(name.value).toBe('ab');
19
- });
20
- });
21
-
22
- describe('invalid names', () => {
23
- test('rejects uppercase letters', () => {
24
- expect(() => new IntegrationName('SalesforceSync'))
25
- .toThrow(DomainException);
26
- });
27
-
28
- test('rejects name starting with hyphen', () => {
29
- expect(() => new IntegrationName('-salesforce'))
30
- .toThrow(DomainException);
31
- });
32
-
33
- test('rejects name ending with hyphen', () => {
34
- expect(() => new IntegrationName('salesforce-'))
35
- .toThrow(DomainException);
36
- });
37
-
38
- test('rejects consecutive hyphens', () => {
39
- expect(() => new IntegrationName('salesforce--sync'))
40
- .toThrow(DomainException);
41
- });
42
-
43
- test('rejects name with spaces', () => {
44
- expect(() => new IntegrationName('salesforce sync'))
45
- .toThrow(DomainException);
46
- });
47
-
48
- test('rejects name with underscores', () => {
49
- expect(() => new IntegrationName('salesforce_sync'))
50
- .toThrow(DomainException);
51
- });
52
-
53
- test('rejects single character name', () => {
54
- expect(() => new IntegrationName('a'))
55
- .toThrow(DomainException);
56
- });
57
-
58
- test('rejects empty name', () => {
59
- expect(() => new IntegrationName(''))
60
- .toThrow(DomainException);
61
- });
62
-
63
- test('rejects null', () => {
64
- expect(() => new IntegrationName(null))
65
- .toThrow(DomainException);
66
- });
67
- });
68
-
69
- describe('equality', () => {
70
- test('equal names are equal', () => {
71
- const name1 = new IntegrationName('salesforce-sync');
72
- const name2 = new IntegrationName('salesforce-sync');
73
- expect(name1.equals(name2)).toBe(true);
74
- });
75
-
76
- test('different names are not equal', () => {
77
- const name1 = new IntegrationName('salesforce-sync');
78
- const name2 = new IntegrationName('hubspot-sync');
79
- expect(name1.equals(name2)).toBe(false);
80
- });
81
- });
82
- });