Skip to content

Commit

Permalink
Revert "feat: Launch Form Msgpack IDL Supporting (#888)"
Browse files Browse the repository at this point in the history
This reverts commit d1dc889.
  • Loading branch information
ursucarina committed Nov 11, 2024
1 parent d1dc889 commit 0263b38
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 68 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"dependencies": {
"@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@msgpack/msgpack": "^3.0.0-beta2",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/commit-analyzer": "^8.0.1",
"@semantic-release/exec": "^6.0.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React, { FC, useCallback, useEffect, useMemo, useState } from 'react';
import React, { FC, useCallback, useMemo, useState } from 'react';
import { Form } from '@rjsf/mui';
import validator from '@rjsf/validator-ajv8';
import styled from '@mui/system/styled';
import * as msgpack from '@msgpack/msgpack';
import { InputProps } from '../types';
import { protobufValueToPrimitive, PrimitiveType } from '../inputHelpers/struct';
import { StyledCard } from './StyledCard';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Protobuf from '@clients/common/flyteidl/protobuf';
import Core from '@clients/common/flyteidl/core';
import * as msgpack from '@msgpack/msgpack';
import { InputType, InputValue } from '../types';
import { structPath } from './constants';
import { ConverterInput, InputHelper, InputValidatorParams } from './types';
Expand Down Expand Up @@ -91,25 +90,9 @@ function objectToProtobufStruct(obj: Dictionary<any>): Protobuf.IStruct {
return { fields };
}

function parseBinary(binary: Core.IBinary): string {
if (!binary.value) {
throw new Error('Binary value is empty');
}

if (binary.tag === 'msgpack') {
return JSON.stringify(msgpack.decode(binary.value));
}

// unsupported binary type, it might be temporary
return '';
}

function fromLiteral(literal: Core.ILiteral): InputValue {
if (literal.scalar?.binary) {
return parseBinary(literal.scalar.binary);
}

const structValue = extractLiteralWithCheck<Protobuf.IStruct>(literal, structPath);

const finalValue = formatParameterValues(InputType.Struct, protobufStructToObject(structValue));
return finalValue;
}
Expand Down
18 changes: 1 addition & 17 deletions packages/oss-console/src/components/Literals/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable no-use-before-define */
import Protobuf from '@clients/common/flyteidl/protobuf';
import Core from '@clients/common/flyteidl/core';
import * as msgpack from '@msgpack/msgpack';
import Long from 'long';
import cloneDeep from 'lodash/cloneDeep';
import { formatDateUTC, protobufDurationToHMS } from '../../common/formatters';
Expand Down Expand Up @@ -80,23 +79,8 @@ function processBinary(binary?: Core.IBinary | null) {
return 'invalid binary';
}

if (!binary.value) {
return {
tag: `${tag}`,
value: '(empty)',
};
}

if (tag === 'msgpack') {
return {
tag: 'msgpack',
value: msgpack.decode(binary.value),
};
}

return {
tag: `${tag}`,
value: "(binary data not shown)",
tag: `${tag} (binary data not shown)`,
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
import Core from '@clients/common/flyteidl/core';
import { encode } from '@msgpack/msgpack';
import { TestCaseList } from '../types';

const testJson = {
test1: 1,
test2: '2',
test3: true,
};

const scalarBinaryTestCases: TestCaseList<Core.IBinary> = {
NORMAL_MSGPACK: {
value: { value: encode(testJson), tag: 'msgpack' },
expected: { result_var: { tag: 'msgpack', value: testJson } },
},
WITH_VAL: {
value: { value: new Uint8Array(), tag: 'tag1' },
expected: { result_var: { tag: 'tag1', value: '(binary data not shown)' } },
expected: { result_var: { tag: 'tag1 (binary data not shown)' } },
},
EMPTY_VALUE: {
value: { tag: 'msgpack' },
expected: { result_var: { tag: 'msgpack', value: '(empty)' } },
INT_WITH_SMALL_LOW: {
value: { tag: 'tag2' },
expected: { result_var: { tag: 'tag2 (binary data not shown)' } },
},
};

Expand Down
3 changes: 0 additions & 3 deletions packages/oss-console/src/test/setupTests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import '@testing-library/jest-dom';
import { TextEncoder, TextDecoder } from 'util';

Object.assign(global, { TextDecoder, TextEncoder });

jest.mock('react-syntax-highlighter/dist/esm/styles/prism', () => ({
prism: {},
Expand Down
4 changes: 0 additions & 4 deletions script/test/jest-setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
import '@testing-library/jest-dom';

import { TextEncoder, TextDecoder } from 'util';

Object.assign(global, { TextDecoder, TextEncoder });
8 changes: 0 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3501,13 +3501,6 @@ __metadata:
languageName: node
linkType: hard

"@msgpack/msgpack@npm:^3.0.0-beta2":
version: 3.0.0-beta2
resolution: "@msgpack/msgpack@npm:3.0.0-beta2"
checksum: d86e5d48146051952d6bea35a6cf733a401cf65ad5614d79689aa48c7076021737ca2c782978dd1b6c0c9c45888b246e379e45ae906179e3a0e8ef4ee6f221c1
languageName: node
linkType: hard

"@mswjs/cookies@npm:^0.2.2":
version: 0.2.2
resolution: "@mswjs/cookies@npm:0.2.2"
Expand Down Expand Up @@ -14914,7 +14907,6 @@ __metadata:
dependencies:
"@commitlint/cli": ^17.3.0
"@commitlint/config-conventional": ^17.3.0
"@msgpack/msgpack": ^3.0.0-beta2
"@semantic-release/changelog": ^5.0.1
"@semantic-release/commit-analyzer": ^8.0.1
"@semantic-release/exec": ^6.0.3
Expand Down

0 comments on commit 0263b38

Please sign in to comment.