@friggframework/core 2.0.0--canary.548.c8ae0ca.0 → 2.0.0--canary.545.c40eca4.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 (237) hide show
  1. package/CHANGELOG.md +66 -67
  2. package/CLAUDE.md +148 -124
  3. package/README.md +165 -130
  4. package/admin-scripts/index.js +52 -0
  5. package/admin-scripts/repositories/admin-api-key-repository-documentdb.js +21 -0
  6. package/admin-scripts/repositories/admin-api-key-repository-factory.js +51 -0
  7. package/admin-scripts/repositories/admin-api-key-repository-interface.js +121 -0
  8. package/admin-scripts/repositories/admin-api-key-repository-mongo.js +155 -0
  9. package/admin-scripts/repositories/admin-api-key-repository-postgres.js +189 -0
  10. package/admin-scripts/repositories/admin-process-repository-documentdb.js +21 -0
  11. package/admin-scripts/repositories/admin-process-repository-factory.js +49 -0
  12. package/admin-scripts/repositories/admin-process-repository-interface.js +150 -0
  13. package/admin-scripts/repositories/admin-process-repository-mongo.js +213 -0
  14. package/admin-scripts/repositories/admin-process-repository-postgres.js +251 -0
  15. package/admin-scripts/repositories/script-execution-repository-documentdb.js +21 -0
  16. package/admin-scripts/repositories/script-execution-repository-factory.js +51 -0
  17. package/admin-scripts/repositories/script-execution-repository-interface.js +193 -0
  18. package/admin-scripts/repositories/script-execution-repository-mongo.js +278 -0
  19. package/admin-scripts/repositories/script-execution-repository-postgres.js +320 -0
  20. package/admin-scripts/repositories/script-schedule-repository-documentdb.js +21 -0
  21. package/admin-scripts/repositories/script-schedule-repository-factory.js +49 -0
  22. package/admin-scripts/repositories/script-schedule-repository-interface.js +108 -0
  23. package/admin-scripts/repositories/script-schedule-repository-mongo.js +179 -0
  24. package/admin-scripts/repositories/script-schedule-repository-postgres.js +210 -0
  25. package/application/commands/admin-script-commands.js +348 -0
  26. package/application/commands/integration-commands.js +12 -6
  27. package/application/index.js +5 -3
  28. package/assertions/get.js +17 -7
  29. package/associations/association.js +59 -57
  30. package/core/CLAUDE.md +222 -156
  31. package/core/Worker.js +33 -12
  32. package/credential/credential-router.js +262 -0
  33. package/credential/repositories/credential-repository-documentdb.js +71 -1
  34. package/credential/repositories/credential-repository-factory.js +4 -6
  35. package/credential/repositories/credential-repository-interface.js +8 -2
  36. package/credential/repositories/credential-repository-mongo.js +45 -4
  37. package/credential/repositories/credential-repository-postgres.js +44 -3
  38. package/credential/repositories/credential-repository.js +3 -1
  39. package/credential/use-cases/delete-credential-for-user.js +50 -0
  40. package/credential/use-cases/get-credential-for-user.js +21 -3
  41. package/credential/use-cases/list-credentials-for-user.js +31 -0
  42. package/credential/use-cases/reauthorize-credential.js +103 -0
  43. package/credential/use-cases/update-authentication-status.js +5 -2
  44. package/database/MONGODB_TRANSACTION_FIX.md +72 -52
  45. package/database/config.js +13 -59
  46. package/database/documentdb-encryption-service.js +29 -13
  47. package/database/documentdb-utils.js +21 -12
  48. package/database/encryption/README.md +53 -36
  49. package/database/encryption/encryption-schema-registry.js +29 -23
  50. package/database/encryption/field-encryption-service.js +15 -4
  51. package/database/encryption/logger.js +3 -2
  52. package/database/encryption/prisma-encryption-extension.js +5 -8
  53. package/database/prisma.js +22 -14
  54. package/database/repositories/health-check-repository-factory.js +7 -5
  55. package/database/repositories/health-check-repository-interface.js +15 -5
  56. package/database/repositories/health-check-repository-postgres.js +1 -1
  57. package/database/use-cases/check-database-health-use-case.js +3 -2
  58. package/database/use-cases/check-database-state-use-case.js +8 -7
  59. package/database/use-cases/get-database-state-via-worker-use-case.js +15 -12
  60. package/database/use-cases/get-migration-status-use-case.js +4 -2
  61. package/database/use-cases/run-database-migration-use-case.js +41 -9
  62. package/database/use-cases/test-encryption-use-case.js +4 -5
  63. package/database/use-cases/trigger-database-migration-use-case.js +9 -8
  64. package/database/utils/mongodb-collection-utils.js +11 -3
  65. package/database/utils/mongodb-schema-init.js +10 -4
  66. package/database/utils/prisma-runner.js +144 -74
  67. package/database/utils/prisma-schema-parser.js +2 -2
  68. package/docs/PROCESS_MANAGEMENT_QUEUE_SPEC.md +135 -80
  69. package/encrypt/Cryptor.js +54 -49
  70. package/encrypt/aes-encryption-key-provider.js +82 -0
  71. package/encrypt/encryption-key-provider-interface.js +50 -0
  72. package/errors/fetch-error.js +1 -1
  73. package/generated/prisma-mongodb/edge.js +59 -4
  74. package/generated/prisma-mongodb/index-browser.js +49 -1
  75. package/generated/prisma-mongodb/index.d.ts +4023 -61
  76. package/generated/prisma-mongodb/index.js +59 -4
  77. package/generated/prisma-mongodb/package.json +1 -1
  78. package/generated/prisma-mongodb/schema.prisma +87 -0
  79. package/generated/prisma-mongodb/wasm.js +59 -4
  80. package/generated/prisma-postgresql/edge.js +58 -4
  81. package/generated/prisma-postgresql/index-browser.js +48 -1
  82. package/generated/prisma-postgresql/index.d.ts +4738 -54
  83. package/generated/prisma-postgresql/index.js +58 -4
  84. package/generated/prisma-postgresql/package.json +1 -1
  85. package/generated/prisma-postgresql/schema.prisma +85 -0
  86. package/generated/prisma-postgresql/wasm.js +58 -4
  87. package/handlers/WEBHOOKS.md +104 -81
  88. package/handlers/app-definition-loader.js +53 -10
  89. package/handlers/app-handler-helpers.js +14 -3
  90. package/handlers/backend-utils.js +0 -1
  91. package/handlers/database-migration-handler.js +64 -45
  92. package/handlers/middleware/admin-auth.js +53 -0
  93. package/handlers/routers/HEALTHCHECK.md +170 -135
  94. package/handlers/routers/admin.js +474 -0
  95. package/handlers/routers/auth.js +51 -9
  96. package/handlers/routers/db-migration.handler.js +2 -3
  97. package/handlers/routers/db-migration.js +102 -66
  98. package/handlers/routers/docs.js +180 -0
  99. package/handlers/routers/health.js +84 -283
  100. package/handlers/routers/integration-defined-routers.js +44 -33
  101. package/handlers/routers/integration-webhook-routers.js +73 -52
  102. package/handlers/routers/middleware/loadUser.js +39 -0
  103. package/handlers/routers/middleware/requireAdmin.js +43 -0
  104. package/handlers/routers/middleware/requireLoggedInUser.js +19 -0
  105. package/handlers/routers/user.js +30 -14
  106. package/handlers/routers/websocket.js +18 -4
  107. package/handlers/use-cases/check-integrations-health-use-case.js +13 -6
  108. package/handlers/workers/db-migration.js +74 -35
  109. package/handlers/workers/integration-defined-workers.js +31 -20
  110. package/index.js +50 -16
  111. package/infrastructure/scheduler/index.js +15 -11
  112. package/infrastructure/scheduler/netlify-scheduler-adapter.js +185 -0
  113. package/infrastructure/scheduler/scheduler-service-factory.js +38 -31
  114. package/integrations/WEBHOOK-QUICKSTART.md +21 -14
  115. package/integrations/index.js +4 -0
  116. package/integrations/integration-base.js +9 -6
  117. package/integrations/integration-router.js +1828 -157
  118. package/integrations/options.js +47 -20
  119. package/integrations/repositories/integration-mapping-repository-factory.js +4 -8
  120. package/integrations/repositories/integration-repository-documentdb.js +53 -24
  121. package/integrations/repositories/integration-repository-factory.js +6 -6
  122. package/integrations/repositories/integration-repository-interface.js +27 -9
  123. package/integrations/repositories/integration-repository-postgres.js +3 -3
  124. package/integrations/repositories/process-repository-factory.js +4 -7
  125. package/integrations/repositories/process-repository-interface.js +9 -5
  126. package/integrations/repositories/process-repository-mongo.js +7 -3
  127. package/integrations/repositories/process-repository-postgres.js +2 -2
  128. package/integrations/tests/doubles/config-capturing-integration.js +9 -8
  129. package/integrations/tests/doubles/dummy-integration-class.js +81 -8
  130. package/integrations/tests/doubles/test-integration-repository.js +51 -11
  131. package/integrations/use-cases/create-integration.js +36 -32
  132. package/integrations/use-cases/create-process.js +20 -9
  133. package/integrations/use-cases/delete-integration-for-user.js +5 -4
  134. package/integrations/use-cases/execute-proxy-request.js +564 -0
  135. package/integrations/use-cases/get-integration-for-user.js +25 -10
  136. package/integrations/use-cases/get-integration-instance-by-definition.js +13 -7
  137. package/integrations/use-cases/get-integrations-for-user.js +4 -1
  138. package/integrations/use-cases/get-possible-integrations.js +1 -1
  139. package/integrations/use-cases/get-process.js +5 -6
  140. package/integrations/use-cases/index.js +3 -1
  141. package/integrations/use-cases/load-integration-context.js +1 -5
  142. package/integrations/use-cases/update-process-state.js +10 -8
  143. package/integrations/utils/map-integration-dto.js +9 -3
  144. package/jest-setup.js +1 -1
  145. package/jest-teardown.js +1 -1
  146. package/lambda/TimeoutCatcher.js +32 -30
  147. package/lambda/index.js +1 -1
  148. package/logs/index.js +3 -3
  149. package/modules/domain/entities/AuthorizationSession.js +131 -0
  150. package/modules/domain/entities/index.js +10 -0
  151. package/modules/module.js +4 -9
  152. package/modules/repositories/authorization-session-repository-factory.js +53 -0
  153. package/modules/repositories/authorization-session-repository-interface.js +75 -0
  154. package/modules/repositories/authorization-session-repository-mongo.js +169 -0
  155. package/modules/repositories/authorization-session-repository-postgres.js +170 -0
  156. package/modules/repositories/module-repository-documentdb.js +89 -41
  157. package/modules/repositories/module-repository-factory.js +4 -6
  158. package/modules/repositories/module-repository-interface.js +13 -0
  159. package/modules/repositories/module-repository-mongo.js +40 -5
  160. package/modules/repositories/module-repository-postgres.js +42 -5
  161. package/modules/repositories/module-repository.js +28 -0
  162. package/modules/requester/api-key.js +0 -2
  163. package/modules/requester/basic.js +0 -1
  164. package/modules/requester/oauth-2.js +3 -14
  165. package/modules/test/mock-api/definition.js +15 -10
  166. package/modules/test/mock-api/mocks/hubspot.js +36 -36
  167. package/modules/tests/doubles/test-module-factory.js +10 -4
  168. package/modules/tests/doubles/test-module-repository.js +1 -1
  169. package/modules/use-cases/delete-module-entity.js +23 -0
  170. package/modules/use-cases/get-authorization-requirements.js +110 -0
  171. package/modules/use-cases/get-entities-for-user.js +1 -1
  172. package/modules/use-cases/get-entity-options-by-id.js +8 -6
  173. package/modules/use-cases/get-module-entity-by-id.js +16 -0
  174. package/modules/use-cases/get-module.js +12 -9
  175. package/modules/use-cases/process-authorization-callback.js +12 -6
  176. package/modules/use-cases/process-authorization-step.js +160 -0
  177. package/modules/use-cases/refresh-entity-options.js +8 -6
  178. package/modules/use-cases/start-authorization-session.js +86 -0
  179. package/modules/use-cases/test-module-auth.js +8 -6
  180. package/modules/use-cases/update-module-entity.js +27 -0
  181. package/modules/utils/map-module-dto.js +2 -2
  182. package/openapi/openapi-spec-generator.js +370 -0
  183. package/openapi/openapi-v1.yaml +1360 -0
  184. package/openapi/openapi-v2.yaml +1535 -0
  185. package/package.json +7 -9
  186. package/prisma-mongodb/schema.prisma +87 -0
  187. package/prisma-postgresql/migrations/20260222000000_add_admin_process_and_script_schedule/migration.sql +55 -0
  188. package/prisma-postgresql/schema.prisma +85 -0
  189. package/providers/index.js +13 -0
  190. package/providers/resolve-provider.js +93 -0
  191. package/queues/index.js +19 -0
  192. package/queues/providers/index.js +7 -0
  193. package/queues/providers/netlify-background-provider.js +76 -0
  194. package/queues/providers/qstash-queue-provider.js +122 -0
  195. package/queues/queue-client-interface.js +55 -0
  196. package/queues/queue-provider-factory.js +93 -0
  197. package/queues/queue-provider.js +46 -0
  198. package/queues/queuer-util.js +33 -25
  199. package/syncs/repositories/sync-repository-documentdb.js +39 -19
  200. package/syncs/repositories/sync-repository-factory.js +4 -4
  201. package/syncs/repositories/sync-repository-interface.js +6 -2
  202. package/syncs/repositories/sync-repository-postgres.js +19 -13
  203. package/syncs/sync.js +104 -100
  204. package/token/repositories/token-repository-factory.js +4 -6
  205. package/types/assertions/index.d.ts +72 -72
  206. package/types/core/index.d.ts +98 -53
  207. package/types/errors/index.d.ts +61 -54
  208. package/types/eslint-config/index.d.ts +40 -40
  209. package/types/lambda/index.d.ts +26 -26
  210. package/types/logs/index.d.ts +4 -4
  211. package/types/prettier-config/index.d.ts +5 -5
  212. package/types/test-environment/index.d.ts +14 -14
  213. package/types/tsconfig.json +95 -93
  214. package/user/repositories/user-repository-factory.js +4 -4
  215. package/user/tests/doubles/test-user-repository.js +5 -2
  216. package/user/use-cases/authenticate-user.js +2 -4
  217. package/user/use-cases/authenticate-with-shared-secret.js +1 -1
  218. package/user/use-cases/create-individual-user.js +8 -7
  219. package/user/use-cases/create-organization-user.js +1 -1
  220. package/user/use-cases/create-token-for-user-id.js +1 -1
  221. package/user/use-cases/delete-user.js +47 -0
  222. package/user/use-cases/get-user-from-adopter-jwt.js +0 -2
  223. package/user/use-cases/get-user-from-bearer-token.js +7 -3
  224. package/user/use-cases/get-user-from-x-frigg-headers.js +14 -11
  225. package/user/use-cases/login-user.js +8 -8
  226. package/user/user.js +18 -4
  227. package/utils/backend-path.js +2 -2
  228. package/utils/index.js +4 -1
  229. package/websocket/repositories/websocket-connection-repository-documentdb.js +46 -21
  230. package/websocket/repositories/websocket-connection-repository-factory.js +4 -8
  231. package/websocket/repositories/websocket-connection-repository-mongo.js +26 -16
  232. package/websocket/repositories/websocket-connection-repository-postgres.js +26 -15
  233. package/websocket/repositories/websocket-connection-repository.js +26 -20
  234. package/websocket/websocket-message-sender-interface.js +38 -0
  235. package/database/adapters/lambda-invoker.js +0 -97
  236. package/database/repositories/migration-status-repository-s3.js +0 -137
  237. package/infrastructure/scheduler/eventbridge-scheduler-adapter.js +0 -184
@@ -0,0 +1,1360 @@
1
+ openapi: 3.0.3
2
+ info:
3
+ title: Frigg Framework API (v1)
4
+ version: 1.0.0
5
+ description: |
6
+ Enterprise-grade serverless integration framework API for managing integrations,
7
+ entities, credentials, and proxying requests to external systems.
8
+
9
+ ## API Version: v1 (Legacy)
10
+
11
+ This is the **v1 API** which provides backwards compatibility with existing integrations.
12
+ For new implementations, consider using the [v2 API](/api/v2/docs) which offers cleaner
13
+ response structures with better separation of concerns.
14
+
15
+ ### Key v1 Behaviors
16
+
17
+ - `GET /api/integrations` returns a **combined response** with entities and integrations
18
+ - Entity options and authorized entities are nested under the `entities` key
19
+ - This format is maintained for backwards compatibility
20
+
21
+ ## Overview
22
+ The Frigg Framework enables direct/native integrations between products and external
23
+ software partners through a standardized API that handles authentication, authorization,
24
+ and data synchronization.
25
+
26
+ ## Key Concepts
27
+ - **Entities**: Connected accounts representing external integrations (e.g., a HubSpot account)
28
+ - **Credentials**: Authentication data for external systems (OAuth tokens, API keys)
29
+ - **Integrations**: Configured bidirectional sync relationships between entities
30
+ - **Proxy**: Secure API forwarding to external systems using stored credentials
31
+
32
+ ## Authentication
33
+ All API endpoints require Bearer token authentication unless otherwise noted.
34
+ contact:
35
+ name: Frigg Framework
36
+ url: https://friggframework.org
37
+ license:
38
+ name: MIT
39
+
40
+ servers:
41
+ - url: http://localhost:3000
42
+ description: Local development server
43
+ - url: https://api.{stage}.friggframework.org
44
+ description: Production environments
45
+ variables:
46
+ stage:
47
+ default: prod
48
+ enum:
49
+ - dev
50
+ - staging
51
+ - prod
52
+
53
+ security:
54
+ - bearerAuth: []
55
+
56
+ tags:
57
+ - name: Integrations
58
+ description: |
59
+ Integration management endpoints.
60
+
61
+ **v1 Note**: `GET /api/integrations` returns a combined response including
62
+ entities and integration options for backwards compatibility.
63
+ - name: Authorization
64
+ description: OAuth and authentication flows for connecting external systems
65
+ - name: Entities
66
+ description: Connected accounts and entity management
67
+ - name: Credentials
68
+ description: Credential management and reauthorization
69
+ - name: Health
70
+ description: Service health and readiness checks
71
+
72
+ paths:
73
+ # Integration Endpoints (v1 combined response)
74
+ /api/integrations:
75
+ get:
76
+ tags:
77
+ - Integrations
78
+ summary: List integrations with entities (v1 combined response)
79
+ description: |
80
+ Retrieve user's integrations along with available integration options and authorized entities.
81
+
82
+ **v1 Response Format**: This endpoint returns a combined response for backwards compatibility:
83
+ - `entities.options`: Available integration types that can be connected
84
+ - `entities.authorized`: User's connected entities (accounts)
85
+ - `integrations`: User's active integrations
86
+
87
+ **Migration Note**: In v2, these are split into separate endpoints:
88
+ - `GET /api/v2/integrations` - Returns only integrations
89
+ - `GET /api/v2/integrations/options` - Returns available options
90
+ - `GET /api/v2/entities` - Returns authorized entities
91
+ operationId: listIntegrationsV1
92
+ responses:
93
+ '200':
94
+ description: Combined integrations and entities response
95
+ content:
96
+ application/json:
97
+ schema:
98
+ $ref: '#/components/schemas/ListIntegrationsV1Response'
99
+ example:
100
+ entities:
101
+ options:
102
+ - type: hubspot
103
+ name: HubSpot
104
+ description: HubSpot CRM integration
105
+ hasAuth: true
106
+ - type: salesforce
107
+ name: Salesforce
108
+ description: Salesforce CRM integration
109
+ hasAuth: true
110
+ authorized:
111
+ - id: entity-123
112
+ type: hubspot
113
+ name: My HubSpot Account
114
+ externalId: hub-12345
115
+ credential_id: cred-abc
116
+ integrations:
117
+ - id: int-456
118
+ userId: user-789
119
+ config:
120
+ type: hubspot-salesforce
121
+ status: ENABLED
122
+ entities:
123
+ - entity-123
124
+ - entity-456
125
+ '401':
126
+ $ref: '#/components/responses/Unauthorized'
127
+
128
+ post:
129
+ tags:
130
+ - Integrations
131
+ summary: Create integration
132
+ description: Create a new integration between two or more entities
133
+ operationId: createIntegration
134
+ requestBody:
135
+ required: true
136
+ content:
137
+ application/json:
138
+ schema:
139
+ $ref: '#/components/schemas/CreateIntegrationRequest'
140
+ responses:
141
+ '201':
142
+ description: Integration created successfully
143
+ content:
144
+ application/json:
145
+ schema:
146
+ $ref: '#/components/schemas/Integration'
147
+ '400':
148
+ $ref: '#/components/responses/BadRequest'
149
+ '401':
150
+ $ref: '#/components/responses/Unauthorized'
151
+
152
+ /api/integrations/options:
153
+ get:
154
+ tags:
155
+ - Integrations
156
+ summary: List available integration types
157
+ description: Get available integration types that can be configured
158
+ operationId: listIntegrationOptions
159
+ responses:
160
+ '200':
161
+ description: List of available integration types
162
+ content:
163
+ application/json:
164
+ schema:
165
+ $ref: '#/components/schemas/ListIntegrationOptionsResponse'
166
+ '401':
167
+ $ref: '#/components/responses/Unauthorized'
168
+
169
+ /api/integrations/{integrationId}:
170
+ get:
171
+ tags:
172
+ - Integrations
173
+ summary: Get integration
174
+ description: Retrieve detailed information about a specific integration
175
+ operationId: getIntegration
176
+ parameters:
177
+ - $ref: '#/components/parameters/IntegrationId'
178
+ responses:
179
+ '200':
180
+ description: Integration retrieved successfully
181
+ content:
182
+ application/json:
183
+ schema:
184
+ $ref: '#/components/schemas/Integration'
185
+ '401':
186
+ $ref: '#/components/responses/Unauthorized'
187
+ '404':
188
+ $ref: '#/components/responses/NotFound'
189
+
190
+ patch:
191
+ tags:
192
+ - Integrations
193
+ summary: Update integration
194
+ description: Update integration configuration
195
+ operationId: updateIntegration
196
+ parameters:
197
+ - $ref: '#/components/parameters/IntegrationId'
198
+ requestBody:
199
+ required: true
200
+ content:
201
+ application/json:
202
+ schema:
203
+ $ref: '#/components/schemas/UpdateIntegrationRequest'
204
+ responses:
205
+ '200':
206
+ description: Integration updated successfully
207
+ content:
208
+ application/json:
209
+ schema:
210
+ $ref: '#/components/schemas/Integration'
211
+ '400':
212
+ $ref: '#/components/responses/BadRequest'
213
+ '401':
214
+ $ref: '#/components/responses/Unauthorized'
215
+ '404':
216
+ $ref: '#/components/responses/NotFound'
217
+
218
+ delete:
219
+ tags:
220
+ - Integrations
221
+ summary: Delete integration
222
+ description: Delete an integration (entities and credentials remain)
223
+ operationId: deleteIntegration
224
+ parameters:
225
+ - $ref: '#/components/parameters/IntegrationId'
226
+ responses:
227
+ '200':
228
+ description: Integration deleted successfully
229
+ content:
230
+ application/json:
231
+ schema:
232
+ type: object
233
+ properties:
234
+ success:
235
+ type: boolean
236
+ '401':
237
+ $ref: '#/components/responses/Unauthorized'
238
+ '404':
239
+ $ref: '#/components/responses/NotFound'
240
+
241
+ # Authorization Endpoints
242
+ /api/authorize:
243
+ get:
244
+ tags:
245
+ - Authorization
246
+ summary: Get authorization requirements
247
+ description: |
248
+ Retrieve the authentication requirements for a given entity type and step.
249
+ Used to start or continue a multi-step authorization flow.
250
+ operationId: getAuthorizationRequirements
251
+ parameters:
252
+ - name: entityType
253
+ in: query
254
+ required: true
255
+ schema:
256
+ type: string
257
+ description: Module/entity type to authorize (e.g., 'hubspot', 'salesforce')
258
+ - name: step
259
+ in: query
260
+ schema:
261
+ type: integer
262
+ minimum: 1
263
+ default: 1
264
+ description: Current step number (for multi-step flows)
265
+ - name: sessionId
266
+ in: query
267
+ schema:
268
+ type: string
269
+ description: Session ID from previous step (required for step > 1)
270
+ responses:
271
+ '200':
272
+ description: Authorization requirements retrieved successfully
273
+ content:
274
+ application/json:
275
+ schema:
276
+ $ref: '#/components/schemas/AuthorizationRequirements'
277
+ '400':
278
+ $ref: '#/components/responses/BadRequest'
279
+ '401':
280
+ $ref: '#/components/responses/Unauthorized'
281
+ '404':
282
+ $ref: '#/components/responses/NotFound'
283
+
284
+ post:
285
+ tags:
286
+ - Authorization
287
+ summary: Submit authorization data
288
+ description: |
289
+ Submit authentication data to authorize an entity. This may complete the
290
+ authorization or return next step requirements for multi-step flows.
291
+ operationId: submitAuthorization
292
+ requestBody:
293
+ required: true
294
+ content:
295
+ application/json:
296
+ schema:
297
+ $ref: '#/components/schemas/AuthorizationRequest'
298
+ responses:
299
+ '200':
300
+ description: Authorization completed or next step returned
301
+ content:
302
+ application/json:
303
+ schema:
304
+ $ref: '#/components/schemas/AuthorizationResponse'
305
+ '400':
306
+ $ref: '#/components/responses/BadRequest'
307
+ '401':
308
+ $ref: '#/components/responses/Unauthorized'
309
+ '422':
310
+ $ref: '#/components/responses/ValidationError'
311
+
312
+ # Entity Endpoints
313
+ /api/entities:
314
+ get:
315
+ tags:
316
+ - Entities
317
+ summary: List user's entities
318
+ description: Retrieve all entities owned by the authenticated user
319
+ operationId: listEntities
320
+ responses:
321
+ '200':
322
+ description: List of entities retrieved successfully
323
+ content:
324
+ application/json:
325
+ schema:
326
+ $ref: '#/components/schemas/ListEntitiesResponse'
327
+ '401':
328
+ $ref: '#/components/responses/Unauthorized'
329
+
330
+ post:
331
+ tags:
332
+ - Entities
333
+ summary: Create entity from credential
334
+ description: Create a new entity linked to an existing credential
335
+ operationId: createEntity
336
+ requestBody:
337
+ required: true
338
+ content:
339
+ application/json:
340
+ schema:
341
+ $ref: '#/components/schemas/CreateEntityRequest'
342
+ responses:
343
+ '201':
344
+ description: Entity created successfully
345
+ content:
346
+ application/json:
347
+ schema:
348
+ $ref: '#/components/schemas/CreateEntityResponse'
349
+ '400':
350
+ $ref: '#/components/responses/BadRequest'
351
+ '401':
352
+ $ref: '#/components/responses/Unauthorized'
353
+ '422':
354
+ $ref: '#/components/responses/ValidationError'
355
+
356
+ /api/entities/types:
357
+ get:
358
+ tags:
359
+ - Entities
360
+ summary: List available entity types
361
+ description: Get a list of all available entity types (API modules) that can be integrated
362
+ operationId: listEntityTypes
363
+ responses:
364
+ '200':
365
+ description: List of available entity types
366
+ content:
367
+ application/json:
368
+ schema:
369
+ $ref: '#/components/schemas/ListEntityTypesResponse'
370
+ '401':
371
+ $ref: '#/components/responses/Unauthorized'
372
+
373
+ /api/entities/types/{typeName}:
374
+ get:
375
+ tags:
376
+ - Entities
377
+ summary: Get entity type metadata
378
+ description: Retrieve detailed information about a specific entity type
379
+ operationId: getEntityType
380
+ parameters:
381
+ - $ref: '#/components/parameters/TypeName'
382
+ responses:
383
+ '200':
384
+ description: Entity type metadata retrieved successfully
385
+ content:
386
+ application/json:
387
+ schema:
388
+ $ref: '#/components/schemas/EntityType'
389
+ '401':
390
+ $ref: '#/components/responses/Unauthorized'
391
+ '404':
392
+ $ref: '#/components/responses/NotFound'
393
+
394
+ /api/entities/types/{typeName}/requirements:
395
+ get:
396
+ tags:
397
+ - Entities
398
+ summary: Get authentication requirements for entity type
399
+ description: |
400
+ Get the authentication requirements (OAuth URLs, form schemas, etc.)
401
+ needed to authorize this entity type
402
+ operationId: getEntityTypeRequirements
403
+ parameters:
404
+ - $ref: '#/components/parameters/TypeName'
405
+ - name: step
406
+ in: query
407
+ schema:
408
+ type: integer
409
+ minimum: 1
410
+ default: 1
411
+ description: Step number for multi-step auth flows
412
+ responses:
413
+ '200':
414
+ description: Authentication requirements retrieved successfully
415
+ content:
416
+ application/json:
417
+ schema:
418
+ $ref: '#/components/schemas/AuthorizationRequirements'
419
+ '401':
420
+ $ref: '#/components/responses/Unauthorized'
421
+ '404':
422
+ $ref: '#/components/responses/NotFound'
423
+
424
+ /api/entities/{entityId}:
425
+ get:
426
+ tags:
427
+ - Entities
428
+ summary: Get specific entity
429
+ description: Retrieve detailed information about a specific entity
430
+ operationId: getEntity
431
+ parameters:
432
+ - $ref: '#/components/parameters/EntityId'
433
+ responses:
434
+ '200':
435
+ description: Entity retrieved successfully
436
+ content:
437
+ application/json:
438
+ schema:
439
+ $ref: '#/components/schemas/Entity'
440
+ '401':
441
+ $ref: '#/components/responses/Unauthorized'
442
+ '404':
443
+ $ref: '#/components/responses/NotFound'
444
+
445
+ /api/entities/{entityId}/test-auth:
446
+ get:
447
+ tags:
448
+ - Entities
449
+ summary: Test entity authentication
450
+ description: Verify that the entity's credentials are valid and working
451
+ operationId: testEntityAuth
452
+ parameters:
453
+ - $ref: '#/components/parameters/EntityId'
454
+ responses:
455
+ '200':
456
+ description: Authentication test result
457
+ content:
458
+ application/json:
459
+ schema:
460
+ $ref: '#/components/schemas/TestAuthResponse'
461
+ '401':
462
+ $ref: '#/components/responses/Unauthorized'
463
+ '404':
464
+ $ref: '#/components/responses/NotFound'
465
+
466
+ /api/entities/{entityId}/proxy:
467
+ post:
468
+ tags:
469
+ - Entities
470
+ summary: Proxy API request through entity
471
+ description: |
472
+ Forward an API request to the external system using the entity's credentials.
473
+ Automatically handles authentication headers and token refresh.
474
+ operationId: proxyEntityRequest
475
+ parameters:
476
+ - $ref: '#/components/parameters/EntityId'
477
+ requestBody:
478
+ required: true
479
+ content:
480
+ application/json:
481
+ schema:
482
+ $ref: '#/components/schemas/ProxyRequest'
483
+ responses:
484
+ '200':
485
+ description: Request proxied successfully
486
+ content:
487
+ application/json:
488
+ schema:
489
+ $ref: '#/components/schemas/ProxyResponse'
490
+ '400':
491
+ $ref: '#/components/responses/BadRequest'
492
+ '401':
493
+ $ref: '#/components/responses/Unauthorized'
494
+ '404':
495
+ $ref: '#/components/responses/NotFound'
496
+ '502':
497
+ description: Upstream API error
498
+ content:
499
+ application/json:
500
+ schema:
501
+ $ref: '#/components/schemas/ProxyErrorResponse'
502
+
503
+ # Credential Endpoints
504
+ /api/credentials:
505
+ get:
506
+ tags:
507
+ - Credentials
508
+ summary: List user's credentials
509
+ description: Retrieve all credentials owned by the authenticated user (tokens masked)
510
+ operationId: listCredentials
511
+ responses:
512
+ '200':
513
+ description: List of credentials retrieved successfully
514
+ content:
515
+ application/json:
516
+ schema:
517
+ $ref: '#/components/schemas/ListCredentialsResponse'
518
+ '401':
519
+ $ref: '#/components/responses/Unauthorized'
520
+
521
+ /api/credentials/{credentialId}:
522
+ get:
523
+ tags:
524
+ - Credentials
525
+ summary: Get specific credential
526
+ description: Retrieve detailed information about a specific credential (tokens masked)
527
+ operationId: getCredential
528
+ parameters:
529
+ - $ref: '#/components/parameters/CredentialId'
530
+ responses:
531
+ '200':
532
+ description: Credential retrieved successfully
533
+ content:
534
+ application/json:
535
+ schema:
536
+ $ref: '#/components/schemas/Credential'
537
+ '401':
538
+ $ref: '#/components/responses/Unauthorized'
539
+ '404':
540
+ $ref: '#/components/responses/NotFound'
541
+
542
+ delete:
543
+ tags:
544
+ - Credentials
545
+ summary: Delete credential
546
+ description: Delete a credential and all associated entities
547
+ operationId: deleteCredential
548
+ parameters:
549
+ - $ref: '#/components/parameters/CredentialId'
550
+ responses:
551
+ '200':
552
+ description: Credential deleted successfully
553
+ content:
554
+ application/json:
555
+ schema:
556
+ $ref: '#/components/schemas/DeleteResponse'
557
+ '401':
558
+ $ref: '#/components/responses/Unauthorized'
559
+ '404':
560
+ $ref: '#/components/responses/NotFound'
561
+
562
+ /api/credentials/{credentialId}/reauthorize:
563
+ get:
564
+ tags:
565
+ - Credentials
566
+ summary: Get credential reauthorization requirements
567
+ description: Get authentication requirements to reauthorize an existing credential
568
+ operationId: getCredentialReauthorizationRequirements
569
+ parameters:
570
+ - $ref: '#/components/parameters/CredentialId'
571
+ - name: step
572
+ in: query
573
+ schema:
574
+ type: integer
575
+ minimum: 1
576
+ default: 1
577
+ responses:
578
+ '200':
579
+ description: Reauthorization requirements retrieved
580
+ content:
581
+ application/json:
582
+ schema:
583
+ $ref: '#/components/schemas/AuthorizationRequirements'
584
+ '401':
585
+ $ref: '#/components/responses/Unauthorized'
586
+ '404':
587
+ $ref: '#/components/responses/NotFound'
588
+
589
+ post:
590
+ tags:
591
+ - Credentials
592
+ summary: Submit credential reauthorization
593
+ description: Reauthorize an existing credential with new authentication data
594
+ operationId: reauthorizeCredential
595
+ parameters:
596
+ - $ref: '#/components/parameters/CredentialId'
597
+ requestBody:
598
+ required: true
599
+ content:
600
+ application/json:
601
+ schema:
602
+ $ref: '#/components/schemas/ReauthorizeRequest'
603
+ responses:
604
+ '200':
605
+ description: Reauthorization completed or next step returned
606
+ content:
607
+ application/json:
608
+ schema:
609
+ $ref: '#/components/schemas/ReauthorizeResponse'
610
+ '400':
611
+ $ref: '#/components/responses/BadRequest'
612
+ '401':
613
+ $ref: '#/components/responses/Unauthorized'
614
+ '404':
615
+ $ref: '#/components/responses/NotFound'
616
+ '422':
617
+ $ref: '#/components/responses/ValidationError'
618
+
619
+ /api/credentials/{credentialId}/proxy:
620
+ post:
621
+ tags:
622
+ - Credentials
623
+ summary: Proxy API request through credential
624
+ description: |
625
+ Forward an API request to the external system using this credential.
626
+ Similar to entity proxy but doesn't require an entity to be created.
627
+ operationId: proxyCredentialRequest
628
+ parameters:
629
+ - $ref: '#/components/parameters/CredentialId'
630
+ requestBody:
631
+ required: true
632
+ content:
633
+ application/json:
634
+ schema:
635
+ $ref: '#/components/schemas/ProxyRequest'
636
+ responses:
637
+ '200':
638
+ description: Request proxied successfully
639
+ content:
640
+ application/json:
641
+ schema:
642
+ $ref: '#/components/schemas/ProxyResponse'
643
+ '400':
644
+ $ref: '#/components/responses/BadRequest'
645
+ '401':
646
+ $ref: '#/components/responses/Unauthorized'
647
+ '404':
648
+ $ref: '#/components/responses/NotFound'
649
+ '502':
650
+ description: Upstream API error
651
+ content:
652
+ application/json:
653
+ schema:
654
+ $ref: '#/components/schemas/ProxyErrorResponse'
655
+
656
+ # Health Endpoints
657
+ /health:
658
+ get:
659
+ tags:
660
+ - Health
661
+ summary: Basic health check
662
+ description: Simple health check endpoint that returns service status
663
+ operationId: healthCheck
664
+ security: []
665
+ responses:
666
+ '200':
667
+ description: Service is healthy
668
+ content:
669
+ application/json:
670
+ schema:
671
+ $ref: '#/components/schemas/HealthResponse'
672
+
673
+ /health/ready:
674
+ get:
675
+ tags:
676
+ - Health
677
+ summary: Readiness check
678
+ description: |
679
+ Detailed readiness check that validates database connectivity,
680
+ module loading, and encryption system status
681
+ operationId: readinessCheck
682
+ security: []
683
+ responses:
684
+ '200':
685
+ description: Service is ready
686
+ content:
687
+ application/json:
688
+ schema:
689
+ $ref: '#/components/schemas/ReadinessResponse'
690
+ '503':
691
+ description: Service not ready
692
+ content:
693
+ application/json:
694
+ schema:
695
+ $ref: '#/components/schemas/ReadinessResponse'
696
+
697
+ components:
698
+ securitySchemes:
699
+ bearerAuth:
700
+ type: http
701
+ scheme: bearer
702
+ bearerFormat: JWT
703
+ description: JWT token obtained from authentication
704
+
705
+ parameters:
706
+ EntityId:
707
+ name: entityId
708
+ in: path
709
+ required: true
710
+ schema:
711
+ type: string
712
+ description: Unique entity identifier
713
+
714
+ CredentialId:
715
+ name: credentialId
716
+ in: path
717
+ required: true
718
+ schema:
719
+ type: string
720
+ description: Unique credential identifier
721
+
722
+ IntegrationId:
723
+ name: integrationId
724
+ in: path
725
+ required: true
726
+ schema:
727
+ type: string
728
+ description: Unique integration identifier
729
+
730
+ TypeName:
731
+ name: typeName
732
+ in: path
733
+ required: true
734
+ schema:
735
+ type: string
736
+ description: Entity type name (e.g., 'hubspot', 'salesforce')
737
+
738
+ schemas:
739
+ # v1-specific combined response
740
+ ListIntegrationsV1Response:
741
+ type: object
742
+ description: |
743
+ **v1 Combined Response Format**
744
+
745
+ This response combines entities and integrations in a single call for backwards compatibility.
746
+ In v2, these are split into separate endpoints for cleaner separation of concerns.
747
+ required:
748
+ - entities
749
+ - integrations
750
+ properties:
751
+ entities:
752
+ type: object
753
+ required:
754
+ - options
755
+ - authorized
756
+ properties:
757
+ options:
758
+ type: array
759
+ description: Available integration types that can be connected
760
+ items:
761
+ $ref: '#/components/schemas/IntegrationOption'
762
+ authorized:
763
+ type: array
764
+ description: User's connected entities (accounts)
765
+ items:
766
+ $ref: '#/components/schemas/Entity'
767
+ integrations:
768
+ type: array
769
+ description: User's active integrations
770
+ items:
771
+ $ref: '#/components/schemas/Integration'
772
+
773
+ IntegrationOption:
774
+ type: object
775
+ description: An available integration type
776
+ required:
777
+ - type
778
+ - name
779
+ properties:
780
+ type:
781
+ type: string
782
+ description: Integration type identifier
783
+ name:
784
+ type: string
785
+ description: Display name
786
+ description:
787
+ type: string
788
+ description: Integration description
789
+ hasAuth:
790
+ type: boolean
791
+ description: Whether this integration requires authentication
792
+
793
+ ListIntegrationOptionsResponse:
794
+ type: object
795
+ required:
796
+ - integrations
797
+ properties:
798
+ integrations:
799
+ type: array
800
+ items:
801
+ $ref: '#/components/schemas/IntegrationOption'
802
+
803
+ Entity:
804
+ type: object
805
+ description: A connected account/entity object representing an external integration
806
+ required:
807
+ - id
808
+ - type
809
+ properties:
810
+ id:
811
+ type: string
812
+ description: Unique entity identifier
813
+ type:
814
+ type: string
815
+ description: Module/entity type name (e.g., 'hubspot', 'salesforce')
816
+ name:
817
+ type: string
818
+ description: Display name for the entity
819
+ externalId:
820
+ type: string
821
+ description: ID from the external system (e.g., HubSpot portal ID)
822
+ credential_id:
823
+ type: string
824
+ description: ID of the linked credential
825
+ userId:
826
+ type: string
827
+ description: ID of the user who owns this entity
828
+ dateCreated:
829
+ type: string
830
+ format: date-time
831
+ description: Entity creation timestamp
832
+ dateUpdated:
833
+ type: string
834
+ format: date-time
835
+ description: Last update timestamp
836
+
837
+ ListEntitiesResponse:
838
+ type: object
839
+ required:
840
+ - entities
841
+ properties:
842
+ entities:
843
+ type: array
844
+ items:
845
+ $ref: '#/components/schemas/Entity'
846
+
847
+ CreateEntityRequest:
848
+ type: object
849
+ required:
850
+ - entityType
851
+ - data
852
+ properties:
853
+ entityType:
854
+ type: string
855
+ description: Type of entity to create (module name)
856
+ data:
857
+ type: object
858
+ required:
859
+ - credential_id
860
+ properties:
861
+ credential_id:
862
+ type: string
863
+ description: ID of the credential to link to this entity
864
+ additionalProperties: true
865
+
866
+ CreateEntityResponse:
867
+ type: object
868
+ required:
869
+ - entity_id
870
+ - credential_id
871
+ - type
872
+ properties:
873
+ entity_id:
874
+ type: string
875
+ credential_id:
876
+ type: string
877
+ type:
878
+ type: string
879
+
880
+ EntityType:
881
+ type: object
882
+ required:
883
+ - type
884
+ - name
885
+ properties:
886
+ type:
887
+ type: string
888
+ description: Module name (e.g., 'hubspot', 'salesforce')
889
+ name:
890
+ type: string
891
+ description: Display name
892
+ description:
893
+ type: string
894
+ authType:
895
+ type: string
896
+ enum: [oauth2, form, api-key, basic]
897
+ isMultiStep:
898
+ type: boolean
899
+ stepCount:
900
+ type: integer
901
+ minimum: 1
902
+ capabilities:
903
+ type: array
904
+ items:
905
+ type: string
906
+
907
+ ListEntityTypesResponse:
908
+ type: object
909
+ required:
910
+ - types
911
+ properties:
912
+ types:
913
+ type: array
914
+ items:
915
+ $ref: '#/components/schemas/EntityType'
916
+
917
+ TestAuthResponse:
918
+ type: object
919
+ properties:
920
+ valid:
921
+ type: boolean
922
+ message:
923
+ type: string
924
+
925
+ Credential:
926
+ type: object
927
+ description: A credential object (tokens are masked in responses)
928
+ required:
929
+ - id
930
+ - type
931
+ properties:
932
+ id:
933
+ type: string
934
+ type:
935
+ type: string
936
+ description: Module type (e.g., 'hubspot', 'salesforce')
937
+ externalId:
938
+ type: string
939
+ userId:
940
+ type: string
941
+ dateCreated:
942
+ type: string
943
+ format: date-time
944
+ dateUpdated:
945
+ type: string
946
+ format: date-time
947
+
948
+ ListCredentialsResponse:
949
+ type: object
950
+ required:
951
+ - credentials
952
+ properties:
953
+ credentials:
954
+ type: array
955
+ items:
956
+ $ref: '#/components/schemas/Credential'
957
+
958
+ Integration:
959
+ type: object
960
+ required:
961
+ - id
962
+ - userId
963
+ properties:
964
+ id:
965
+ type: string
966
+ userId:
967
+ type: string
968
+ config:
969
+ type: object
970
+ description: Integration configuration
971
+ status:
972
+ type: string
973
+ enum: [ENABLED, DISABLED, PAUSED, ERROR]
974
+ entities:
975
+ type: array
976
+ items:
977
+ type: string
978
+ description: Array of entity IDs
979
+ dateCreated:
980
+ type: string
981
+ format: date-time
982
+ dateUpdated:
983
+ type: string
984
+ format: date-time
985
+
986
+ CreateIntegrationRequest:
987
+ type: object
988
+ required:
989
+ - entities
990
+ properties:
991
+ entities:
992
+ type: array
993
+ items:
994
+ type: string
995
+ description: Array of entity IDs to integrate
996
+ config:
997
+ type: object
998
+ description: Integration configuration
999
+
1000
+ UpdateIntegrationRequest:
1001
+ type: object
1002
+ properties:
1003
+ config:
1004
+ type: object
1005
+ enabled:
1006
+ type: boolean
1007
+
1008
+ AuthorizationRequirements:
1009
+ type: object
1010
+ required:
1011
+ - type
1012
+ - step
1013
+ - totalSteps
1014
+ properties:
1015
+ type:
1016
+ type: string
1017
+ enum: [oauth2, form, api-key, basic]
1018
+ step:
1019
+ type: integer
1020
+ minimum: 1
1021
+ totalSteps:
1022
+ type: integer
1023
+ minimum: 1
1024
+ isMultiStep:
1025
+ type: boolean
1026
+ sessionId:
1027
+ type: string
1028
+ data:
1029
+ oneOf:
1030
+ - $ref: '#/components/schemas/OAuth2Requirements'
1031
+ - $ref: '#/components/schemas/FormRequirements'
1032
+ - $ref: '#/components/schemas/ApiKeyRequirements'
1033
+
1034
+ OAuth2Requirements:
1035
+ type: object
1036
+ required:
1037
+ - url
1038
+ properties:
1039
+ url:
1040
+ type: string
1041
+ format: uri
1042
+ scopes:
1043
+ type: array
1044
+ items:
1045
+ type: string
1046
+
1047
+ FormRequirements:
1048
+ type: object
1049
+ required:
1050
+ - jsonSchema
1051
+ properties:
1052
+ jsonSchema:
1053
+ type: object
1054
+ uiSchema:
1055
+ type: object
1056
+
1057
+ ApiKeyRequirements:
1058
+ type: object
1059
+ required:
1060
+ - fields
1061
+ properties:
1062
+ fields:
1063
+ type: array
1064
+ items:
1065
+ type: object
1066
+ properties:
1067
+ name:
1068
+ type: string
1069
+ type:
1070
+ type: string
1071
+ enum: [api_key, secret, token]
1072
+ label:
1073
+ type: string
1074
+ required:
1075
+ type: boolean
1076
+
1077
+ AuthorizationRequest:
1078
+ type: object
1079
+ required:
1080
+ - entityType
1081
+ properties:
1082
+ entityType:
1083
+ type: string
1084
+ data:
1085
+ type: object
1086
+ additionalProperties: true
1087
+ step:
1088
+ type: integer
1089
+ minimum: 1
1090
+ default: 1
1091
+ sessionId:
1092
+ type: string
1093
+
1094
+ AuthorizationResponse:
1095
+ oneOf:
1096
+ - $ref: '#/components/schemas/AuthorizationSuccess'
1097
+ - $ref: '#/components/schemas/AuthorizationNextStep'
1098
+
1099
+ AuthorizationSuccess:
1100
+ type: object
1101
+ required:
1102
+ - entity_id
1103
+ - credential_id
1104
+ - type
1105
+ properties:
1106
+ entity_id:
1107
+ type: string
1108
+ credential_id:
1109
+ type: string
1110
+ type:
1111
+ type: string
1112
+
1113
+ AuthorizationNextStep:
1114
+ type: object
1115
+ required:
1116
+ - nextStep
1117
+ - sessionId
1118
+ - requirements
1119
+ properties:
1120
+ nextStep:
1121
+ type: integer
1122
+ minimum: 2
1123
+ sessionId:
1124
+ type: string
1125
+ requirements:
1126
+ $ref: '#/components/schemas/AuthorizationRequirements'
1127
+
1128
+ ReauthorizeRequest:
1129
+ type: object
1130
+ required:
1131
+ - data
1132
+ properties:
1133
+ data:
1134
+ type: object
1135
+ additionalProperties: true
1136
+ step:
1137
+ type: integer
1138
+ minimum: 1
1139
+ default: 1
1140
+ sessionId:
1141
+ type: string
1142
+
1143
+ ReauthorizeResponse:
1144
+ oneOf:
1145
+ - $ref: '#/components/schemas/ReauthorizeSuccess'
1146
+ - $ref: '#/components/schemas/ReauthorizeNextStep'
1147
+
1148
+ ReauthorizeSuccess:
1149
+ type: object
1150
+ required:
1151
+ - success
1152
+ - credential_id
1153
+ properties:
1154
+ success:
1155
+ type: boolean
1156
+ credential_id:
1157
+ type: string
1158
+ entity_id:
1159
+ type: string
1160
+
1161
+ ReauthorizeNextStep:
1162
+ type: object
1163
+ required:
1164
+ - step
1165
+ - totalSteps
1166
+ - sessionId
1167
+ - requirements
1168
+ properties:
1169
+ step:
1170
+ type: integer
1171
+ totalSteps:
1172
+ type: integer
1173
+ sessionId:
1174
+ type: string
1175
+ requirements:
1176
+ type: object
1177
+
1178
+ ProxyRequest:
1179
+ type: object
1180
+ required:
1181
+ - method
1182
+ - path
1183
+ properties:
1184
+ method:
1185
+ type: string
1186
+ enum: [GET, POST, PUT, PATCH, DELETE]
1187
+ path:
1188
+ type: string
1189
+ pattern: ^/
1190
+ query:
1191
+ type: object
1192
+ additionalProperties: true
1193
+ headers:
1194
+ type: object
1195
+ additionalProperties:
1196
+ type: string
1197
+ body:
1198
+ oneOf:
1199
+ - type: object
1200
+ - type: array
1201
+ - type: string
1202
+ - type: 'null'
1203
+
1204
+ ProxyResponse:
1205
+ type: object
1206
+ required:
1207
+ - success
1208
+ - status
1209
+ - data
1210
+ properties:
1211
+ success:
1212
+ type: boolean
1213
+ status:
1214
+ type: integer
1215
+ headers:
1216
+ type: object
1217
+ additionalProperties:
1218
+ type: string
1219
+ data:
1220
+ description: Response body from upstream API
1221
+
1222
+ ProxyErrorResponse:
1223
+ type: object
1224
+ required:
1225
+ - success
1226
+ - status
1227
+ - error
1228
+ properties:
1229
+ success:
1230
+ type: boolean
1231
+ enum: [false]
1232
+ status:
1233
+ type: integer
1234
+ error:
1235
+ type: object
1236
+ required:
1237
+ - code
1238
+ - message
1239
+ properties:
1240
+ code:
1241
+ type: string
1242
+ enum:
1243
+ - INVALID_AUTH
1244
+ - EXPIRED_TOKEN
1245
+ - UPSTREAM_ERROR
1246
+ - TIMEOUT
1247
+ - NETWORK_ERROR
1248
+ - RATE_LIMITED
1249
+ message:
1250
+ type: string
1251
+ details:
1252
+ type: object
1253
+ upstreamStatus:
1254
+ type: integer
1255
+
1256
+ DeleteResponse:
1257
+ type: object
1258
+ required:
1259
+ - success
1260
+ properties:
1261
+ success:
1262
+ type: boolean
1263
+ message:
1264
+ type: string
1265
+
1266
+ HealthResponse:
1267
+ type: object
1268
+ properties:
1269
+ status:
1270
+ type: string
1271
+ example: ok
1272
+ timestamp:
1273
+ type: string
1274
+ format: date-time
1275
+
1276
+ ReadinessResponse:
1277
+ type: object
1278
+ properties:
1279
+ ready:
1280
+ type: boolean
1281
+ timestamp:
1282
+ type: string
1283
+ format: date-time
1284
+ checks:
1285
+ type: object
1286
+ properties:
1287
+ database:
1288
+ type: boolean
1289
+ modules:
1290
+ type: boolean
1291
+ encryption:
1292
+ type: object
1293
+ properties:
1294
+ status:
1295
+ type: string
1296
+ testResult:
1297
+ type: string
1298
+
1299
+ Error:
1300
+ type: object
1301
+ required:
1302
+ - error
1303
+ properties:
1304
+ error:
1305
+ type: object
1306
+ required:
1307
+ - code
1308
+ - message
1309
+ properties:
1310
+ code:
1311
+ type: string
1312
+ message:
1313
+ type: string
1314
+ details:
1315
+ type: object
1316
+
1317
+ responses:
1318
+ BadRequest:
1319
+ description: Bad request - invalid input
1320
+ content:
1321
+ application/json:
1322
+ schema:
1323
+ $ref: '#/components/schemas/Error'
1324
+ example:
1325
+ error:
1326
+ code: BAD_REQUEST
1327
+ message: Invalid request parameters
1328
+
1329
+ Unauthorized:
1330
+ description: Unauthorized - missing or invalid authentication
1331
+ content:
1332
+ application/json:
1333
+ schema:
1334
+ $ref: '#/components/schemas/Error'
1335
+ example:
1336
+ error:
1337
+ code: UNAUTHORIZED
1338
+ message: Authentication required
1339
+
1340
+ NotFound:
1341
+ description: Resource not found
1342
+ content:
1343
+ application/json:
1344
+ schema:
1345
+ $ref: '#/components/schemas/Error'
1346
+ example:
1347
+ error:
1348
+ code: NOT_FOUND
1349
+ message: Resource not found
1350
+
1351
+ ValidationError:
1352
+ description: Validation error - invalid data
1353
+ content:
1354
+ application/json:
1355
+ schema:
1356
+ $ref: '#/components/schemas/Error'
1357
+ example:
1358
+ error:
1359
+ code: VALIDATION_ERROR
1360
+ message: Data validation failed