@loaders.gl/schema 3.1.0-alpha.4 → 3.1.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +1 -0
- package/dist/category/common.d.ts +18 -0
- package/dist/category/gis.d.ts +50 -0
- package/dist/category/mesh/convert-mesh.d.ts +14 -0
- package/dist/category/mesh/deduce-mesh-schema.d.ts +23 -0
- package/dist/category/mesh/mesh-to-arrow-table.d.ts +10 -0
- package/dist/category/mesh/mesh-types.d.ts +49 -0
- package/dist/category/mesh/mesh-utils.d.ts +22 -0
- package/dist/category/table/deduce-table-schema.d.ts +8 -0
- package/dist/category/table/table-types.d.ts +75 -0
- package/dist/dist.min.js.map +1 -1
- package/dist/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/category/mesh/convert-mesh.js +2 -10
- package/dist/es5/category/mesh/convert-mesh.js.map +1 -1
- package/dist/es5/category/mesh/deduce-mesh-schema.js +8 -8
- package/dist/es5/category/mesh/deduce-mesh-schema.js.map +1 -1
- package/dist/es5/category/mesh/mesh-to-arrow-table.js +18 -17
- package/dist/es5/category/mesh/mesh-to-arrow-table.js.map +1 -1
- package/dist/es5/category/mesh/mesh-utils.js +16 -16
- package/dist/es5/category/mesh/mesh-utils.js.map +1 -1
- package/dist/es5/category/table/deduce-table-schema.js +9 -9
- package/dist/es5/category/table/deduce-table-schema.js.map +1 -1
- package/dist/es5/index.js +52 -52
- package/dist/es5/lib/arrow/get-type-info.js +3 -3
- package/dist/es5/lib/arrow/get-type-info.js.map +1 -1
- package/dist/es5/lib/batches/base-table-batch-aggregator.js +42 -53
- package/dist/es5/lib/batches/base-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/columnar-table-batch-aggregator.js +71 -90
- package/dist/es5/lib/batches/columnar-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/row-table-batch-aggregator.js +59 -70
- package/dist/es5/lib/batches/row-table-batch-aggregator.js.map +1 -1
- package/dist/es5/lib/batches/table-batch-builder.js +113 -133
- package/dist/es5/lib/batches/table-batch-builder.js.map +1 -1
- package/dist/es5/lib/schema/impl/enum.js +1 -1
- package/dist/es5/lib/schema/impl/field.js +19 -32
- package/dist/es5/lib/schema/impl/field.js.map +1 -1
- package/dist/es5/lib/schema/impl/schema.js +54 -119
- package/dist/es5/lib/schema/impl/schema.js.map +1 -1
- package/dist/es5/lib/schema/impl/type.js +395 -728
- package/dist/es5/lib/schema/impl/type.js.map +1 -1
- package/dist/es5/lib/schema/index.js +37 -37
- package/dist/es5/lib/utils/async-queue.js +81 -164
- package/dist/es5/lib/utils/async-queue.js.map +1 -1
- package/dist/es5/lib/utils/row-utils.js +4 -4
- package/dist/es5/lib/utils/row-utils.js.map +1 -1
- package/dist/esm/category/mesh/convert-mesh.js +1 -1
- package/dist/esm/category/mesh/convert-mesh.js.map +1 -1
- package/dist/esm/lib/schema/impl/field.js +1 -1
- package/dist/esm/lib/schema/impl/field.js.map +1 -1
- package/dist/esm/lib/schema/impl/type.js +8 -8
- package/dist/esm/lib/schema/impl/type.js.map +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/lib/arrow/arrow-like-type-utils.d.ts +3 -0
- package/dist/lib/arrow/arrow-type-utils.d.ts +5 -0
- package/dist/lib/arrow/get-type-info.d.ts +13 -0
- package/dist/lib/batches/base-table-batch-aggregator.d.ts +18 -0
- package/dist/lib/batches/columnar-table-batch-aggregator.d.ts +22 -0
- package/dist/lib/batches/row-table-batch-aggregator.d.ts +21 -0
- package/dist/lib/batches/table-batch-aggregator.d.ts +24 -0
- package/dist/lib/batches/table-batch-builder.d.ts +52 -0
- package/dist/lib/schema/impl/enum.d.ts +91 -0
- package/dist/lib/schema/impl/field.d.ts +18 -0
- package/dist/lib/schema/impl/schema.d.ts +15 -0
- package/dist/lib/schema/impl/type.d.ts +175 -0
- package/dist/lib/schema/index.d.ts +4 -0
- package/dist/lib/schema-utils/deduce-column-type.d.ts +2 -0
- package/dist/lib/utils/assert.d.ts +1 -0
- package/dist/lib/utils/async-queue.d.ts +17 -0
- package/dist/lib/utils/row-utils.d.ts +8 -0
- package/dist/types.d.ts +7 -0
- package/package.json +5 -5
- package/src/category/gis.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lib/schema/impl/type.ts"],"names":["DataType","Type","NONE","other","x","typeId","Null","Int","Float","Binary","Utf8","Bool","Decimal","Date","Time","Timestamp","Interval","List","Struct","Union","FixedSizeBinary","FixedSizeList","Map","Dictionary","Symbol","toStringTag","isSigned","bitWidth","Int8","Int16","Int32","Int64","Uint8","Uint16","Uint32","Uint64","Precision","HALF","SINGLE","DOUBLE","precision","Float16","Float32","Float64","DateUnit","DAY","MILLISECOND","unit","DateDay","DateMillisecond","TimeUnit","SECOND","MICROSECOND","NANOSECOND","TimeSecond","TimeMillisecond","timezone","TimestampSecond","TimestampMillisecond","TimestampMicrosecond","TimestampNanosecond","IntervalUnit","DAY_TIME","YEAR_MONTH","IntervalDayTime","IntervalYearMonth","listSize","child","children","type","valueType","map","f","name","join"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;;IAuBaA,Q;;;;;;;SAwDX,eAAmB;AACjB,aAAOC,WAAKC,IAAZ;AACD;;;WAOD,mBAAUC,KAAV,EAAoC;AAElC,aAAO,SAASA,KAAhB;AACD;;;WAnED,gBAAcC,CAAd,EAA+B;AAC7B,aAAOA,CAAC,IAAIA,CAAC,CAACC,MAAF,KAAaJ,WAAKK,IAA9B;AACD;;;WACD,eAAaF,CAAb,EAA8B;AAC5B,aAAOA,CAAC,IAAIA,CAAC,CAACC,MAAF,KAAaJ,WAAKM,GAA9B;AACD;;;WACD,iBAAeH,CAAf,EAAgC;AAC9B,aAAOA,CAAC,IAAIA,CAAC,CAACC,MAAF,KAAaJ,WAAKO,KAA9B;AACD;;;WACD,kBAAgBJ,CAAhB,EAAiC;AAC/B,aAA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;AACD;;;SACD,eAAgB;AACd,aAAO,KAAK+C,QAAL,CAAc,CAAd,EAAiBC,IAAxB;AACD;;;SACD,eAAiB;AACf,aAAO,KAAKD,QAAL,CAAc,CAAd,CAAP;AACD;;;SAID,eAAmC;AACjC,aAAO,eAAP;AACD;;;WACD,oBAAmB;AACjB,qCAAwB,KAAKF,QAA7B,eAA0C,KAAKI,SAA/C;AACD;;;EA1BgCtE,Q;;;uBA2C5BwB,MAAM,CAACC,W;;IAdDP,M;;;;;AAGX,kBAAYkD,QAAZ,EAA+B;AAAA;;AAAA;AAC7B;AAD6B;AAE7B,WAAKA,QAAL,GAAgBA,QAAhB;AAF6B;AAG9B;;;;SAED,eAAoB;AAClB,aAAOnE,WAAKiB,MAAZ;AACD;;;WACD,oBAAkB;AAChB,+BAAkB,KAAKkD,QAAL,CAAcG,GAAd,CAAkB,UAACC,CAAD;AAAA,yBAAUA,CAAC,CAACC,IAAZ,cAAoBD,CAAC,CAACH,IAAtB;AAAA,OAAlB,EAAgDK,IAAhD,CAAqD,IAArD,CAAlB;AACD;;;SACD,eAAmC;AACjC,aAAO,QAAP;AACD;;;EAhByB1E,Q","sourcesContent":["// This code is adapted from ArrowJS https://github.com/apache/arrow\n// under Apache license http://www.apache.org/licenses/LICENSE-2.0\n\nimport {Type} from './enum';\n\nimport Field from './field';\n\nexport {Type} from './enum';\n\nexport type TypedIntArray =\n | Int8Array\n | Uint8Array\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Int32Array\n | Uint32Array\n | Uint8ClampedArray;\n\nexport type TypedFloatArray = Float32Array | Float64Array;\n\nexport type TypedArray = TypedIntArray | TypedFloatArray;\n\nexport type AnyArrayType = Array<any> | TypedIntArray | TypedFloatArray;\n\nexport class DataType {\n static isNull(x: any): boolean {\n return x && x.typeId === Type.Null;\n }\n static isInt(x: any): boolean {\n return x && x.typeId === Type.Int;\n }\n static isFloat(x: any): boolean {\n return x && x.typeId === Type.Float;\n }\n static isBinary(x: any): boolean {\n return x && x.typeId === Type.Binary;\n }\n static isUtf8(x: any): boolean {\n return x && x.typeId === Type.Utf8;\n }\n static isBool(x: any): boolean {\n return x && x.typeId === Type.Bool;\n }\n static isDecimal(x: any): boolean {\n return x && x.typeId === Type.Decimal;\n }\n static isDate(x: any): boolean {\n return x && x.typeId === Type.Date;\n }\n static isTime(x: any): boolean {\n return x && x.typeId === Type.Time;\n }\n static isTimestamp(x: any): boolean {\n return x && x.typeId === Type.Timestamp;\n }\n static isInterval(x: any): boolean {\n return x && x.typeId === Type.Interval;\n }\n static isList(x: any): boolean {\n return x && x.typeId === Type.List;\n }\n static isStruct(x: any): boolean {\n return x && x.typeId === Type.Struct;\n }\n static isUnion(x: any): boolean {\n return x && x.typeId === Type.Union;\n }\n static isFixedSizeBinary(x: any): boolean {\n return x && x.typeId === Type.FixedSizeBinary;\n }\n static isFixedSizeList(x: any): boolean {\n return x && x.typeId === Type.FixedSizeList;\n }\n static isMap(x: any): boolean {\n return x && x.typeId === Type.Map;\n }\n static isDictionary(x: any): boolean {\n return x && x.typeId === Type.Dictionary;\n }\n\n get typeId(): Type {\n return Type.NONE;\n }\n\n // get ArrayType(): AnyArrayType {\n // return Int8Array;\n // }\n\n // get ArrayType() { return Array; }\n compareTo(other: DataType): boolean {\n // TODO\n return this === other; // comparer.visit(this, other);\n }\n}\n\n// NULL\n\nexport class Null extends DataType {\n get typeId(): Type {\n return Type.Null;\n }\n get [Symbol.toStringTag](): string {\n return 'Null';\n }\n toString(): string {\n return 'Null';\n }\n}\n\n// BOOLEANS\n\nexport class Bool extends DataType {\n get typeId(): Type {\n return Type.Bool;\n }\n // get ArrayType() {\n // return Uint8Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Bool';\n }\n toString(): string {\n return 'Bool';\n }\n}\n\n// INTS\n\nexport class Int extends DataType {\n readonly isSigned: boolean;\n readonly bitWidth: number;\n constructor(isSigned, bitWidth) {\n super();\n this.isSigned = isSigned;\n this.bitWidth = bitWidth;\n }\n get typeId(): Type {\n return Type.Int;\n }\n // get ArrayType() {\n // switch (this.bitWidth) {\n // case 8:\n // return this.isSigned ? Int8Array : Uint8Array;\n // case 16:\n // return this.isSigned ? Int16Array : Uint16Array;\n // case 32:\n // return this.isSigned ? Int32Array : Uint32Array;\n // case 64:\n // return this.isSigned ? Int32Array : Uint32Array;\n // default:\n // throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);\n // }\n // }\n get [Symbol.toStringTag](): string {\n return 'Int';\n }\n toString(): string {\n return `${this.isSigned ? 'I' : 'Ui'}nt${this.bitWidth}`;\n }\n}\n\nexport class Int8 extends Int {\n constructor() {\n super(true, 8);\n }\n}\nexport class Int16 extends Int {\n constructor() {\n super(true, 16);\n }\n}\nexport class Int32 extends Int {\n constructor() {\n super(true, 32);\n }\n}\nexport class Int64 extends Int {\n constructor() {\n super(true, 64);\n }\n}\nexport class Uint8 extends Int {\n constructor() {\n super(false, 8);\n }\n}\nexport class Uint16 extends Int {\n constructor() {\n super(false, 16);\n }\n}\nexport class Uint32 extends Int {\n constructor() {\n super(false, 32);\n }\n}\nexport class Uint64 extends Int {\n constructor() {\n super(false, 64);\n }\n}\n\n// FLOATS\n\nconst Precision = {\n HALF: 16,\n SINGLE: 32,\n DOUBLE: 64\n};\n\nexport class Float extends DataType {\n readonly precision: number;\n constructor(precision) {\n super();\n this.precision = precision;\n }\n get typeId(): Type {\n return Type.Float;\n }\n // get ArrayType() {\n // switch (this.precision) {\n // case Precision.HALF:\n // return Uint16Array;\n // case Precision.SINGLE:\n // return Float32Array;\n // case Precision.DOUBLE:\n // return Float64Array;\n // default:\n // throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);\n // }\n // }\n get [Symbol.toStringTag](): string {\n return 'Float';\n }\n toString(): string {\n return `Float${this.precision}`;\n }\n}\n\nexport class Float16 extends Float {\n constructor() {\n super(Precision.HALF);\n }\n}\nexport class Float32 extends Float {\n constructor() {\n super(Precision.SINGLE);\n }\n}\nexport class Float64 extends Float {\n constructor() {\n super(Precision.DOUBLE);\n }\n}\n\nexport class Binary extends DataType {\n constructor() {\n super();\n }\n get typeId() {\n return Type.Binary;\n }\n toString() {\n return 'Binary';\n }\n get [Symbol.toStringTag]() {\n return 'Binary';\n }\n}\n\n// STRINGS\n\nexport class Utf8 extends DataType {\n get typeId(): Type {\n return Type.Utf8;\n }\n // get ArrayType() {\n // return Uint8Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Utf8';\n }\n toString(): string {\n return 'Utf8';\n }\n}\n\n// DATES, TIMES AND INTERVALS\n\nconst DateUnit = {\n DAY: 0,\n MILLISECOND: 1\n};\n\nexport class Date extends DataType {\n readonly unit: number;\n constructor(unit) {\n super();\n this.unit = unit;\n }\n get typeId(): Type {\n return Type.Date;\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Date';\n }\n toString(): string {\n return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;\n }\n}\n\nexport class DateDay extends Date {\n constructor() {\n super(DateUnit.DAY);\n }\n}\nexport class DateMillisecond extends Date {\n constructor() {\n super(DateUnit.MILLISECOND);\n }\n}\n\nconst TimeUnit = {\n SECOND: 1,\n MILLISECOND: 1e3,\n MICROSECOND: 1e6,\n NANOSECOND: 1e9\n};\n\nexport class Time extends DataType {\n readonly unit: number;\n readonly bitWidth: number;\n\n constructor(unit, bitWidth) {\n super();\n this.unit = unit;\n this.bitWidth = bitWidth;\n }\n get typeId(): Type {\n return Type.Time;\n }\n toString(): string {\n return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;\n }\n get [Symbol.toStringTag](): string {\n return 'Time';\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n}\n\nexport class TimeSecond extends Time {\n constructor() {\n super(TimeUnit.SECOND, 32);\n }\n}\nexport class TimeMillisecond extends Time {\n constructor() {\n super(TimeUnit.MILLISECOND, 32);\n }\n}\n// export class TimeMicrosecond extends Time { constructor() { super(TimeUnit.MICROSECOND, 64); } }\n// export class TimeNanosecond extends Time { constructor() { super(TimeUnit.NANOSECOND, 64); } }\n\nexport class Timestamp extends DataType {\n readonly unit: any;\n readonly timezone: any;\n\n constructor(unit: any, timezone = null) {\n super();\n this.unit = unit;\n this.timezone = timezone;\n }\n get typeId(): Type {\n return Type.Timestamp;\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Timestamp';\n }\n toString(): string {\n return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ''}>`;\n }\n}\n\nexport class TimestampSecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.SECOND, timezone);\n }\n}\nexport class TimestampMillisecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.MILLISECOND, timezone);\n }\n}\nexport class TimestampMicrosecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.MICROSECOND, timezone);\n }\n}\nexport class TimestampNanosecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.NANOSECOND, timezone);\n }\n}\n\nconst IntervalUnit = {\n DAY_TIME: 0,\n YEAR_MONTH: 1\n};\n\nexport class Interval extends DataType {\n readonly unit: number;\n constructor(unit: number) {\n super();\n this.unit = unit;\n }\n get typeId(): Type {\n return Type.Interval;\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Interval';\n }\n toString(): string {\n return `Interval<${IntervalUnit[this.unit]}>`;\n }\n}\n\nexport class IntervalDayTime extends Interval {\n constructor() {\n super(IntervalUnit.DAY_TIME);\n }\n}\nexport class IntervalYearMonth extends Interval {\n constructor() {\n super(IntervalUnit.YEAR_MONTH);\n }\n}\n\nexport class FixedSizeList extends DataType {\n readonly listSize: number;\n readonly children: Field[];\n\n constructor(listSize: number, child: Field) {\n super();\n this.listSize = listSize;\n this.children = [child];\n }\n get typeId(): Type {\n return Type.FixedSizeList;\n }\n get valueType() {\n return this.children[0].type;\n }\n get valueField() {\n return this.children[0];\n }\n // get ArrayType() {\n // return this.valueType.ArrayType;\n // }\n get [Symbol.toStringTag](): string {\n return 'FixedSizeList';\n }\n toString(): string {\n return `FixedSizeList[${this.listSize}]<${this.valueType}>`;\n }\n}\n\nexport class Struct extends DataType {\n public readonly children: Field[];\n\n constructor(children: Field[]) {\n super();\n this.children = children;\n }\n\n public get typeId() {\n return Type.Struct;\n }\n public toString() {\n return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(', ')}}>`;\n }\n get [Symbol.toStringTag](): string {\n return 'Struct';\n }\n}\n"],"file":"type.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/schema/impl/type.ts"],"names":["DataType","isNull","x","typeId","Type","Null","isInt","Int","isFloat","Float","isBinary","Binary","isUtf8","Utf8","isBool","Bool","isDecimal","Decimal","isDate","Date","isTime","Time","isTimestamp","Timestamp","isInterval","Interval","isList","List","isStruct","Struct","isUnion","Union","isFixedSizeBinary","FixedSizeBinary","isFixedSizeList","FixedSizeList","isMap","Map","isDictionary","Dictionary","NONE","compareTo","other","Symbol","toStringTag","toString","constructor","isSigned","bitWidth","Int8","Int16","Int32","Int64","Uint8","Uint16","Uint32","Uint64","Precision","HALF","SINGLE","DOUBLE","precision","Float16","Float32","Float64","DateUnit","DAY","MILLISECOND","unit","DateDay","DateMillisecond","TimeUnit","SECOND","MICROSECOND","NANOSECOND","TimeSecond","TimeMillisecond","timezone","TimestampSecond","TimestampMillisecond","TimestampMicrosecond","TimestampNanosecond","IntervalUnit","DAY_TIME","YEAR_MONTH","IntervalDayTime","IntervalYearMonth","listSize","child","children","valueType","type","valueField","map","f","name","join"],"mappings":";;;;;;;;;;;;;;;;;AAGA;;;;AAuBO,MAAMA,QAAN,CAAe;AACP,SAANC,MAAM,CAACC,CAAD,EAAkB;AAC7B,WAAOA,CAAC,IAAIA,CAAC,CAACC,MAAF,KAAaC,WAAKC,IAA9B;AACD;;AACW,SAALC,KAAK,CAACJ,CAAD,EAAkB;AAC5B,WAAOA,CAAC,IAA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AMoC,YAAY,CAACE,UAAnB;AACD;;AAH6C;;;uBA2BzCzC,MAAM,CAACC,W;;AArBP,MAAMT,aAAN,SAA4BnC,QAA5B,CAAqC;AAI1C8C,EAAAA,WAAW,CAACyC,QAAD,EAAmBC,KAAnB,EAAiC;AAC1C;AAD0C;AAAA;AAE1C,SAAKD,QAAL,GAAgBA,QAAhB;AACA,SAAKE,QAAL,GAAgB,CAACD,KAAD,CAAhB;AACD;;AACS,MAANrF,MAAM,GAAS;AACjB,WAAOC,WAAK+B,aAAZ;AACD;;AACY,MAATuD,SAAS,GAAG;AACd,WAAO,KAAKD,QAAL,CAAc,CAAd,EAAiBE,IAAxB;AACD;;AACa,MAAVC,UAAU,GAAG;AACf,WAAO,KAAKH,QAAL,CAAc,CAAd,CAAP;AACD;;AAID,+BAAmC;AACjC,WAAO,eAAP;AACD;;AACD5C,EAAAA,QAAQ,GAAW;AACjB,mCAAwB,KAAK0C,QAA7B,eAA0C,KAAKG,SAA/C;AACD;;AA1ByC;;;uBA2CrC/C,MAAM,CAACC,W;;AAdP,MAAMf,MAAN,SAAqB7B,QAArB,CAA8B;AAGnC8C,EAAAA,WAAW,CAAC2C,QAAD,EAAoB;AAC7B;AAD6B;AAE7B,SAAKA,QAAL,GAAgBA,QAAhB;AACD;;AAEgB,MAANtF,MAAM,GAAG;AAClB,WAAOC,WAAKyB,MAAZ;AACD;;AACMgB,EAAAA,QAAQ,GAAG;AAChB,6BAAkB,KAAK4C,QAAL,CAAcI,GAAd,CAAmBC,CAAD,cAAUA,CAAC,CAACC,IAAZ,cAAoBD,CAAC,CAACH,IAAtB,CAAlB,EAAgDK,IAAhD,CAAqD,IAArD,CAAlB;AACD;;AACD,+BAAmC;AACjC,WAAO,QAAP;AACD;;AAhBkC","sourcesContent":["// This code is adapted from ArrowJS https://github.com/apache/arrow\n// under Apache license http://www.apache.org/licenses/LICENSE-2.0\n\nimport {Type} from './enum';\n\nimport Field from './field';\n\nexport {Type} from './enum';\n\nexport type TypedIntArray =\n | Int8Array\n | Uint8Array\n | Int16Array\n | Uint16Array\n | Int32Array\n | Uint32Array\n | Int32Array\n | Uint32Array\n | Uint8ClampedArray;\n\nexport type TypedFloatArray = Float32Array | Float64Array;\n\nexport type TypedArray = TypedIntArray | TypedFloatArray;\n\nexport type AnyArrayType = Array<any> | TypedIntArray | TypedFloatArray;\n\nexport class DataType {\n static isNull(x: any): boolean {\n return x && x.typeId === Type.Null;\n }\n static isInt(x: any): boolean {\n return x && x.typeId === Type.Int;\n }\n static isFloat(x: any): boolean {\n return x && x.typeId === Type.Float;\n }\n static isBinary(x: any): boolean {\n return x && x.typeId === Type.Binary;\n }\n static isUtf8(x: any): boolean {\n return x && x.typeId === Type.Utf8;\n }\n static isBool(x: any): boolean {\n return x && x.typeId === Type.Bool;\n }\n static isDecimal(x: any): boolean {\n return x && x.typeId === Type.Decimal;\n }\n static isDate(x: any): boolean {\n return x && x.typeId === Type.Date;\n }\n static isTime(x: any): boolean {\n return x && x.typeId === Type.Time;\n }\n static isTimestamp(x: any): boolean {\n return x && x.typeId === Type.Timestamp;\n }\n static isInterval(x: any): boolean {\n return x && x.typeId === Type.Interval;\n }\n static isList(x: any): boolean {\n return x && x.typeId === Type.List;\n }\n static isStruct(x: any): boolean {\n return x && x.typeId === Type.Struct;\n }\n static isUnion(x: any): boolean {\n return x && x.typeId === Type.Union;\n }\n static isFixedSizeBinary(x: any): boolean {\n return x && x.typeId === Type.FixedSizeBinary;\n }\n static isFixedSizeList(x: any): boolean {\n return x && x.typeId === Type.FixedSizeList;\n }\n static isMap(x: any): boolean {\n return x && x.typeId === Type.Map;\n }\n static isDictionary(x: any): boolean {\n return x && x.typeId === Type.Dictionary;\n }\n\n get typeId(): Type {\n return Type.NONE;\n }\n\n // get ArrayType(): AnyArrayType {\n // return Int8Array;\n // }\n\n // get ArrayType() { return Array; }\n compareTo(other: DataType): boolean {\n // TODO\n return this === other; // comparer.visit(this, other);\n }\n}\n\n// NULL\n\nexport class Null extends DataType {\n get typeId(): Type {\n return Type.Null;\n }\n get [Symbol.toStringTag](): string {\n return 'Null';\n }\n toString(): string {\n return 'Null';\n }\n}\n\n// BOOLEANS\n\nexport class Bool extends DataType {\n get typeId(): Type {\n return Type.Bool;\n }\n // get ArrayType() {\n // return Uint8Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Bool';\n }\n toString(): string {\n return 'Bool';\n }\n}\n\n// INTS\n\nexport class Int extends DataType {\n readonly isSigned: boolean;\n readonly bitWidth: number;\n constructor(isSigned, bitWidth) {\n super();\n this.isSigned = isSigned;\n this.bitWidth = bitWidth;\n }\n get typeId(): Type {\n return Type.Int;\n }\n // get ArrayType() {\n // switch (this.bitWidth) {\n // case 8:\n // return this.isSigned ? Int8Array : Uint8Array;\n // case 16:\n // return this.isSigned ? Int16Array : Uint16Array;\n // case 32:\n // return this.isSigned ? Int32Array : Uint32Array;\n // case 64:\n // return this.isSigned ? Int32Array : Uint32Array;\n // default:\n // throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);\n // }\n // }\n get [Symbol.toStringTag](): string {\n return 'Int';\n }\n toString(): string {\n return `${this.isSigned ? 'I' : 'Ui'}nt${this.bitWidth}`;\n }\n}\n\nexport class Int8 extends Int {\n constructor() {\n super(true, 8);\n }\n}\nexport class Int16 extends Int {\n constructor() {\n super(true, 16);\n }\n}\nexport class Int32 extends Int {\n constructor() {\n super(true, 32);\n }\n}\nexport class Int64 extends Int {\n constructor() {\n super(true, 64);\n }\n}\nexport class Uint8 extends Int {\n constructor() {\n super(false, 8);\n }\n}\nexport class Uint16 extends Int {\n constructor() {\n super(false, 16);\n }\n}\nexport class Uint32 extends Int {\n constructor() {\n super(false, 32);\n }\n}\nexport class Uint64 extends Int {\n constructor() {\n super(false, 64);\n }\n}\n\n// FLOATS\n\nconst Precision = {\n HALF: 16,\n SINGLE: 32,\n DOUBLE: 64\n};\n\nexport class Float extends DataType {\n readonly precision: number;\n constructor(precision) {\n super();\n this.precision = precision;\n }\n get typeId(): Type {\n return Type.Float;\n }\n // get ArrayType() {\n // switch (this.precision) {\n // case Precision.HALF:\n // return Uint16Array;\n // case Precision.SINGLE:\n // return Float32Array;\n // case Precision.DOUBLE:\n // return Float64Array;\n // default:\n // throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`);\n // }\n // }\n get [Symbol.toStringTag](): string {\n return 'Float';\n }\n toString(): string {\n return `Float${this.precision}`;\n }\n}\n\nexport class Float16 extends Float {\n constructor() {\n super(Precision.HALF);\n }\n}\nexport class Float32 extends Float {\n constructor() {\n super(Precision.SINGLE);\n }\n}\nexport class Float64 extends Float {\n constructor() {\n super(Precision.DOUBLE);\n }\n}\n\nexport class Binary extends DataType {\n constructor() {\n super();\n }\n get typeId() {\n return Type.Binary;\n }\n toString() {\n return 'Binary';\n }\n get [Symbol.toStringTag]() {\n return 'Binary';\n }\n}\n\n// STRINGS\n\nexport class Utf8 extends DataType {\n get typeId(): Type {\n return Type.Utf8;\n }\n // get ArrayType() {\n // return Uint8Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Utf8';\n }\n toString(): string {\n return 'Utf8';\n }\n}\n\n// DATES, TIMES AND INTERVALS\n\nconst DateUnit = {\n DAY: 0,\n MILLISECOND: 1\n};\n\nexport class Date extends DataType {\n readonly unit: number;\n constructor(unit) {\n super();\n this.unit = unit;\n }\n get typeId(): Type {\n return Type.Date;\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Date';\n }\n toString(): string {\n return `Date${(this.unit + 1) * 32}<${DateUnit[this.unit]}>`;\n }\n}\n\nexport class DateDay extends Date {\n constructor() {\n super(DateUnit.DAY);\n }\n}\nexport class DateMillisecond extends Date {\n constructor() {\n super(DateUnit.MILLISECOND);\n }\n}\n\nconst TimeUnit = {\n SECOND: 1,\n MILLISECOND: 1e3,\n MICROSECOND: 1e6,\n NANOSECOND: 1e9\n};\n\nexport class Time extends DataType {\n readonly unit: number;\n readonly bitWidth: number;\n\n constructor(unit, bitWidth) {\n super();\n this.unit = unit;\n this.bitWidth = bitWidth;\n }\n get typeId(): Type {\n return Type.Time;\n }\n toString(): string {\n return `Time${this.bitWidth}<${TimeUnit[this.unit]}>`;\n }\n get [Symbol.toStringTag](): string {\n return 'Time';\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n}\n\nexport class TimeSecond extends Time {\n constructor() {\n super(TimeUnit.SECOND, 32);\n }\n}\nexport class TimeMillisecond extends Time {\n constructor() {\n super(TimeUnit.MILLISECOND, 32);\n }\n}\n// export class TimeMicrosecond extends Time { constructor() { super(TimeUnit.MICROSECOND, 64); } }\n// export class TimeNanosecond extends Time { constructor() { super(TimeUnit.NANOSECOND, 64); } }\n\nexport class Timestamp extends DataType {\n readonly unit: any;\n readonly timezone: any;\n\n constructor(unit: any, timezone = null) {\n super();\n this.unit = unit;\n this.timezone = timezone;\n }\n get typeId(): Type {\n return Type.Timestamp;\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Timestamp';\n }\n toString(): string {\n return `Timestamp<${TimeUnit[this.unit]}${this.timezone ? `, ${this.timezone}` : ''}>`;\n }\n}\n\nexport class TimestampSecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.SECOND, timezone);\n }\n}\nexport class TimestampMillisecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.MILLISECOND, timezone);\n }\n}\nexport class TimestampMicrosecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.MICROSECOND, timezone);\n }\n}\nexport class TimestampNanosecond extends Timestamp {\n constructor(timezone = null) {\n super(TimeUnit.NANOSECOND, timezone);\n }\n}\n\nconst IntervalUnit = {\n DAY_TIME: 0,\n YEAR_MONTH: 1\n};\n\nexport class Interval extends DataType {\n readonly unit: number;\n constructor(unit: number) {\n super();\n this.unit = unit;\n }\n get typeId(): Type {\n return Type.Interval;\n }\n // get ArrayType() {\n // return Int32Array;\n // }\n get [Symbol.toStringTag](): string {\n return 'Interval';\n }\n toString(): string {\n return `Interval<${IntervalUnit[this.unit]}>`;\n }\n}\n\nexport class IntervalDayTime extends Interval {\n constructor() {\n super(IntervalUnit.DAY_TIME);\n }\n}\nexport class IntervalYearMonth extends Interval {\n constructor() {\n super(IntervalUnit.YEAR_MONTH);\n }\n}\n\nexport class FixedSizeList extends DataType {\n readonly listSize: number;\n readonly children: Field[];\n\n constructor(listSize: number, child: Field) {\n super();\n this.listSize = listSize;\n this.children = [child];\n }\n get typeId(): Type {\n return Type.FixedSizeList;\n }\n get valueType() {\n return this.children[0].type;\n }\n get valueField() {\n return this.children[0];\n }\n // get ArrayType() {\n // return this.valueType.ArrayType;\n // }\n get [Symbol.toStringTag](): string {\n return 'FixedSizeList';\n }\n toString(): string {\n return `FixedSizeList[${this.listSize}]<${this.valueType}>`;\n }\n}\n\nexport class Struct extends DataType {\n public readonly children: Field[];\n\n constructor(children: Field[]) {\n super();\n this.children = children;\n }\n\n public get typeId() {\n return Type.Struct;\n }\n public toString() {\n return `Struct<{${this.children.map((f) => `${f.name}:${f.type}`).join(', ')}}>`;\n }\n get [Symbol.toStringTag](): string {\n return 'Struct';\n }\n}\n"],"file":"type.js"}
|
|
@@ -7,223 +7,223 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
Object.defineProperty(exports, "Schema", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function
|
|
10
|
+
get: function () {
|
|
11
11
|
return _schema.default;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
Object.defineProperty(exports, "Field", {
|
|
15
15
|
enumerable: true,
|
|
16
|
-
get: function
|
|
16
|
+
get: function () {
|
|
17
17
|
return _field.default;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "Type", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function
|
|
22
|
+
get: function () {
|
|
23
23
|
return _type.Type;
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
Object.defineProperty(exports, "DataType", {
|
|
27
27
|
enumerable: true,
|
|
28
|
-
get: function
|
|
28
|
+
get: function () {
|
|
29
29
|
return _type.DataType;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "Null", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function
|
|
34
|
+
get: function () {
|
|
35
35
|
return _type.Null;
|
|
36
36
|
}
|
|
37
37
|
});
|
|
38
38
|
Object.defineProperty(exports, "Bool", {
|
|
39
39
|
enumerable: true,
|
|
40
|
-
get: function
|
|
40
|
+
get: function () {
|
|
41
41
|
return _type.Bool;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "Int", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function
|
|
46
|
+
get: function () {
|
|
47
47
|
return _type.Int;
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
Object.defineProperty(exports, "Int8", {
|
|
51
51
|
enumerable: true,
|
|
52
|
-
get: function
|
|
52
|
+
get: function () {
|
|
53
53
|
return _type.Int8;
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "Int16", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function
|
|
58
|
+
get: function () {
|
|
59
59
|
return _type.Int16;
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
Object.defineProperty(exports, "Int32", {
|
|
63
63
|
enumerable: true,
|
|
64
|
-
get: function
|
|
64
|
+
get: function () {
|
|
65
65
|
return _type.Int32;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "Int64", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function
|
|
70
|
+
get: function () {
|
|
71
71
|
return _type.Int64;
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
Object.defineProperty(exports, "Uint8", {
|
|
75
75
|
enumerable: true,
|
|
76
|
-
get: function
|
|
76
|
+
get: function () {
|
|
77
77
|
return _type.Uint8;
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "Uint16", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function
|
|
82
|
+
get: function () {
|
|
83
83
|
return _type.Uint16;
|
|
84
84
|
}
|
|
85
85
|
});
|
|
86
86
|
Object.defineProperty(exports, "Uint32", {
|
|
87
87
|
enumerable: true,
|
|
88
|
-
get: function
|
|
88
|
+
get: function () {
|
|
89
89
|
return _type.Uint32;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "Uint64", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function
|
|
94
|
+
get: function () {
|
|
95
95
|
return _type.Uint64;
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
Object.defineProperty(exports, "Float", {
|
|
99
99
|
enumerable: true,
|
|
100
|
-
get: function
|
|
100
|
+
get: function () {
|
|
101
101
|
return _type.Float;
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "Float16", {
|
|
105
105
|
enumerable: true,
|
|
106
|
-
get: function
|
|
106
|
+
get: function () {
|
|
107
107
|
return _type.Float16;
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
110
|
Object.defineProperty(exports, "Float32", {
|
|
111
111
|
enumerable: true,
|
|
112
|
-
get: function
|
|
112
|
+
get: function () {
|
|
113
113
|
return _type.Float32;
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "Float64", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function
|
|
118
|
+
get: function () {
|
|
119
119
|
return _type.Float64;
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
Object.defineProperty(exports, "Binary", {
|
|
123
123
|
enumerable: true,
|
|
124
|
-
get: function
|
|
124
|
+
get: function () {
|
|
125
125
|
return _type.Binary;
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
Object.defineProperty(exports, "Utf8", {
|
|
129
129
|
enumerable: true,
|
|
130
|
-
get: function
|
|
130
|
+
get: function () {
|
|
131
131
|
return _type.Utf8;
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
Object.defineProperty(exports, "Date", {
|
|
135
135
|
enumerable: true,
|
|
136
|
-
get: function
|
|
136
|
+
get: function () {
|
|
137
137
|
return _type.Date;
|
|
138
138
|
}
|
|
139
139
|
});
|
|
140
140
|
Object.defineProperty(exports, "DateDay", {
|
|
141
141
|
enumerable: true,
|
|
142
|
-
get: function
|
|
142
|
+
get: function () {
|
|
143
143
|
return _type.DateDay;
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
Object.defineProperty(exports, "DateMillisecond", {
|
|
147
147
|
enumerable: true,
|
|
148
|
-
get: function
|
|
148
|
+
get: function () {
|
|
149
149
|
return _type.DateMillisecond;
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
Object.defineProperty(exports, "Time", {
|
|
153
153
|
enumerable: true,
|
|
154
|
-
get: function
|
|
154
|
+
get: function () {
|
|
155
155
|
return _type.Time;
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
Object.defineProperty(exports, "TimeSecond", {
|
|
159
159
|
enumerable: true,
|
|
160
|
-
get: function
|
|
160
|
+
get: function () {
|
|
161
161
|
return _type.TimeSecond;
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
Object.defineProperty(exports, "TimeMillisecond", {
|
|
165
165
|
enumerable: true,
|
|
166
|
-
get: function
|
|
166
|
+
get: function () {
|
|
167
167
|
return _type.TimeMillisecond;
|
|
168
168
|
}
|
|
169
169
|
});
|
|
170
170
|
Object.defineProperty(exports, "Timestamp", {
|
|
171
171
|
enumerable: true,
|
|
172
|
-
get: function
|
|
172
|
+
get: function () {
|
|
173
173
|
return _type.Timestamp;
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
Object.defineProperty(exports, "TimestampSecond", {
|
|
177
177
|
enumerable: true,
|
|
178
|
-
get: function
|
|
178
|
+
get: function () {
|
|
179
179
|
return _type.TimestampSecond;
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
182
|
Object.defineProperty(exports, "TimestampMillisecond", {
|
|
183
183
|
enumerable: true,
|
|
184
|
-
get: function
|
|
184
|
+
get: function () {
|
|
185
185
|
return _type.TimestampMillisecond;
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
188
|
Object.defineProperty(exports, "TimestampMicrosecond", {
|
|
189
189
|
enumerable: true,
|
|
190
|
-
get: function
|
|
190
|
+
get: function () {
|
|
191
191
|
return _type.TimestampMicrosecond;
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
194
|
Object.defineProperty(exports, "TimestampNanosecond", {
|
|
195
195
|
enumerable: true,
|
|
196
|
-
get: function
|
|
196
|
+
get: function () {
|
|
197
197
|
return _type.TimestampNanosecond;
|
|
198
198
|
}
|
|
199
199
|
});
|
|
200
200
|
Object.defineProperty(exports, "Interval", {
|
|
201
201
|
enumerable: true,
|
|
202
|
-
get: function
|
|
202
|
+
get: function () {
|
|
203
203
|
return _type.Interval;
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
206
|
Object.defineProperty(exports, "IntervalDayTime", {
|
|
207
207
|
enumerable: true,
|
|
208
|
-
get: function
|
|
208
|
+
get: function () {
|
|
209
209
|
return _type.IntervalDayTime;
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
212
|
Object.defineProperty(exports, "IntervalYearMonth", {
|
|
213
213
|
enumerable: true,
|
|
214
|
-
get: function
|
|
214
|
+
get: function () {
|
|
215
215
|
return _type.IntervalYearMonth;
|
|
216
216
|
}
|
|
217
217
|
});
|
|
218
218
|
Object.defineProperty(exports, "FixedSizeList", {
|
|
219
219
|
enumerable: true,
|
|
220
|
-
get: function
|
|
220
|
+
get: function () {
|
|
221
221
|
return _type.FixedSizeList;
|
|
222
222
|
}
|
|
223
223
|
});
|
|
224
224
|
Object.defineProperty(exports, "Struct", {
|
|
225
225
|
enumerable: true,
|
|
226
|
-
get: function
|
|
226
|
+
get: function () {
|
|
227
227
|
return _type.Struct;
|
|
228
228
|
}
|
|
229
229
|
});
|
|
@@ -8,59 +8,25 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.takeAsync = takeAsync;
|
|
9
9
|
exports.default = void 0;
|
|
10
10
|
|
|
11
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
|
-
|
|
13
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
|
-
|
|
15
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
20
|
-
|
|
21
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
22
|
-
|
|
23
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
24
|
-
|
|
25
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
26
|
-
|
|
27
|
-
var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
|
|
13
|
+
let _Symbol$asyncIterator;
|
|
28
14
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
34
|
-
|
|
35
|
-
var ArrayQueue = function (_Array) {
|
|
36
|
-
(0, _inherits2.default)(ArrayQueue, _Array);
|
|
37
|
-
|
|
38
|
-
var _super = _createSuper(ArrayQueue);
|
|
15
|
+
class ArrayQueue extends Array {
|
|
16
|
+
enqueue(value) {
|
|
17
|
+
return this.push(value);
|
|
18
|
+
}
|
|
39
19
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return _super.apply(this, arguments);
|
|
20
|
+
dequeue() {
|
|
21
|
+
return this.shift();
|
|
43
22
|
}
|
|
44
23
|
|
|
45
|
-
|
|
46
|
-
key: "enqueue",
|
|
47
|
-
value: function enqueue(value) {
|
|
48
|
-
return this.push(value);
|
|
49
|
-
}
|
|
50
|
-
}, {
|
|
51
|
-
key: "dequeue",
|
|
52
|
-
value: function dequeue() {
|
|
53
|
-
return this.shift();
|
|
54
|
-
}
|
|
55
|
-
}]);
|
|
56
|
-
return ArrayQueue;
|
|
57
|
-
}((0, _wrapNativeSuper2.default)(Array));
|
|
24
|
+
}
|
|
58
25
|
|
|
59
26
|
_Symbol$asyncIterator = Symbol.asyncIterator;
|
|
60
27
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
(0, _classCallCheck2.default)(this, AsyncQueue);
|
|
28
|
+
class AsyncQueue {
|
|
29
|
+
constructor() {
|
|
64
30
|
(0, _defineProperty2.default)(this, "_values", void 0);
|
|
65
31
|
(0, _defineProperty2.default)(this, "_settlers", void 0);
|
|
66
32
|
(0, _defineProperty2.default)(this, "_closed", void 0);
|
|
@@ -69,145 +35,96 @@ var AsyncQueue = function () {
|
|
|
69
35
|
this._closed = false;
|
|
70
36
|
}
|
|
71
37
|
|
|
72
|
-
(
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
done: true
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
this._closed = true;
|
|
38
|
+
close() {
|
|
39
|
+
while (this._settlers.length > 0) {
|
|
40
|
+
this._settlers.dequeue().resolve({
|
|
41
|
+
done: true
|
|
42
|
+
});
|
|
82
43
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
44
|
+
|
|
45
|
+
this._closed = true;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[_Symbol$asyncIterator]() {
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
enqueue(value) {
|
|
53
|
+
if (this._closed) {
|
|
54
|
+
throw new Error('Closed');
|
|
87
55
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
throw new Error('Closed');
|
|
56
|
+
|
|
57
|
+
if (this._settlers.length > 0) {
|
|
58
|
+
if (this._values.length > 0) {
|
|
59
|
+
throw new Error('Illegal internal state');
|
|
93
60
|
}
|
|
94
61
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
var settler = this._settlers.dequeue();
|
|
101
|
-
|
|
102
|
-
if (value instanceof Error) {
|
|
103
|
-
settler.reject(value);
|
|
104
|
-
} else {
|
|
105
|
-
settler.resolve({
|
|
106
|
-
value: value
|
|
107
|
-
});
|
|
108
|
-
}
|
|
62
|
+
const settler = this._settlers.dequeue();
|
|
63
|
+
|
|
64
|
+
if (value instanceof Error) {
|
|
65
|
+
settler.reject(value);
|
|
109
66
|
} else {
|
|
110
|
-
|
|
67
|
+
settler.resolve({
|
|
68
|
+
value
|
|
69
|
+
});
|
|
111
70
|
}
|
|
71
|
+
} else {
|
|
72
|
+
this._values.enqueue(value);
|
|
112
73
|
}
|
|
113
|
-
}
|
|
114
|
-
key: "next",
|
|
115
|
-
value: function next() {
|
|
116
|
-
var _this = this;
|
|
117
|
-
|
|
118
|
-
if (this._values.length > 0) {
|
|
119
|
-
var value = this._values.dequeue();
|
|
74
|
+
}
|
|
120
75
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
76
|
+
next() {
|
|
77
|
+
if (this._values.length > 0) {
|
|
78
|
+
const value = this._values.dequeue();
|
|
124
79
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
});
|
|
80
|
+
if (value instanceof Error) {
|
|
81
|
+
return Promise.reject(value);
|
|
128
82
|
}
|
|
129
83
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
84
|
+
return Promise.resolve({
|
|
85
|
+
value
|
|
86
|
+
});
|
|
87
|
+
}
|
|
134
88
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
89
|
+
if (this._closed) {
|
|
90
|
+
if (this._settlers.length > 0) {
|
|
91
|
+
throw new Error('Illegal internal state');
|
|
138
92
|
}
|
|
139
93
|
|
|
140
|
-
return
|
|
141
|
-
|
|
142
|
-
resolve: resolve,
|
|
143
|
-
reject: reject
|
|
144
|
-
});
|
|
94
|
+
return Promise.resolve({
|
|
95
|
+
done: true
|
|
145
96
|
});
|
|
146
97
|
}
|
|
147
|
-
}]);
|
|
148
|
-
return AsyncQueue;
|
|
149
|
-
}();
|
|
150
98
|
|
|
151
|
-
|
|
99
|
+
return new Promise((resolve, reject) => {
|
|
100
|
+
this._settlers.enqueue({
|
|
101
|
+
resolve,
|
|
102
|
+
reject
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
152
106
|
|
|
153
|
-
function takeAsync(_x) {
|
|
154
|
-
return _takeAsync.apply(this, arguments);
|
|
155
107
|
}
|
|
156
108
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
_context.next = 14;
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
_context.next = 6;
|
|
182
|
-
return iterator.next();
|
|
183
|
-
|
|
184
|
-
case 6:
|
|
185
|
-
_yield$iterator$next = _context.sent;
|
|
186
|
-
value = _yield$iterator$next.value;
|
|
187
|
-
done = _yield$iterator$next.done;
|
|
188
|
-
|
|
189
|
-
if (!done) {
|
|
190
|
-
_context.next = 11;
|
|
191
|
-
break;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return _context.abrupt("break", 14);
|
|
195
|
-
|
|
196
|
-
case 11:
|
|
197
|
-
result.push(value);
|
|
198
|
-
_context.next = 3;
|
|
199
|
-
break;
|
|
200
|
-
|
|
201
|
-
case 14:
|
|
202
|
-
return _context.abrupt("return", result);
|
|
203
|
-
|
|
204
|
-
case 15:
|
|
205
|
-
case "end":
|
|
206
|
-
return _context.stop();
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}, _callee);
|
|
210
|
-
}));
|
|
211
|
-
return _takeAsync.apply(this, arguments);
|
|
109
|
+
exports.default = AsyncQueue;
|
|
110
|
+
|
|
111
|
+
async function takeAsync(asyncIterable, count = Infinity) {
|
|
112
|
+
const result = [];
|
|
113
|
+
const iterator = asyncIterable[Symbol.asyncIterator]();
|
|
114
|
+
|
|
115
|
+
while (result.length < count) {
|
|
116
|
+
const {
|
|
117
|
+
value,
|
|
118
|
+
done
|
|
119
|
+
} = await iterator.next();
|
|
120
|
+
|
|
121
|
+
if (done) {
|
|
122
|
+
break;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
result.push(value);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return result;
|
|
212
129
|
}
|
|
213
130
|
//# sourceMappingURL=async-queue.js.map
|