(paths: Record<string, unknown>)
| 132 | } |
| 133 | |
| 134 | function patchSessionActions(paths: Record<string, unknown>): void { |
| 135 | const internalPath = '/api/v1/sessions/{tail}'; |
| 136 | const pathItem = asRecord(paths[internalPath]); |
| 137 | const operation = asRecord(pathItem?.['post']); |
| 138 | if (pathItem === undefined || operation === undefined) return; |
| 139 | |
| 140 | for (const action of ['fork', 'compact', 'undo']) { |
| 141 | const cloned = cloneRecord(pathItem); |
| 142 | replacePathParamName(cloned, 'tail', 'session_id'); |
| 143 | const clonedOperation = asRecord(cloned['post']); |
| 144 | if (clonedOperation !== undefined) { |
| 145 | clonedOperation['operationId'] = `runSession${capitalize(action)}Action`; |
| 146 | if (action === 'undo') { |
| 147 | clonedOperation['requestBody'] = { |
| 148 | required: false, |
| 149 | content: jsonContent(openApiDocumentJsonSchema(undoSessionRequestSchema)), |
| 150 | }; |
| 151 | setResponse(clonedOperation, '200', { |
| 152 | description: 'Session undo response', |
| 153 | content: jsonContent(openApiDocumentEnvelopeJsonSchema(undoSessionResponseSchema)), |
| 154 | }); |
| 155 | } |
| 156 | } |
| 157 | paths[`/api/v1/sessions/{session_id}:${action}`] = cloned; |
| 158 | } |
| 159 | delete paths[internalPath]; |
| 160 | } |
| 161 | |
| 162 | function patchFsAction(paths: Record<string, unknown>): void { |
| 163 | const operation = getOperation(paths, '/api/v1/sessions/{session_id}/{tail}', 'post'); |
no test coverage detected