@brimdata/zealot
Advanced tools
Comparing version 0.0.14 to 0.0.15
import { Client } from "./client"; | ||
import { TypeDefs } from "./zed/context"; | ||
import { DefaultContext, TypeDefs } from "./zed/context"; | ||
import * as zed from "./zed/index"; | ||
@@ -22,2 +22,2 @@ import * as zjson from "./zjson"; | ||
declare function encode(data: zed.Field, opts?: EncodeOpts): zjson.EncodedField; | ||
export { Client, encode, decode, zjson, zed }; | ||
export { Client, encode, decode, zjson, zed, DefaultContext }; |
@@ -22,6 +22,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.zed = exports.zjson = exports.decode = exports.encode = exports.Client = void 0; | ||
exports.DefaultContext = exports.zed = exports.zjson = exports.decode = exports.encode = exports.Client = void 0; | ||
const client_1 = require("./client"); | ||
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return client_1.Client; } }); | ||
const context_1 = require("./zed/context"); | ||
Object.defineProperty(exports, "DefaultContext", { enumerable: true, get: function () { return context_1.DefaultContext; } }); | ||
const zed = __importStar(require("./zed/index")); | ||
@@ -28,0 +29,0 @@ exports.zed = zed; |
@@ -37,4 +37,5 @@ "use strict"; | ||
const connect = async () => { | ||
var _a; | ||
if (tries === 30) { | ||
this.l?.close(); | ||
(_a = this.l) === null || _a === void 0 ? void 0 : _a.close(); | ||
reject(`Tried 30 times to connect to zed lake: logs at: ${this.log}`); | ||
@@ -55,3 +56,4 @@ } | ||
async stop() { | ||
this.l?.close(); | ||
var _a; | ||
(_a = this.l) === null || _a === void 0 ? void 0 : _a.close(); | ||
await (0, fkill_1.default)(":" + this.port, { silent: true }); | ||
@@ -58,0 +60,0 @@ } |
@@ -73,4 +73,4 @@ "use strict"; | ||
stats.span = { | ||
ts: spanRec.get("ts").toBigInt() || 0n, | ||
dur: spanRec.get("dur").toBigInt() || 0n, | ||
ts: spanRec.get("ts").toBigInt() || BigInt(0), | ||
dur: spanRec.get("dur").toBigInt() || BigInt(0), | ||
}; | ||
@@ -77,0 +77,0 @@ } |
@@ -15,3 +15,4 @@ "use strict"; | ||
has(name) { | ||
return !!this.fields?.find((f) => f.name === name); | ||
var _a; | ||
return !!((_a = this.fields) === null || _a === void 0 ? void 0 : _a.find((f) => f.name === name)); | ||
} | ||
@@ -18,0 +19,0 @@ static stringify(fields) { |
@@ -12,3 +12,3 @@ import { TypeDuration } from "../types/type-duration"; | ||
} | ||
export declare const Nanosecond = 1n; | ||
export declare const Nanosecond: bigint; | ||
export declare const Microsecond: bigint; | ||
@@ -15,0 +15,0 @@ export declare const Millisecond: bigint; |
@@ -38,11 +38,11 @@ "use strict"; | ||
const parseRE = /([.0-9]+)(ns|us|ms|s|m|h|d|w|y)/g; | ||
exports.Nanosecond = 1n; | ||
exports.Microsecond = 1000n * exports.Nanosecond; | ||
exports.Millisecond = 1000n * exports.Microsecond; | ||
exports.Second = 1000n * exports.Millisecond; | ||
exports.Minute = 60n * exports.Second; | ||
exports.Hour = 60n * exports.Minute; | ||
exports.Day = 24n * exports.Hour; | ||
exports.Week = 7n * exports.Day; | ||
exports.Year = 365n * exports.Day; | ||
exports.Nanosecond = BigInt(1); | ||
exports.Microsecond = BigInt(1000) * exports.Nanosecond; | ||
exports.Millisecond = BigInt(1000) * exports.Microsecond; | ||
exports.Second = BigInt(1000) * exports.Millisecond; | ||
exports.Minute = BigInt(60) * exports.Second; | ||
exports.Hour = BigInt(60) * exports.Minute; | ||
exports.Day = BigInt(24) * exports.Hour; | ||
exports.Week = BigInt(7) * exports.Day; | ||
exports.Year = BigInt(365) * exports.Day; | ||
const scale = { | ||
@@ -61,3 +61,3 @@ ns: exports.Nanosecond, | ||
if (s.length === 0) | ||
return 0n; | ||
return BigInt(0); | ||
let negative = false; | ||
@@ -69,3 +69,3 @@ if (s[0] === "-") { | ||
let matches = s.matchAll(parseRE); | ||
let d = 0n; | ||
let d = BigInt(0); | ||
for (const match of matches) { | ||
@@ -83,8 +83,8 @@ if (match.length !== 3) | ||
let frac = parts[1]; | ||
let extra = 0n; | ||
let extra = BigInt(0); | ||
for (let char of frac) { | ||
extra += BigInt(char) * unit; | ||
unit /= 10n; | ||
unit /= BigInt(10); | ||
} | ||
d += (extra + 5n) / 10n; | ||
d += (extra + BigInt(5)) / BigInt(10); | ||
} | ||
@@ -96,5 +96,5 @@ else { | ||
if (negative) { | ||
d *= -1n; | ||
d *= BigInt(-1); | ||
} | ||
return d; | ||
} |
@@ -46,3 +46,4 @@ "use strict"; | ||
at(index) { | ||
return this.fieldAt(index)?.value; | ||
var _a; | ||
return (_a = this.fieldAt(index)) === null || _a === void 0 ? void 0 : _a.value; | ||
} | ||
@@ -49,0 +50,0 @@ fieldAt(index) { |
@@ -36,6 +36,6 @@ "use strict"; | ||
if ((0, utils_1.isNull)(this._time)) | ||
return 0n; | ||
return BigInt(0); | ||
// @ts-ignore | ||
let secs = this._time.toEpochSecond(core_1.ZoneOffset.UTC); | ||
return BigInt(secs) * 1000000000n + BigInt(this._time.nano()); | ||
return BigInt(secs) * BigInt(1000000000) + BigInt(this._time.nano()); | ||
} | ||
@@ -42,0 +42,0 @@ toJS() { |
@@ -5,5 +5,5 @@ import { TypeUint64 } from "../types/type-uint64"; | ||
type: typeof TypeUint64; | ||
toInt(): bigint | null; | ||
toInt(): number | null; | ||
toBigInt(): bigint | null; | ||
toJS(): bigint | null; | ||
} |
@@ -15,3 +15,3 @@ "use strict"; | ||
return null; | ||
return BigInt(this.value); | ||
return parseInt(this.value); | ||
} | ||
@@ -18,0 +18,0 @@ toBigInt() { |
@@ -26,7 +26,8 @@ "use strict"; | ||
toJS() { | ||
var _a; | ||
if (this.isUnset()) | ||
return null; | ||
return this.value?.toJS(); | ||
return (_a = this.value) === null || _a === void 0 ? void 0 : _a.toJS(); | ||
} | ||
} | ||
exports.Union = Union; |
{ | ||
"name": "@brimdata/zealot", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"description": "The Javascript Client for Zed Lakes", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -62,2 +62,2 @@ import { Client } from "./client"; | ||
export { Client, encode, decode, zjson, zed }; | ||
export { Client, encode, decode, zjson, zed, DefaultContext }; |
@@ -85,4 +85,4 @@ import { createFetcher } from "./fetcher/fetcher"; | ||
stats.span = { | ||
ts: spanRec.get<Time>("ts").toBigInt() || 0n, | ||
dur: spanRec.get<Int64>("dur").toBigInt() || 0n, | ||
ts: spanRec.get<Time>("ts").toBigInt() || BigInt(0), | ||
dur: spanRec.get<Int64>("dur").toBigInt() || BigInt(0), | ||
}; | ||
@@ -89,0 +89,0 @@ } |
@@ -40,11 +40,11 @@ import { TypeDuration } from "../types/type-duration"; | ||
export const Nanosecond = 1n; | ||
export const Microsecond = 1000n * Nanosecond; | ||
export const Millisecond = 1000n * Microsecond; | ||
export const Second = 1000n * Millisecond; | ||
export const Minute = 60n * Second; | ||
export const Hour = 60n * Minute; | ||
export const Day = 24n * Hour; | ||
export const Week = 7n * Day; | ||
export const Year = 365n * Day; | ||
export const Nanosecond = BigInt(1); | ||
export const Microsecond = BigInt(1000) * Nanosecond; | ||
export const Millisecond = BigInt(1000) * Microsecond; | ||
export const Second = BigInt(1000) * Millisecond; | ||
export const Minute = BigInt(60) * Second; | ||
export const Hour = BigInt(60) * Minute; | ||
export const Day = BigInt(24) * Hour; | ||
export const Week = BigInt(7) * Day; | ||
export const Year = BigInt(365) * Day; | ||
const scale = { | ||
@@ -64,3 +64,3 @@ ns: Nanosecond, | ||
function parseNanos(s: string) { | ||
if (s.length === 0) return 0n; | ||
if (s.length === 0) return BigInt(0); | ||
@@ -73,3 +73,3 @@ let negative = false; | ||
let matches = s.matchAll(parseRE); | ||
let d = 0n; | ||
let d = BigInt(0); | ||
for (const match of matches) { | ||
@@ -85,8 +85,8 @@ if (match.length !== 3) throw new Error("Invalid Duration"); | ||
let frac = parts[1]; | ||
let extra = 0n; | ||
let extra = BigInt(0); | ||
for (let char of frac) { | ||
extra += BigInt(char) * unit; | ||
unit /= 10n; | ||
unit /= BigInt(10); | ||
} | ||
d += (extra + 5n) / 10n; | ||
d += (extra + BigInt(5)) / BigInt(10); | ||
} else { | ||
@@ -97,5 +97,5 @@ d += BigInt(num) * unit; | ||
if (negative) { | ||
d *= -1n; | ||
d *= BigInt(-1); | ||
} | ||
return d; | ||
} |
@@ -44,6 +44,6 @@ import { | ||
toBigInt(): bigint { | ||
if (isNull(this._time)) return 0n; | ||
if (isNull(this._time)) return BigInt(0); | ||
// @ts-ignore | ||
let secs = this._time.toEpochSecond(ZoneOffset.UTC); | ||
return BigInt(secs) * 1_000_000_000n + BigInt(this._time.nano()); | ||
return BigInt(secs) * BigInt(1_000_000_000) + BigInt(this._time.nano()); | ||
} | ||
@@ -50,0 +50,0 @@ |
@@ -10,3 +10,3 @@ import { isNull } from "../utils"; | ||
if (isNull(this.value)) return null; | ||
return BigInt(this.value); | ||
return parseInt(this.value); | ||
} | ||
@@ -13,0 +13,0 @@ |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1367837
40596
2