Skip to content

Commit 38af258

Browse files
authored
GH-39048: [JS] Re-export existing type enums (#39473)
This way we don't have to manually maintain the enums even though they should be pretty much constants. * Closes: #39048
1 parent b736c99 commit 38af258

File tree

1 file changed

+7
-113
lines changed

1 file changed

+7
-113
lines changed

js/src/enum.ts

Lines changed: 7 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -15,119 +15,13 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
////
19-
//
20-
// A few enums copied from `fb/Schema.ts` and `fb/Message.ts` because Webpack
21-
// v4 doesn't seem to be able to tree-shake the rest of those exports.
22-
//
23-
// We will have to keep these enums in sync when we re-generate the flatbuffers
24-
// code from the schemas. See js/DEVELOP.md for info on how to run flatbuffers
25-
// code generation.
26-
//
27-
////
28-
29-
/**
30-
* Logical types, vector layouts, and schemas
31-
*
32-
* @enum {number}
33-
*/
34-
export enum MetadataVersion {
35-
/**
36-
* 0.1.0 (October 2016).
37-
*/
38-
V1 = 0,
39-
40-
/**
41-
* 0.2.0 (February 2017). Non-backwards compatible with V1.
42-
*/
43-
V2 = 1,
44-
45-
/**
46-
* 0.3.0 -> 0.7.1 (May - December 2017). Non-backwards compatible with V2.
47-
*/
48-
V3 = 2,
49-
50-
/**
51-
* >= 0.8.0 (December 2017). Non-backwards compatible with V3.
52-
*/
53-
V4 = 3,
54-
55-
/**
56-
* >= 1.0.0 (July 2020. Backwards compatible with V4 (V5 readers can read V4
57-
* metadata and IPC messages). Implementations are recommended to provide a
58-
* V4 compatibility mode with V5 format changes disabled.
59-
*
60-
* Incompatible changes between V4 and V5:
61-
* - Union buffer layout has changed. In V5, Unions don't have a validity
62-
* bitmap buffer.
63-
*/
64-
V5 = 4
65-
}
66-
67-
/**
68-
* @enum {number}
69-
*/
70-
export enum UnionMode {
71-
Sparse = 0,
72-
Dense = 1
73-
}
74-
75-
/**
76-
* @enum {number}
77-
*/
78-
export enum Precision {
79-
HALF = 0,
80-
SINGLE = 1,
81-
DOUBLE = 2
82-
}
83-
84-
/**
85-
* @enum {number}
86-
*/
87-
export enum DateUnit {
88-
DAY = 0,
89-
MILLISECOND = 1
90-
}
91-
92-
/**
93-
* @enum {number}
94-
*/
95-
export enum TimeUnit {
96-
SECOND = 0,
97-
MILLISECOND = 1,
98-
MICROSECOND = 2,
99-
NANOSECOND = 3
100-
}
101-
102-
/**
103-
* @enum {number}
104-
*/
105-
export enum IntervalUnit {
106-
YEAR_MONTH = 0,
107-
DAY_TIME = 1,
108-
MONTH_DAY_NANO = 2
109-
}
110-
111-
/**
112-
* ----------------------------------------------------------------------
113-
* The root Message type
114-
* This union enables us to easily send different message types without
115-
* redundant storage, and in the future we can easily add new message types.
116-
*
117-
* Arrow implementations do not need to implement all of the message types,
118-
* which may include experimental metadata types. For maximum compatibility,
119-
* it is best to send data using RecordBatch
120-
*
121-
* @enum {number}
122-
*/
123-
export enum MessageHeader {
124-
NONE = 0,
125-
Schema = 1,
126-
DictionaryBatch = 2,
127-
RecordBatch = 3,
128-
Tensor = 4,
129-
SparseTensor = 5
130-
}
18+
export { MetadataVersion } from './fb/metadata-version.js';
19+
export { UnionMode } from './fb/union-mode.js';
20+
export { Precision } from './fb/precision.js';
21+
export { DateUnit } from './fb/date-unit.js';
22+
export { TimeUnit } from './fb/time-unit.js';
23+
export { IntervalUnit } from './fb/interval-unit.js';
24+
export { MessageHeader } from './fb/message-header.js';
13125

13226
/**
13327
* Main data type enumeration.

0 commit comments

Comments
 (0)