@friggframework/devtools 2.0.0--canary.522.923dfae.0 → 2.0.0--canary.540.c5ef83f.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 (119) hide show
  1. package/frigg-cli/README.md +1 -1
  2. package/frigg-cli/__tests__/unit/commands/doctor.test.js +2 -0
  3. package/frigg-cli/__tests__/unit/commands/install.test.js +19 -23
  4. package/frigg-cli/__tests__/unit/dependencies.test.js +2 -2
  5. package/frigg-cli/doctor-command/index.js +16 -17
  6. package/frigg-cli/index.js +6 -21
  7. package/frigg-cli/index.test.js +2 -7
  8. package/frigg-cli/init-command/backend-first-handler.js +42 -124
  9. package/frigg-cli/init-command/index.js +1 -2
  10. package/frigg-cli/init-command/template-handler.js +3 -13
  11. package/frigg-cli/install-command/backend-js.js +3 -3
  12. package/frigg-cli/install-command/environment-variables.js +19 -16
  13. package/frigg-cli/install-command/environment-variables.test.js +13 -12
  14. package/frigg-cli/install-command/index.js +9 -14
  15. package/frigg-cli/install-command/integration-file.js +3 -3
  16. package/frigg-cli/install-command/logger.js +12 -0
  17. package/frigg-cli/install-command/validate-package.js +9 -5
  18. package/frigg-cli/jest.config.js +1 -4
  19. package/frigg-cli/repair-command/index.js +128 -101
  20. package/frigg-cli/start-command/index.js +2 -246
  21. package/frigg-cli/ui-command/index.js +36 -58
  22. package/frigg-cli/utils/repo-detection.js +37 -85
  23. package/infrastructure/docs/iam-policy-templates.md +1 -1
  24. package/infrastructure/domains/networking/vpc-builder.test.js +4 -2
  25. package/infrastructure/domains/networking/vpc-resolver.test.js +1 -1
  26. package/infrastructure/domains/shared/cloudformation-discovery.test.js +7 -4
  27. package/infrastructure/domains/shared/resource-discovery.js +5 -5
  28. package/infrastructure/domains/shared/types/app-definition.js +0 -21
  29. package/infrastructure/domains/shared/types/discovery-result.test.js +1 -1
  30. package/infrastructure/domains/shared/utilities/base-definition-factory.js +1 -10
  31. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +2 -2
  32. package/infrastructure/infrastructure-composer.test.js +2 -2
  33. package/management-ui/README.md +109 -245
  34. package/package.json +7 -8
  35. package/frigg-cli/__tests__/application/use-cases/AddApiModuleToIntegrationUseCase.test.js +0 -326
  36. package/frigg-cli/__tests__/application/use-cases/CreateApiModuleUseCase.test.js +0 -337
  37. package/frigg-cli/__tests__/domain/entities/ApiModule.test.js +0 -373
  38. package/frigg-cli/__tests__/domain/entities/AppDefinition.test.js +0 -313
  39. package/frigg-cli/__tests__/domain/services/IntegrationValidator.test.js +0 -269
  40. package/frigg-cli/__tests__/domain/value-objects/IntegrationName.test.js +0 -82
  41. package/frigg-cli/__tests__/infrastructure/adapters/IntegrationJsUpdater.test.js +0 -408
  42. package/frigg-cli/__tests__/infrastructure/repositories/FileSystemApiModuleRepository.test.js +0 -583
  43. package/frigg-cli/__tests__/infrastructure/repositories/FileSystemAppDefinitionRepository.test.js +0 -314
  44. package/frigg-cli/__tests__/infrastructure/repositories/FileSystemIntegrationRepository.test.js +0 -383
  45. package/frigg-cli/__tests__/unit/commands/init.test.js +0 -406
  46. package/frigg-cli/__tests__/unit/commands/repair.test.js +0 -275
  47. package/frigg-cli/__tests__/unit/start-command/application/RunPreflightChecksUseCase.test.js +0 -411
  48. package/frigg-cli/__tests__/unit/start-command/infrastructure/DatabaseAdapter.test.js +0 -405
  49. package/frigg-cli/__tests__/unit/start-command/infrastructure/DockerAdapter.test.js +0 -496
  50. package/frigg-cli/__tests__/unit/start-command/presentation/InteractivePromptAdapter.test.js +0 -474
  51. package/frigg-cli/__tests__/unit/utils/output.test.js +0 -196
  52. package/frigg-cli/application/use-cases/AddApiModuleToIntegrationUseCase.js +0 -93
  53. package/frigg-cli/application/use-cases/CreateApiModuleUseCase.js +0 -93
  54. package/frigg-cli/application/use-cases/CreateIntegrationUseCase.js +0 -103
  55. package/frigg-cli/container.js +0 -172
  56. package/frigg-cli/docs/OUTPUT_MIGRATION_GUIDE.md +0 -286
  57. package/frigg-cli/domain/entities/ApiModule.js +0 -272
  58. package/frigg-cli/domain/entities/AppDefinition.js +0 -227
  59. package/frigg-cli/domain/entities/Integration.js +0 -198
  60. package/frigg-cli/domain/exceptions/DomainException.js +0 -24
  61. package/frigg-cli/domain/ports/IApiModuleRepository.js +0 -53
  62. package/frigg-cli/domain/ports/IAppDefinitionRepository.js +0 -43
  63. package/frigg-cli/domain/ports/IIntegrationRepository.js +0 -61
  64. package/frigg-cli/domain/services/IntegrationValidator.js +0 -185
  65. package/frigg-cli/domain/value-objects/IntegrationId.js +0 -42
  66. package/frigg-cli/domain/value-objects/IntegrationName.js +0 -60
  67. package/frigg-cli/domain/value-objects/SemanticVersion.js +0 -70
  68. package/frigg-cli/infrastructure/UnitOfWork.js +0 -46
  69. package/frigg-cli/infrastructure/adapters/BackendJsUpdater.js +0 -197
  70. package/frigg-cli/infrastructure/adapters/FileSystemAdapter.js +0 -224
  71. package/frigg-cli/infrastructure/adapters/IntegrationJsUpdater.js +0 -249
  72. package/frigg-cli/infrastructure/adapters/SchemaValidator.js +0 -92
  73. package/frigg-cli/infrastructure/repositories/FileSystemApiModuleRepository.js +0 -373
  74. package/frigg-cli/infrastructure/repositories/FileSystemAppDefinitionRepository.js +0 -116
  75. package/frigg-cli/infrastructure/repositories/FileSystemIntegrationRepository.js +0 -277
  76. package/frigg-cli/package-lock.json +0 -16226
  77. package/frigg-cli/start-command/application/RunPreflightChecksUseCase.js +0 -376
  78. package/frigg-cli/start-command/infrastructure/DatabaseAdapter.js +0 -591
  79. package/frigg-cli/start-command/infrastructure/DockerAdapter.js +0 -306
  80. package/frigg-cli/start-command/presentation/InteractivePromptAdapter.js +0 -329
  81. package/frigg-cli/templates/backend/.env.example +0 -62
  82. package/frigg-cli/templates/backend/.eslintrc.json +0 -12
  83. package/frigg-cli/templates/backend/.prettierrc +0 -6
  84. package/frigg-cli/templates/backend/docker-compose.yml +0 -22
  85. package/frigg-cli/templates/backend/index.js +0 -96
  86. package/frigg-cli/templates/backend/infrastructure.js +0 -12
  87. package/frigg-cli/templates/backend/jest.config.js +0 -17
  88. package/frigg-cli/templates/backend/package.json +0 -50
  89. package/frigg-cli/templates/backend/src/api-modules/.gitkeep +0 -10
  90. package/frigg-cli/templates/backend/src/base/.gitkeep +0 -7
  91. package/frigg-cli/templates/backend/src/integrations/.gitkeep +0 -10
  92. package/frigg-cli/templates/backend/src/integrations/ExampleIntegration.js +0 -65
  93. package/frigg-cli/templates/backend/src/utils/.gitkeep +0 -7
  94. package/frigg-cli/templates/backend/test/setup.js +0 -30
  95. package/frigg-cli/templates/backend/ui-extensions/.gitkeep +0 -0
  96. package/frigg-cli/templates/backend/ui-extensions/README.md +0 -77
  97. package/frigg-cli/utils/__tests__/repo-detection.test.js +0 -436
  98. package/frigg-cli/utils/output.js +0 -382
  99. package/frigg-cli/validate-command/__tests__/adapters/validate-command.test.js +0 -205
  100. package/frigg-cli/validate-command/__tests__/application/validate-app-use-case.test.js +0 -104
  101. package/frigg-cli/validate-command/__tests__/domain/fix-suggestion.test.js +0 -153
  102. package/frigg-cli/validate-command/__tests__/domain/validation-error.test.js +0 -162
  103. package/frigg-cli/validate-command/__tests__/domain/validation-result.test.js +0 -152
  104. package/frigg-cli/validate-command/__tests__/infrastructure/api-module-validator.test.js +0 -332
  105. package/frigg-cli/validate-command/__tests__/infrastructure/app-definition-validator.test.js +0 -191
  106. package/frigg-cli/validate-command/__tests__/infrastructure/integration-class-validator.test.js +0 -146
  107. package/frigg-cli/validate-command/__tests__/infrastructure/template-validation.test.js +0 -155
  108. package/frigg-cli/validate-command/adapters/cli/validate-command.js +0 -199
  109. package/frigg-cli/validate-command/application/use-cases/validate-app-use-case.js +0 -35
  110. package/frigg-cli/validate-command/domain/entities/validation-result.js +0 -74
  111. package/frigg-cli/validate-command/domain/value-objects/fix-suggestion.js +0 -74
  112. package/frigg-cli/validate-command/domain/value-objects/validation-error.js +0 -68
  113. package/frigg-cli/validate-command/infrastructure/validators/api-module-validator.js +0 -181
  114. package/frigg-cli/validate-command/infrastructure/validators/app-definition-validator.js +0 -128
  115. package/frigg-cli/validate-command/infrastructure/validators/integration-class-validator.js +0 -113
  116. package/infrastructure/domains/admin-scripts/admin-script-builder.js +0 -200
  117. package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +0 -499
  118. package/infrastructure/domains/admin-scripts/index.js +0 -5
  119. 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
- });