v3.0.0
This release includes many changes to the ion-js API. The following identifies API changes since 3.0.0-beta.3. Additional information can be found in the API documentation. Anything not present in the API documentation is internal and subject to change in the future.
The following are known limitations:
- int values are restricted to 32 bits: [-2147483648, 2147483647]
- character escape sequences are not fully supported in strings, symbols, and clobs
- no support for:
- ints denoted in binary
- underscore characters in ints, decimals, or floats
- shared symbol tables
- symboltokens
- SID0 (
$0
)
Note: this release targets Node environments only and has not been verified to work in any browsers.
Associated milestone: Release V3.0
Full list of changes: v3.0.0-beta.3..v3.0.0
API Changes
General
- The API has been narrowed to the following modules:
- Ion
- Decimal
- Reader
- Timestamp
- Type
- Types
- Writer
- Callers using IonEventStream to transfer the contents of a reader to a writer should use the new
Writer.writeValue()
orWriter.writeValues()
methods instead
Ion
- removed:
asSpan()
get_buf_type()
isSourceType()
makeBinaryReader()
: usemakeReader()
insteadmakeTextReader()
: usemakeReader()
instead
Decimal
- added:
ONE
compareTo()
intValue()
numberValue()
- modified:
- constructor now expects a coefficient and exponent, both numbers
toString()
now returns a string using scientific notation if an exponent is needed
- removed:
NULL
getDigits()
getExponent()
getNumber()
: usenumberValue()
insteadisNegativeZero()
isNull()
isZero()
isZeroZero()
stringValue()
IonType
- renamed:
bid
tobinaryTypeId
container
toisContainer
lob
toisLob
num
toisNumeric
scalar
toisScalar
IonTypes
- removed:
BOC
,DATAGRAM
Reader
*Value()
methods now return null instead of undefined.- added:
type()
- modified:
next()
returns null when not positioned on a valuevalue()
now throws for container typesbooleanValue()
throws if the reader is not pointed at a BOOLEAN valuebyteValue()
throws if the reader is not pointed at a CLOB or BLOB valuedecimalValue()
throws if the reader is not pointed at a DECIMAL valuenumberValue()
throws if the reader is not pointed at a INT or FLOAT valuestringValue()
throws if the reader is not pointed at a STRING and SYMBOL valuetimestampValue()
throws if the reader is not pointed at a TIMESTAMP value
Timestamp
- added:
compareTo()
getDate()
getSecondsDecimal()
getSecondsInt()
- renamed:
getOffset()
togetLocalOffset()
- modified:
- constructor signature has changed (removed precision; offset and year are now required; other parameters are optional; and seconds, if specified, must be a number or Decimal)
- removed:
checkValid()
dataModelEquals()
: usecompareTo()
insteadgetEpochMilliseconds()
: usegetDate().getTime()
insteadgetZuluDay()
: usegetDate().getUTCDate()
insteadgetZuluHour()
: usegetDate().getUTCHours()
insteadgetZuluMinute()
: usegetDate().getUTCMinutes()
insteadgetZuluMonth()
: usegetDate().getUTCMonth()
insteadgetZuluSeconds()
: usegetDate().getUTCSeconds()
insteadgetZuluYear()
: usegetDate().getUTCFullYear()
insteadisNull()
numberValue()
: usegetDate().getTime()
insteadstringValue()
: usetoString()
instead
TimestampPrecision (was Precision)
- removed:
EMPTY
,NULL
Writer
- containers must now be explicitly closed (auto-close has been removed to avoid masking programming errors)
- annotations is no longer a parameter of individual
write*()
methods; instead, calladdAnnotation()
orsetAnnotations()
prior to one of thewrite*()
methods - null container values (
null.list
,null.sexp
,null.struct
) are no longer written bywriteList([], true)
,writeSexp([], true)
, orwriteStruct([], true)
; these values are now written viawriteNull(IonTypes.LIST)
,writeNull(IonTypes.SEXP)
, andwriteNull(IonTypes.STRUCT)
TypeCodes
has been removed in favor ofIonType
/IonTypes
- added:
writeValue()
writeValues()
- modified:
writeNull(TypeCode)
is nowwriteNull(IonType)
- renamed:
endContainer()
tostepOut()
writeList()
tostepIn(IonTypes.LIST)
writeSexp()
tostepIn(IonTypes.SEXP)
writeStruct()
tostepIn(IonTypes.STRUCT)