Skip to content

Releases: amazon-ion/ion-js

v4.0.1

27 May 18:03
3a88880
Compare
Choose a tag to compare

Tweaks:

  • #605: PrettyTextWriter writes a space after struct field name/colon pairs
  • #607: Text decimal values are written in scientific notation less often
  • #614: Updates dependency versions in package.json

Bug Fixes:

  • #603:
    • Fixed an issue that prevented very large containers from being instantiated
    • Allowed instanceof dom.Value to work for Object instances that don't have a constructor (like those produced by Object.create(null))
  • #608: Added peer dependency instructions to the installation instructions
  • #609: Fixed a link to the contributor documentation in README.md
  • #611: Prevented IonTextReader.annotations() from returning special strings in single quotes
  • #614: Fixed an issue in FromJsConstructor that became an error in more recent versions of Typescript

Thanks to @oscarrodar and @bradley-curran for their contributions!

The complete list of commits included in v4.0.1 can be found here.

v4.0.0

30 Mar 19:23
e8be26f
Compare
Choose a tag to compare

API Changes

  • This release adds a DOM-style API for easily working with Ion values in memory.
    • Read Ion values from a stream using:
      let ionValue = ion.load(dataSource);
    • Ion values extend native JS types, so they are often interchangeable for the corresponding JS type.
      let person = ion.load('{name: "Michelle", age: 46}');
      console.log("Hello, " + person.name);
    • Ion values implement the strongly-typed dom.Value interface, making them straightforward to work with in TypeScript.
      let name: string = ion.load('{name: "Michelle", age: 46}').get('name').stringValue();
    • Convert an existing JS value to an Ion value using:
      let ionValue = ion.dom.Value.from(jsValue);
    • Write Ion values to an existing Ion Writer using:
      ionValue.writeTo(writer);
    • Write Ion values to a Uint8Array or string using:
      let ionBytes = ion.dumpBinary(ionValue);
      let ionText = ion.dumpText(ionValue);
      let neatlySpacedIonText = ion.dumpPrettyText(ionValue);
    • Down-convert Ion to a JSON string using:
      let jsonText = JSON.stringify(ionValue);
    • The DOM API leverages JS runtime features introduced in ES6, which is supported in all current versions of NodeJS (v10+) and all modern browsers. It is not supported in older runtimes.
  • IonWriter#writeValues(reader: Reader) will now work when the Reader and Writer are positioned at depths greater than zero.
  • Calling stepOut() when the Reader is at the top level will now throw.
  • Downconversions from JSBI to Number now gracefully lose precision rather than clamping values to the safely representable Number range.
  • Reader.value() is deprecated in favor of more strongly typed variants (stringValue(), decimalValue(), etc)
  • jsbi is now a peer dependency; in addition to depending on ion-js, consumers are now required to declare a dependency on this package.

Bug Fixes

  • #165: When reading Unicode escape sequences, the parser would sometimes treat code points as character codes.
  • #478: Text symbol ID $0 should have thrown when encountered in Reader.annotations() but didn't.
  • #513: Text symbol IDs (e.g. $3) would be read literally ($3) rather than resolved ($ion_symbol_table).
  • #514: In some circumstances, Reader state was not correctly reset after skipping values.
  • #515: \r\n escape sequence handling now adheres to the spec.

Work for this release was tracked in Milestone 4. The complete list of commits included in v4.0.0 can be found here.

v3.1.2

29 Oct 23:52
475134c
Compare
Choose a tag to compare

This patch release:

  • Fixes "cannot find module 'jsbi'" (#494)
  • Changes the npm install command in README.md to specify --save (instead of --save-dev)

v3.1.1

29 Oct 22:29
9ceaa4b
Compare
Choose a tag to compare

This release removes extraneous files that were published as part of the 3.1.0 release.

v3.1.0

29 Oct 17:50
ec40756
Compare
Choose a tag to compare

In addition to numerous bug fixes, this release adds support for arbitrary precision integers, decimals, and timestamps. It does not include 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: M3.1

Full list of changes: v3.0.0..v3.1.0

API Changes

The following identifies API changes since v3.0.0. 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.

General

  • added IntSize enum

Decimal

  • added constructor(decimalText: string)
  • added constructor(coefficient: JSBI, exponent: number, isNegative?: boolean)
  • added getCoefficient(): JSBI
  • added getExponent(): number

Reader

  • added bigIntValue(): JSBI
  • added intSize(): IntSize

Writer

  • added depth(): number
  • modified writeInt(value: number | JSBI | null): void so value may be of type JSBI

v3.0.0

12 Sep 22:29
0b2f6be
Compare
Choose a tag to compare

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() or Writer.writeValues() methods instead

Ion

  • removed:
    • asSpan()
    • get_buf_type()
    • isSourceType()
    • makeBinaryReader(): use makeReader() instead
    • makeTextReader(): use makeReader() 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(): use numberValue() instead
    • isNegativeZero()
    • isNull()
    • isZero()
    • isZeroZero()
    • stringValue()

IonType

  • renamed:
    • bid to binaryTypeId
    • container to isContainer
    • lob to isLob
    • num to isNumeric
    • scalar to isScalar

IonTypes

  • removed: BOC, DATAGRAM

Reader

  • *Value() methods now return null instead of undefined.
  • added:
    • type()
  • modified:
    • next() returns null when not positioned on a value
    • value() now throws for container types
    • booleanValue() throws if the reader is not pointed at a BOOLEAN value
    • byteValue() throws if the reader is not pointed at a CLOB or BLOB value
    • decimalValue() throws if the reader is not pointed at a DECIMAL value
    • numberValue() throws if the reader is not pointed at a INT or FLOAT value
    • stringValue() throws if the reader is not pointed at a STRING and SYMBOL value
    • timestampValue() throws if the reader is not pointed at a TIMESTAMP value

Timestamp

  • added:
    • compareTo()
    • getDate()
    • getSecondsDecimal()
    • getSecondsInt()
  • renamed:
    • getOffset() to getLocalOffset()
  • 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(): use compareTo() instead
    • getEpochMilliseconds(): use getDate().getTime() instead
    • getZuluDay(): use getDate().getUTCDate() instead
    • getZuluHour(): use getDate().getUTCHours() instead
    • getZuluMinute(): use getDate().getUTCMinutes() instead
    • getZuluMonth(): use getDate().getUTCMonth() instead
    • getZuluSeconds(): use getDate().getUTCSeconds() instead
    • getZuluYear(): use getDate().getUTCFullYear() instead
    • isNull()
    • numberValue(): use getDate().getTime() instead
    • stringValue(): use toString() 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, call addAnnotation() or setAnnotations() prior to one of the write*() methods
  • null container values (null.list, null.sexp, null.struct) are no longer written by writeList([], true), writeSexp([], true), or writeStruct([], true); these values are now written via writeNull(IonTypes.LIST), writeNull(IonTypes.SEXP), and writeNull(IonTypes.STRUCT)
  • TypeCodes has been removed in favor of IonType/IonTypes
  • added:
    • writeValue()
    • writeValues()
  • modified:
    • writeNull(TypeCode) is now writeNull(IonType)
  • renamed:
    • endContainer() to stepOut()
    • writeList() to stepIn(IonTypes.LIST)
    • writeSexp() to stepIn(IonTypes.SEXP)
    • writeStruct() to stepIn(IonTypes.STRUCT)

v2.1.3

03 Oct 18:41
Compare
Choose a tag to compare

2.1.3 (2017-10-03)

Bug Fixes

  • $tokenizer: Fix '-inf' parsing in raw mode. Fix timestamp span errors. (49dc6717)

v2.1.2

12 Sep 18:18
Compare
Choose a tag to compare

2.1.2 (2017-09-12)

Bug Fixes

  • source: Fix numberValue and booleanValue for TextReader (a7bc26a3)

v2.1.1

12 Sep 17:37
Compare
Choose a tag to compare

2.1.1 (2017-09-12)

Bug Fixes

  • source: Fix skipping past containers in IonTextReader (f5993e1d)

v2.1.0

19 Jul 18:29
Compare
Choose a tag to compare

2.1.0 (2017-07-19)

Features

  • Ion: Add 'raw_token' reader option to give access to the low level token stream (8a39caf8)