@aifabrix/builder 2.11.0 → 2.21.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 (36) hide show
  1. package/.cursor/rules/project-rules.mdc +194 -0
  2. package/README.md +12 -0
  3. package/lib/api/applications.api.js +164 -0
  4. package/lib/api/auth.api.js +303 -0
  5. package/lib/api/datasources-core.api.js +87 -0
  6. package/lib/api/datasources-extended.api.js +117 -0
  7. package/lib/api/datasources.api.js +13 -0
  8. package/lib/api/deployments.api.js +126 -0
  9. package/lib/api/environments.api.js +245 -0
  10. package/lib/api/external-systems.api.js +251 -0
  11. package/lib/api/index.js +236 -0
  12. package/lib/api/pipeline.api.js +234 -0
  13. package/lib/api/types/applications.types.js +136 -0
  14. package/lib/api/types/auth.types.js +218 -0
  15. package/lib/api/types/datasources.types.js +272 -0
  16. package/lib/api/types/deployments.types.js +184 -0
  17. package/lib/api/types/environments.types.js +197 -0
  18. package/lib/api/types/external-systems.types.js +244 -0
  19. package/lib/api/types/pipeline.types.js +125 -0
  20. package/lib/app-list.js +5 -7
  21. package/lib/app-rotate-secret.js +4 -10
  22. package/lib/cli.js +30 -0
  23. package/lib/commands/login.js +41 -12
  24. package/lib/datasource-deploy.js +7 -30
  25. package/lib/datasource-list.js +9 -6
  26. package/lib/deployer.js +103 -135
  27. package/lib/environment-deploy.js +15 -26
  28. package/lib/external-system-deploy.js +12 -39
  29. package/lib/external-system-download.js +5 -13
  30. package/lib/external-system-test.js +9 -12
  31. package/lib/generator-split.js +342 -0
  32. package/lib/generator.js +94 -5
  33. package/lib/utils/app-register-api.js +5 -10
  34. package/lib/utils/deployment-errors.js +88 -6
  35. package/package.json +1 -1
  36. package/tatus +0 -181
@@ -0,0 +1,218 @@
1
+ /**
2
+ * @fileoverview Authentication API type definitions
3
+ * @author AI Fabrix Team
4
+ * @version 2.0.0
5
+ */
6
+
7
+ /**
8
+ * Authentication configuration
9
+ * @typedef {Object} AuthConfig
10
+ * @property {string} type - Authentication type ('bearer' | 'client-credentials' | 'client-token')
11
+ * @property {string} [token] - Bearer token (for type='bearer' or type='client-token')
12
+ * @property {string} [clientId] - Client ID (for type='client-credentials')
13
+ * @property {string} [clientSecret] - Client secret (for type='client-credentials')
14
+ */
15
+
16
+ /**
17
+ * Standard API response wrapper
18
+ * @typedef {Object} ApiResponse
19
+ * @property {boolean} success - Request success flag
20
+ * @property {*} [data] - Response data
21
+ * @property {string} [error] - Error message
22
+ * @property {Object} [errorData] - Error data object
23
+ * @property {string} [errorType] - Error type
24
+ * @property {string} [formattedError] - Formatted error message
25
+ * @property {number} [status] - HTTP status code
26
+ * @property {string} [timestamp] - Response timestamp (ISO 8601)
27
+ */
28
+
29
+ /**
30
+ * Get token request (x-client-token generation)
31
+ * @typedef {Object} GetTokenRequest
32
+ * @property {string} clientId - Client ID (via x-client-id header)
33
+ * @property {string} clientSecret - Client secret (via x-client-secret header)
34
+ */
35
+
36
+ /**
37
+ * Get token response (x-client-token generation)
38
+ * @typedef {Object} GetTokenResponse
39
+ * @property {boolean} success - Request success flag
40
+ * @property {string} token - Generated x-client-token
41
+ * @property {number} expiresIn - Token expiry time in seconds
42
+ * @property {string} expiresAt - Token expiry timestamp (ISO 8601)
43
+ * @property {string} timestamp - Response timestamp (ISO 8601)
44
+ */
45
+
46
+ /**
47
+ * Get client token response (frontend token)
48
+ * @typedef {Object} GetClientTokenResponse
49
+ * @property {boolean} success - Request success flag
50
+ * @property {Object} data - Token data
51
+ * @property {string} data.token - Generated x-client-token
52
+ * @property {number} data.expiresIn - Token expiry time in seconds
53
+ * @property {string} data.expiresAt - Token expiry timestamp (ISO 8601)
54
+ * @property {string} timestamp - Response timestamp (ISO 8601)
55
+ */
56
+
57
+ /**
58
+ * Get auth user response
59
+ * @typedef {Object} GetAuthUserResponse
60
+ * @property {boolean} success - Request success flag
61
+ * @property {Object} data - User data
62
+ * @property {Object} data.user - User information
63
+ * @property {string} data.user.id - User ID
64
+ * @property {string} data.user.username - Username
65
+ * @property {string} data.user.email - Email address
66
+ * @property {boolean} data.authenticated - Authentication status
67
+ * @property {string} timestamp - Response timestamp (ISO 8601)
68
+ */
69
+
70
+ /**
71
+ * Get auth login request
72
+ * @typedef {Object} GetAuthLoginRequest
73
+ * @property {string} redirect - Redirect URI for OAuth2 callback
74
+ * @property {string} [state] - State parameter for CSRF protection
75
+ */
76
+
77
+ /**
78
+ * Get auth login response
79
+ * @typedef {Object} GetAuthLoginResponse
80
+ * @property {boolean} success - Request success flag
81
+ * @property {Object} data - Login data
82
+ * @property {string} data.loginUrl - Login URL for OAuth2 authorization flow
83
+ * @property {string} timestamp - Response timestamp (ISO 8601)
84
+ */
85
+
86
+ /**
87
+ * Initiate device code flow request
88
+ * @typedef {Object} InitiateDeviceCodeRequest
89
+ * @property {string} [environment] - Environment key (query or body)
90
+ * @property {string} [scope] - OAuth2 scope string (defaults to 'openid profile email')
91
+ */
92
+
93
+ /**
94
+ * Device code response
95
+ * @typedef {Object} DeviceCodeResponse
96
+ * @property {string} deviceCode - Device code for polling token endpoint
97
+ * @property {string} userCode - User code to enter at verification URI
98
+ * @property {string} verificationUri - URI for user to visit and enter user code
99
+ * @property {string} [verificationUriComplete] - Complete URI with user code pre-filled
100
+ * @property {number} expiresIn - Device code expiration time in seconds (typically 600)
101
+ * @property {number} interval - Polling interval in seconds (typically 5)
102
+ */
103
+
104
+ /**
105
+ * Initiate device code flow response
106
+ * @typedef {Object} InitiateDeviceCodeResponse
107
+ * @property {boolean} success - Request success flag
108
+ * @property {DeviceCodeResponse} data - Device code information
109
+ * @property {string} timestamp - Response timestamp (ISO 8601)
110
+ */
111
+
112
+ /**
113
+ * Poll device code token request
114
+ * @typedef {Object} PollDeviceCodeTokenRequest
115
+ * @property {string} deviceCode - Device code from initiate device code flow
116
+ */
117
+
118
+ /**
119
+ * Device code token response
120
+ * @typedef {Object} DeviceCodeTokenResponse
121
+ * @property {string} accessToken - JWT access token from Keycloak
122
+ * @property {string} [refreshToken] - Refresh token for obtaining new access tokens
123
+ * @property {number} expiresIn - Access token expiration time in seconds
124
+ */
125
+
126
+ /**
127
+ * Poll device code token response
128
+ * @typedef {Object} PollDeviceCodeTokenResponse
129
+ * @property {boolean} success - Request success flag
130
+ * @property {DeviceCodeTokenResponse} [data] - Token data (on success)
131
+ * @property {string} [error] - Error code (on pending: 'authorization_pending' | 'slow_down')
132
+ * @property {string} [errorDescription] - Error description
133
+ * @property {string} timestamp - Response timestamp (ISO 8601)
134
+ */
135
+
136
+ /**
137
+ * Refresh device token request
138
+ * @typedef {Object} RefreshDeviceTokenRequest
139
+ * @property {string} refreshToken - Refresh token obtained from device code token flow
140
+ */
141
+
142
+ /**
143
+ * Refresh device token response
144
+ * @typedef {Object} RefreshDeviceTokenResponse
145
+ * @property {boolean} success - Request success flag
146
+ * @property {DeviceCodeTokenResponse} data - New token data
147
+ * @property {string} timestamp - Response timestamp (ISO 8601)
148
+ */
149
+
150
+ /**
151
+ * Refresh user token request
152
+ * @typedef {Object} RefreshUserTokenRequest
153
+ * @property {string} refreshToken - Refresh token obtained from OAuth callback flow
154
+ */
155
+
156
+ /**
157
+ * Refresh user token response
158
+ * @typedef {Object} RefreshUserTokenResponse
159
+ * @property {boolean} success - Request success flag
160
+ * @property {DeviceCodeTokenResponse} data - New token data
161
+ * @property {string} [message] - Response message
162
+ * @property {string} timestamp - Response timestamp (ISO 8601)
163
+ */
164
+
165
+ /**
166
+ * Validate token request
167
+ * @typedef {Object} ValidateTokenRequest
168
+ * @property {string} token - JWT token to validate
169
+ * @property {string} [environment] - Optional environment key (overrides x-client-token context)
170
+ * @property {string} [application] - Optional application key (overrides x-client-token context)
171
+ */
172
+
173
+ /**
174
+ * Validate token response
175
+ * @typedef {Object} ValidateTokenResponse
176
+ * @property {boolean} success - Request success flag
177
+ * @property {Object} data - Validation data
178
+ * @property {boolean} data.authenticated - Authentication status
179
+ * @property {Object} [data.user] - User information
180
+ * @property {string} [data.user.id] - User ID
181
+ * @property {string} [data.user.username] - Username
182
+ * @property {string} [data.user.email] - Email address
183
+ * @property {string} [data.expiresAt] - Token expiration timestamp (ISO 8601)
184
+ * @property {string} timestamp - Response timestamp (ISO 8601)
185
+ */
186
+
187
+ /**
188
+ * Get auth roles response
189
+ * @typedef {Object} GetAuthRolesResponse
190
+ * @property {boolean} success - Request success flag
191
+ * @property {Object} data - Roles data
192
+ * @property {string[]} data.roles - Array of role names
193
+ * @property {string} timestamp - Response timestamp (ISO 8601)
194
+ */
195
+
196
+ /**
197
+ * Get auth permissions response
198
+ * @typedef {Object} GetAuthPermissionsResponse
199
+ * @property {boolean} success - Request success flag
200
+ * @property {Object} data - Permissions data
201
+ * @property {string[]} data.permissions - Array of permission names
202
+ * @property {string} timestamp - Response timestamp (ISO 8601)
203
+ */
204
+
205
+ /**
206
+ * Get auth login diagnostics response
207
+ * @typedef {Object} GetAuthLoginDiagnosticsResponse
208
+ * @property {boolean} success - Request success flag
209
+ * @property {Object} data - Diagnostic data
210
+ * @property {Object} data.database - Database health status
211
+ * @property {Object} data.controller - Controller status
212
+ * @property {Object} data.environment - Environment status
213
+ * @property {Object} data.keycloak - Keycloak configuration status
214
+ * @property {string} timestamp - Response timestamp (ISO 8601)
215
+ */
216
+
217
+ module.exports = {};
218
+
@@ -0,0 +1,272 @@
1
+ /**
2
+ * @fileoverview Datasources API type definitions
3
+ * @author AI Fabrix Team
4
+ * @version 2.0.0
5
+ */
6
+
7
+ // Pagination types - shared with other API modules
8
+
9
+ /**
10
+ * External data source response
11
+ * @typedef {Object} ExternalDataSourceResponse
12
+ * @property {string} id - Datasource ID
13
+ * @property {string} key - Datasource key (unique identifier)
14
+ * @property {string} displayName - Display name
15
+ * @property {string|null} description - Datasource description
16
+ * @property {string} externalSystemId - External system ID
17
+ * @property {string} resourceType - Resource type
18
+ * @property {Object} fieldMappings - Field mappings configuration
19
+ * @property {string} status - Status ('draft' | 'published' | 'archived')
20
+ * @property {boolean} isActive - Whether datasource is active
21
+ * @property {string} createdAt - Creation timestamp (ISO 8601)
22
+ * @property {string} updatedAt - Update timestamp (ISO 8601)
23
+ */
24
+
25
+ /**
26
+ * External data source create request
27
+ * @typedef {Object} ExternalDataSourceCreate
28
+ * @property {string} key - Datasource key
29
+ * @property {string} displayName - Display name
30
+ * @property {string} [description] - Description
31
+ * @property {string} externalSystemId - External system ID
32
+ * @property {string} resourceType - Resource type
33
+ * @property {Object} [fieldMappings] - Field mappings
34
+ * @property {Object} [configuration] - Configuration
35
+ */
36
+
37
+ /**
38
+ * External data source update request
39
+ * @typedef {Object} ExternalDataSourceUpdate
40
+ * @property {string} [displayName] - Display name
41
+ * @property {string} [description] - Description
42
+ * @property {Object} [fieldMappings] - Field mappings
43
+ * @property {Object} [configuration] - Configuration
44
+ * @property {boolean} [isActive] - Active status
45
+ */
46
+
47
+ /**
48
+ * External data source config response (with MCP contract)
49
+ * @typedef {Object} ExternalDataSourceConfigResponse
50
+ * @property {ExternalDataSourceResponse} datasource - Datasource configuration
51
+ * @property {Object} [mcpContract] - MCP contract if generated
52
+ */
53
+
54
+ /**
55
+ * List datasources request options
56
+ * @typedef {Object} ListDatasourcesRequest
57
+ * @property {number} [page] - Page number (default: 1)
58
+ * @property {number} [pageSize] - Items per page (default: 20)
59
+ * @property {string} [sort] - Sort parameter
60
+ * @property {string} [filter] - Filter parameter
61
+ * @property {string} [search] - Search term
62
+ */
63
+
64
+ /**
65
+ * List datasources response
66
+ * @typedef {Object} ListDatasourcesResponse
67
+ * @property {ExternalDataSourceResponse[]} items - Array of datasources
68
+ * @property {PaginationMeta} meta - Pagination metadata
69
+ * @property {PaginationLinks} links - Pagination links
70
+ */
71
+
72
+ /** @typedef {ExternalDataSourceCreate} CreateDatasourceRequest */
73
+ /** @typedef {Object} CreateDatasourceResponse @property {ExternalDataSourceResponse} data */
74
+ /** @typedef {Object} GetDatasourceResponse @property {ExternalDataSourceResponse} data */
75
+ /** @typedef {ExternalDataSourceUpdate} UpdateDatasourceRequest */
76
+ /** @typedef {Object} UpdateDatasourceResponse @property {ExternalDataSourceResponse} data */
77
+ /** @typedef {Object} DeleteDatasourceResponse @property {null} data */
78
+
79
+ /**
80
+ * Get datasource config response
81
+ * @typedef {Object} GetDatasourceConfigResponse
82
+ * @property {ExternalDataSourceConfigResponse} data - Full config with MCP contract
83
+ */
84
+
85
+ /**
86
+ * Publish datasource request
87
+ * @typedef {Object} PublishDatasourceRequest
88
+ * @property {boolean} [generateMcpContract] - Whether to generate MCP contract
89
+ */
90
+
91
+ /**
92
+ * Publish datasource response
93
+ * @typedef {Object} PublishDatasourceResponse
94
+ * @property {ExternalDataSourceResponse} data - Published datasource
95
+ */
96
+
97
+ /**
98
+ * Rollback datasource request
99
+ * @typedef {Object} RollbackDatasourceRequest
100
+ * @property {number} version - Version to rollback to
101
+ */
102
+
103
+ /**
104
+ * Rollback datasource response
105
+ * @typedef {Object} RollbackDatasourceResponse
106
+ * @property {ExternalDataSourceResponse} data - Rolled back datasource
107
+ */
108
+
109
+ /**
110
+ * Test datasource request
111
+ * @typedef {Object} TestDatasourceRequest
112
+ * @property {Object} [payloadTemplate] - Payload template for testing
113
+ */
114
+
115
+ /**
116
+ * Test datasource response
117
+ * @typedef {Object} TestDatasourceResponse
118
+ * @property {boolean} success - Test success flag
119
+ * @property {Object} [data] - Test result data
120
+ * @property {string} [message] - Test message
121
+ */
122
+
123
+ /** @typedef {Object} ListDatasourceOpenAPIEndpointsRequest @property {number} [page] @property {number} [pageSize] @property {string} [sort] @property {string} [filter] */
124
+ /** @typedef {Object} ListDatasourceOpenAPIEndpointsResponse @property {Object[]} items @property {Object} meta @property {Object} links */
125
+
126
+ /**
127
+ * CIP execution log response
128
+ * @typedef {Object} CIPExecutionLogResponse
129
+ * @property {string} id - Execution ID
130
+ * @property {string} sourceId - Source ID
131
+ * @property {string} status - Execution status
132
+ * @property {Object} [result] - Execution result
133
+ * @property {string} [error] - Error message if failed
134
+ * @property {string} createdAt - Creation timestamp
135
+ */
136
+
137
+ /** @typedef {Object} ListExecutionLogsRequest @property {number} [page] @property {number} [pageSize] @property {string} [sort] @property {string} [filter] */
138
+ /** @typedef {Object} ListExecutionLogsResponse @property {CIPExecutionLogResponse[]} items @property {Object} meta @property {Object} links */
139
+ /** @typedef {Object} GetExecutionLogResponse @property {CIPExecutionLogResponse} data */
140
+
141
+ /**
142
+ * Bulk operation request
143
+ * @typedef {Object} BulkOperationRequest
144
+ * @property {string} operation - Operation type ('sync' | 'update' | 'delete')
145
+ * @property {Object[]} [records] - Records to process
146
+ * @property {Object} [options] - Operation options
147
+ */
148
+
149
+ /**
150
+ * Bulk operation response
151
+ * @typedef {Object} BulkOperationResponse
152
+ * @property {boolean} success - Operation success flag
153
+ * @property {number} processed - Number of records processed
154
+ * @property {Object} [result] - Operation result
155
+ */
156
+
157
+ /**
158
+ * Get datasource status response
159
+ * @typedef {Object} GetDatasourceStatusResponse
160
+ * @property {Object} data - Status data
161
+ * @property {string} data.status - Sync status
162
+ * @property {string} [data.lastSyncAt] - Last sync timestamp
163
+ * @property {number} [data.recordCount] - Record count
164
+ */
165
+
166
+ /**
167
+ * External record response
168
+ * @typedef {Object} ExternalRecordResponse
169
+ * @property {string} id - Record ID
170
+ * @property {string} key - Record key
171
+ * @property {Object} data - Record data
172
+ * @property {string} createdAt - Creation timestamp
173
+ * @property {string} updatedAt - Update timestamp
174
+ */
175
+
176
+ /** @typedef {Object} ListRecordsRequest @property {number} [page] @property {number} [pageSize] @property {string} [sort] @property {string} [filter] */
177
+ /** @typedef {Object} ListRecordsResponse @property {ExternalRecordResponse[]} items @property {Object} meta @property {Object} links */
178
+ /** @typedef {Object} CreateRecordRequest @property {string} key @property {Object} data */
179
+ /** @typedef {Object} CreateRecordResponse @property {ExternalRecordResponse} data */
180
+ /** @typedef {Object} GetRecordResponse @property {ExternalRecordResponse} data */
181
+ /** @typedef {Object} UpdateRecordRequest @property {Object} data */
182
+ /** @typedef {Object} UpdateRecordResponse @property {ExternalRecordResponse} data */
183
+ /** @typedef {Object} DeleteRecordResponse @property {null} data */
184
+
185
+ /**
186
+ * Access grant response
187
+ * @typedef {Object} AccessGrantResponse
188
+ * @property {string} id - Grant ID
189
+ * @property {string} key - Grant key
190
+ * @property {string} userId - User ID
191
+ * @property {string} [groupId] - Group ID
192
+ * @property {Object} permissions - Permissions
193
+ * @property {string} createdAt - Creation timestamp
194
+ */
195
+
196
+ /** @typedef {Object} ListGrantsRequest @property {number} [page] @property {number} [pageSize] @property {string} [sort] @property {string} [filter] */
197
+ /** @typedef {Object} ListGrantsResponse @property {AccessGrantResponse[]} items @property {Object} meta @property {Object} links */
198
+ /** @typedef {Object} CreateGrantRequest @property {string} key @property {string} userId @property {string} [groupId] @property {Object} permissions */
199
+ /** @typedef {Object} CreateGrantResponse @property {AccessGrantResponse} data */
200
+ /** @typedef {Object} GetGrantResponse @property {AccessGrantResponse} data */
201
+ /** @typedef {Object} UpdateGrantRequest @property {Object} [permissions] */
202
+ /** @typedef {Object} UpdateGrantResponse @property {AccessGrantResponse} data */
203
+ /** @typedef {Object} DeleteGrantResponse @property {null} data */
204
+
205
+ /**
206
+ * Policy response
207
+ * @typedef {Object} PolicyResponse
208
+ * @property {string} id - Policy ID
209
+ * @property {string} key - Policy key
210
+ * @property {string} name - Policy name
211
+ * @property {Object} rules - Policy rules
212
+ */
213
+
214
+ /** @typedef {Object} ListPoliciesRequest @property {number} [page] @property {number} [pageSize] @property {string} [sort] @property {string} [filter] */
215
+ /** @typedef {Object} ListPoliciesResponse @property {PolicyResponse[]} items @property {Object} meta @property {Object} links */
216
+ /** @typedef {Object} AttachPolicyRequest @property {string} policyIdOrKey */
217
+ /** @typedef {Object} AttachPolicyResponse @property {PolicyResponse} data */
218
+ /** @typedef {Object} DetachPolicyResponse @property {null} data */
219
+
220
+ /**
221
+ * Sync job response
222
+ * @typedef {Object} ExternalDataSourceSyncResponse
223
+ * @property {string} id - Sync job ID
224
+ * @property {string} sourceId - Source ID
225
+ * @property {string} status - Sync status
226
+ * @property {Object} [configuration] - Sync configuration
227
+ * @property {string} [lastRunAt] - Last run timestamp
228
+ * @property {string} createdAt - Creation timestamp
229
+ */
230
+
231
+ /** @typedef {Object} ListSyncJobsRequest @property {number} [page] @property {number} [pageSize] @property {string} [sort] @property {string} [filter] */
232
+ /** @typedef {Object} ListSyncJobsResponse @property {ExternalDataSourceSyncResponse[]} items @property {Object} meta @property {Object} links */
233
+ /** @typedef {Object} CreateSyncJobRequest @property {string} key @property {Object} configuration */
234
+ /** @typedef {Object} CreateSyncJobResponse @property {ExternalDataSourceSyncResponse} data */
235
+ /** @typedef {Object} GetSyncJobResponse @property {ExternalDataSourceSyncResponse} data */
236
+ /** @typedef {Object} UpdateSyncJobRequest @property {Object} [configuration] @property {string} [status] */
237
+ /** @typedef {Object} UpdateSyncJobResponse @property {ExternalDataSourceSyncResponse} data */
238
+ /** @typedef {Object} ExecuteSyncJobResponse @property {boolean} success @property {Object} [result] */
239
+
240
+ /**
241
+ * Validate documents request
242
+ * @typedef {Object} ValidateDocumentsRequest
243
+ * @property {Object[]} documents - Array of document metadata to validate
244
+ */
245
+
246
+ /**
247
+ * Validate documents response
248
+ * @typedef {Object} ValidateDocumentsResponse
249
+ * @property {Object[]} needsBinary - Documents that need binary retrieval
250
+ * @property {Object[]} needsUpdate - Documents that need update
251
+ * @property {Object[]} unchanged - Documents that are unchanged
252
+ */
253
+
254
+ /**
255
+ * Bulk documents request
256
+ * @typedef {Object} BulkDocumentsRequest
257
+ * @property {Object[]} documents - Array of documents with binary data
258
+ */
259
+
260
+ /**
261
+ * Bulk documents response
262
+ * @typedef {Object} BulkDocumentsResponse
263
+ * @property {boolean} success - Operation success flag
264
+ * @property {number} processed - Number of documents processed
265
+ * @property {Object} [result] - Operation result
266
+ */
267
+
268
+ /** @typedef {Object} ListDocumentsRequest @property {number} [page] @property {number} [pageSize] @property {string} [sort] @property {string} [filter] */
269
+ /** @typedef {Object} ListDocumentsResponse @property {Object[]} items @property {Object} meta @property {Object} links */
270
+
271
+ module.exports = {};
272
+
@@ -0,0 +1,184 @@
1
+ /**
2
+ * @fileoverview Deployments API type definitions
3
+ * @author AI Fabrix Team
4
+ * @version 2.0.0
5
+ */
6
+
7
+ /**
8
+ * Pagination metadata
9
+ * @typedef {Object} PaginationMeta
10
+ * @property {number} page - Current page number
11
+ * @property {number} pageSize - Number of items per page
12
+ * @property {number} total - Total number of items
13
+ * @property {number} totalPages - Total number of pages
14
+ */
15
+
16
+ /**
17
+ * Pagination links
18
+ * @typedef {Object} PaginationLinks
19
+ * @property {string} self - Current page URL
20
+ * @property {string} first - First page URL
21
+ * @property {string} last - Last page URL
22
+ * @property {string|null} prev - Previous page URL (null if on first page)
23
+ * @property {string|null} next - Next page URL (null if on last page)
24
+ */
25
+
26
+ /**
27
+ * Application configuration (references application-config.schema.yaml)
28
+ * @typedef {Object} ApplicationConfig
29
+ * @property {string} key - Unique application identifier
30
+ * @property {string} displayName - Human-readable application name
31
+ * @property {string} description - Application description
32
+ * @property {string} type - Azure application type
33
+ * @property {string} deploymentKey - SHA256 hash of deployment manifest
34
+ * @property {*} [additionalProperties] - Additional configuration properties
35
+ */
36
+
37
+ /**
38
+ * Deploy application request
39
+ * @typedef {Object} DeployApplicationRequest
40
+ * @property {string} applicationKey - Application key to deploy
41
+ * @property {string} image - Container image path
42
+ * @property {ApplicationConfig} [configuration] - Additional deployment configuration
43
+ * @property {boolean} [dryRun] - If true, perform a dry run without actually deploying
44
+ */
45
+
46
+ /**
47
+ * Deploy application response
48
+ * @typedef {Object} DeployApplicationResponse
49
+ * @property {boolean} success - Request success flag
50
+ * @property {Object} data - Deployment data
51
+ * @property {string} data.deploymentId - Deployment ID
52
+ * @property {string} data.jobId - Job ID
53
+ * @property {string} data.status - Deployment status
54
+ * @property {string} data.message - Deployment message
55
+ * @property {string} timestamp - Response timestamp (ISO 8601)
56
+ */
57
+
58
+ /**
59
+ * Deploy environment request
60
+ * @typedef {Object} DeployEnvironmentRequest
61
+ * @property {Object} environmentConfig - Environment configuration
62
+ * @property {string} environmentConfig.key - Environment key
63
+ * @property {string} environmentConfig.environment - Environment type ('dev' | 'tst' | 'pro')
64
+ * @property {string} environmentConfig.preset - Deployment preset size ('eval' | 's' | 'm' | 'l' | 'xl')
65
+ * @property {string} environmentConfig.serviceName - Service name for resource naming
66
+ * @property {string} environmentConfig.location - Azure region location
67
+ * @property {string} [environmentConfig.resourceGroupName] - Optional resource group name override
68
+ * @property {string} [environmentConfig.subscriptionId] - Optional Azure subscription ID override
69
+ * @property {Object} [environmentConfig.customDomain] - Custom domain configuration
70
+ * @property {Object} [environmentConfig.frontDoor] - Front Door configuration
71
+ * @property {Object} [environmentConfig.networking] - Networking configuration
72
+ * @property {string[]} [environmentConfig.allowedIPs] - Allowed IP addresses
73
+ * @property {Object[]} [environmentConfig.infrastructureAccess] - Infrastructure access configuration
74
+ * @property {boolean} [dryRun] - If true, perform a dry run without actually deploying
75
+ */
76
+
77
+ /**
78
+ * Deploy environment response
79
+ * @typedef {Object} DeployEnvironmentResponse
80
+ * @property {Object} data - Deployment data
81
+ * @property {string} data.deploymentId - Deployment ID
82
+ * @property {string} data.jobId - Job ID
83
+ * @property {string} data.status - Deployment status
84
+ * @property {string} data.message - Deployment message
85
+ */
86
+
87
+ /**
88
+ * List deployments request options
89
+ * @typedef {Object} ListDeploymentsRequest
90
+ * @property {number} [page] - Page number (default: 1)
91
+ * @property {number} [pageSize] - Items per page (default: 10)
92
+ * @property {string} [sort] - Sort parameter
93
+ * @property {string} [filter] - Filter parameter
94
+ * @property {string} [search] - Search term to match across deployment fields
95
+ * @property {string} [status] - Filter by deployment status (legacy parameter)
96
+ * @property {string} [deploymentType] - Filter by deployment type (legacy parameter)
97
+ */
98
+
99
+ /**
100
+ * Deployment entity
101
+ * @typedef {Object} Deployment
102
+ * @property {string} id - Deployment ID
103
+ * @property {string} deploymentType - Deployment type ('application' | 'infrastructure')
104
+ * @property {string} targetId - Target ID (application key or environment key)
105
+ * @property {string} environment - Environment key
106
+ * @property {string} status - Deployment status
107
+ * @property {ApplicationConfig} [configuration] - Deployment configuration
108
+ * @property {boolean} dryRun - Whether this was a dry run
109
+ * @property {string} createdAt - Creation timestamp (ISO 8601)
110
+ * @property {string} updatedAt - Update timestamp (ISO 8601)
111
+ */
112
+
113
+ /**
114
+ * List deployments response
115
+ * @typedef {Object} ListDeploymentsResponse
116
+ * @property {PaginationMeta} meta - Pagination metadata
117
+ * @property {Deployment[]} data - Array of deployments
118
+ * @property {PaginationLinks} links - Pagination links
119
+ */
120
+
121
+ /**
122
+ * Job log entry
123
+ * @typedef {Object} JobLog
124
+ * @property {string} id - Log entry ID
125
+ * @property {string} jobId - Job ID
126
+ * @property {string} level - Log level ('debug' | 'info' | 'warn' | 'error')
127
+ * @property {string} message - Log message
128
+ * @property {string} timestamp - Log timestamp (ISO 8601)
129
+ * @property {Object} [details] - Additional log details
130
+ * @property {string|null} [correlationId] - Correlation ID
131
+ */
132
+
133
+ /**
134
+ * Deployment job
135
+ * @typedef {Object} DeploymentJob
136
+ * @property {string} id - Job ID
137
+ * @property {string} jobId - Job identifier
138
+ * @property {string} jobType - Job type
139
+ * @property {string} status - Job status
140
+ * @property {number} progress - Job progress (0-100)
141
+ * @property {string|null} message - Job message
142
+ * @property {string|null} error - Job error message
143
+ * @property {string|null} startedAt - Job start timestamp (ISO 8601)
144
+ * @property {string|null} completedAt - Job completion timestamp (ISO 8601)
145
+ * @property {JobLog[]} logs - Job logs
146
+ */
147
+
148
+ /**
149
+ * Deployment with jobs
150
+ * @typedef {Object} DeploymentWithJobs
151
+ * @property {string} id - Deployment ID
152
+ * @property {string} deploymentType - Deployment type
153
+ * @property {string} targetId - Target ID
154
+ * @property {string} environment - Environment key
155
+ * @property {string} status - Deployment status
156
+ * @property {ApplicationConfig} [configuration] - Deployment configuration
157
+ * @property {boolean} dryRun - Whether this was a dry run
158
+ * @property {string} createdAt - Creation timestamp (ISO 8601)
159
+ * @property {string} updatedAt - Update timestamp (ISO 8601)
160
+ * @property {DeploymentJob[]} jobs - Array of deployment jobs
161
+ */
162
+
163
+ /**
164
+ * Get deployment response
165
+ * @typedef {Object} GetDeploymentResponse
166
+ * @property {DeploymentWithJobs} data - Full deployment record with jobs and logs
167
+ */
168
+
169
+ /**
170
+ * Get deployment logs request options
171
+ * @typedef {Object} GetDeploymentLogsRequest
172
+ * @property {string} [jobId] - Filter logs for specific job ID
173
+ * @property {string} [level] - Filter by log level ('debug' | 'info' | 'warn' | 'error')
174
+ * @property {string} [since] - Get logs since timestamp (ISO 8601) for incremental updates
175
+ */
176
+
177
+ /**
178
+ * Get deployment logs response
179
+ * @typedef {Object} GetDeploymentLogsResponse
180
+ * @property {JobLog[]} data - Array of job logs
181
+ */
182
+
183
+ module.exports = {};
184
+