Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 88 additions & 14 deletions src/converters/_batches_converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,39 @@ export function functionCallToMldev(
return toObject;
}

export function functionResponseToMldev(
fromObject: types.FunctionResponse,
): Record<string, unknown> {
const toObject: Record<string, unknown> = {};

const fromWillContinue = common.getValueByPath(fromObject, ['willContinue']);
if (fromWillContinue != null) {
common.setValueByPath(toObject, ['willContinue'], fromWillContinue);
}

const fromScheduling = common.getValueByPath(fromObject, ['scheduling']);
if (fromScheduling != null) {
common.setValueByPath(toObject, ['scheduling'], fromScheduling);
}

const fromId = common.getValueByPath(fromObject, ['id']);
if (fromId != null) {
common.setValueByPath(toObject, ['id'], fromId);
}

const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['name'], fromName);
}

const fromResponse = common.getValueByPath(fromObject, ['response']);
if (fromResponse != null) {
common.setValueByPath(toObject, ['response'], fromResponse);
}

return toObject;
}

export function partToMldev(fromObject: types.Part): Record<string, unknown> {
const toObject: Record<string, unknown> = {};

Expand Down Expand Up @@ -152,6 +185,17 @@ export function partToMldev(fromObject: types.Part): Record<string, unknown> {
);
}

const fromFunctionResponse = common.getValueByPath(fromObject, [
'functionResponse',
]);
if (fromFunctionResponse != null) {
common.setValueByPath(
toObject,
['functionResponse'],
functionResponseToMldev(fromFunctionResponse),
);
}

const fromCodeExecutionResult = common.getValueByPath(fromObject, [
'codeExecutionResult',
]);
Expand All @@ -170,13 +214,6 @@ export function partToMldev(fromObject: types.Part): Record<string, unknown> {
common.setValueByPath(toObject, ['executableCode'], fromExecutableCode);
}

const fromFunctionResponse = common.getValueByPath(fromObject, [
'functionResponse',
]);
if (fromFunctionResponse != null) {
common.setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
}

const fromText = common.getValueByPath(fromObject, ['text']);
if (fromText != null) {
common.setValueByPath(toObject, ['text'], fromText);
Expand Down Expand Up @@ -1746,6 +1783,39 @@ export function functionCallFromMldev(
return toObject;
}

export function functionResponseFromMldev(
fromObject: types.FunctionResponse,
): Record<string, unknown> {
const toObject: Record<string, unknown> = {};

const fromWillContinue = common.getValueByPath(fromObject, ['willContinue']);
if (fromWillContinue != null) {
common.setValueByPath(toObject, ['willContinue'], fromWillContinue);
}

const fromScheduling = common.getValueByPath(fromObject, ['scheduling']);
if (fromScheduling != null) {
common.setValueByPath(toObject, ['scheduling'], fromScheduling);
}

const fromId = common.getValueByPath(fromObject, ['id']);
if (fromId != null) {
common.setValueByPath(toObject, ['id'], fromId);
}

const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['name'], fromName);
}

const fromResponse = common.getValueByPath(fromObject, ['response']);
if (fromResponse != null) {
common.setValueByPath(toObject, ['response'], fromResponse);
}

return toObject;
}

export function partFromMldev(fromObject: types.Part): Record<string, unknown> {
const toObject: Record<string, unknown> = {};

Expand Down Expand Up @@ -1799,6 +1869,17 @@ export function partFromMldev(fromObject: types.Part): Record<string, unknown> {
);
}

const fromFunctionResponse = common.getValueByPath(fromObject, [
'functionResponse',
]);
if (fromFunctionResponse != null) {
common.setValueByPath(
toObject,
['functionResponse'],
functionResponseFromMldev(fromFunctionResponse),
);
}

const fromCodeExecutionResult = common.getValueByPath(fromObject, [
'codeExecutionResult',
]);
Expand All @@ -1817,13 +1898,6 @@ export function partFromMldev(fromObject: types.Part): Record<string, unknown> {
common.setValueByPath(toObject, ['executableCode'], fromExecutableCode);
}

const fromFunctionResponse = common.getValueByPath(fromObject, [
'functionResponse',
]);
if (fromFunctionResponse != null) {
common.setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
}

const fromText = common.getValueByPath(fromObject, ['text']);
if (fromText != null) {
common.setValueByPath(toObject, ['text'], fromText);
Expand Down
102 changes: 88 additions & 14 deletions src/converters/_caches_converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,39 @@ export function functionCallToMldev(
return toObject;
}

export function functionResponseToMldev(
fromObject: types.FunctionResponse,
): Record<string, unknown> {
const toObject: Record<string, unknown> = {};

const fromWillContinue = common.getValueByPath(fromObject, ['willContinue']);
if (fromWillContinue != null) {
common.setValueByPath(toObject, ['willContinue'], fromWillContinue);
}

const fromScheduling = common.getValueByPath(fromObject, ['scheduling']);
if (fromScheduling != null) {
common.setValueByPath(toObject, ['scheduling'], fromScheduling);
}

const fromId = common.getValueByPath(fromObject, ['id']);
if (fromId != null) {
common.setValueByPath(toObject, ['id'], fromId);
}

const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['name'], fromName);
}

const fromResponse = common.getValueByPath(fromObject, ['response']);
if (fromResponse != null) {
common.setValueByPath(toObject, ['response'], fromResponse);
}

return toObject;
}

export function partToMldev(fromObject: types.Part): Record<string, unknown> {
const toObject: Record<string, unknown> = {};

Expand Down Expand Up @@ -152,6 +185,17 @@ export function partToMldev(fromObject: types.Part): Record<string, unknown> {
);
}

const fromFunctionResponse = common.getValueByPath(fromObject, [
'functionResponse',
]);
if (fromFunctionResponse != null) {
common.setValueByPath(
toObject,
['functionResponse'],
functionResponseToMldev(fromFunctionResponse),
);
}

const fromCodeExecutionResult = common.getValueByPath(fromObject, [
'codeExecutionResult',
]);
Expand All @@ -170,13 +214,6 @@ export function partToMldev(fromObject: types.Part): Record<string, unknown> {
common.setValueByPath(toObject, ['executableCode'], fromExecutableCode);
}

const fromFunctionResponse = common.getValueByPath(fromObject, [
'functionResponse',
]);
if (fromFunctionResponse != null) {
common.setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
}

const fromText = common.getValueByPath(fromObject, ['text']);
if (fromText != null) {
common.setValueByPath(toObject, ['text'], fromText);
Expand Down Expand Up @@ -844,6 +881,39 @@ export function functionCallToVertex(
return toObject;
}

export function functionResponseToVertex(
fromObject: types.FunctionResponse,
): Record<string, unknown> {
const toObject: Record<string, unknown> = {};

const fromWillContinue = common.getValueByPath(fromObject, ['willContinue']);
if (fromWillContinue != null) {
common.setValueByPath(toObject, ['willContinue'], fromWillContinue);
}

const fromScheduling = common.getValueByPath(fromObject, ['scheduling']);
if (fromScheduling != null) {
common.setValueByPath(toObject, ['scheduling'], fromScheduling);
}

const fromId = common.getValueByPath(fromObject, ['id']);
if (fromId != null) {
common.setValueByPath(toObject, ['id'], fromId);
}

const fromName = common.getValueByPath(fromObject, ['name']);
if (fromName != null) {
common.setValueByPath(toObject, ['name'], fromName);
}

const fromResponse = common.getValueByPath(fromObject, ['response']);
if (fromResponse != null) {
common.setValueByPath(toObject, ['response'], fromResponse);
}

return toObject;
}

export function partToVertex(fromObject: types.Part): Record<string, unknown> {
const toObject: Record<string, unknown> = {};

Expand Down Expand Up @@ -897,6 +967,17 @@ export function partToVertex(fromObject: types.Part): Record<string, unknown> {
);
}

const fromFunctionResponse = common.getValueByPath(fromObject, [
'functionResponse',
]);
if (fromFunctionResponse != null) {
common.setValueByPath(
toObject,
['functionResponse'],
functionResponseToVertex(fromFunctionResponse),
);
}

const fromCodeExecutionResult = common.getValueByPath(fromObject, [
'codeExecutionResult',
]);
Expand All @@ -915,13 +996,6 @@ export function partToVertex(fromObject: types.Part): Record<string, unknown> {
common.setValueByPath(toObject, ['executableCode'], fromExecutableCode);
}

const fromFunctionResponse = common.getValueByPath(fromObject, [
'functionResponse',
]);
if (fromFunctionResponse != null) {
common.setValueByPath(toObject, ['functionResponse'], fromFunctionResponse);
}

const fromText = common.getValueByPath(fromObject, ['text']);
if (fromText != null) {
common.setValueByPath(toObject, ['text'], fromText);
Expand Down
Loading
Loading