Comparing version 1.6.0-canary.20241008T130000 to 1.6.0-canary.20241008T210338
@@ -21,3 +21,3 @@ /*! | ||
import { type Executor, type QueryArgs } from "./ifaces"; | ||
import type { RetryOptions, Session, SimpleRetryOptions, SimpleTransactionOptions, TransactionOptions } from "./options"; | ||
import type { RetryOptions, Session, SimpleRetryOptions, SimpleTransactionOptions, TransactionOptions, WarningHandler } from "./options"; | ||
import { Options } from "./options"; | ||
@@ -104,2 +104,3 @@ import type { BaseRawConnection } from "./baseConn"; | ||
withGlobals(globals: Record<string, any>): Client; | ||
withWarningHandler(handler: WarningHandler): Client; | ||
ensureConnected(): Promise<this>; | ||
@@ -106,0 +107,0 @@ resolveConnectionParams(): Promise<ResolvedConnectConfigReadonly>; |
@@ -155,7 +155,10 @@ "use strict"; | ||
async retryingFetch(query, args, outputFormat, expectedCardinality) { | ||
let result; | ||
for (let iteration = 0;; ++iteration) { | ||
const conn = await this._getConnection(); | ||
try { | ||
result = await conn.fetch(query, args, outputFormat, expectedCardinality, this.options.session); | ||
const { result, warnings } = await conn.fetch(query, args, outputFormat, expectedCardinality, this.options.session); | ||
if (warnings.length) { | ||
this.options.warningHandler(warnings); | ||
} | ||
return result; | ||
} | ||
@@ -176,7 +179,6 @@ catch (err) { | ||
} | ||
return result; | ||
} | ||
} | ||
async execute(query, args) { | ||
return this.retryingFetch(query, args, ifaces_1.OutputFormat.NONE, ifaces_1.Cardinality.NO_RESULT); | ||
await this.retryingFetch(query, args, ifaces_1.OutputFormat.NONE, ifaces_1.Cardinality.NO_RESULT); | ||
} | ||
@@ -385,2 +387,5 @@ async query(query, args) { | ||
} | ||
withWarningHandler(handler) { | ||
return new Client(this.pool, this.options.withWarningHandler(handler)); | ||
} | ||
async ensureConnected() { | ||
@@ -387,0 +392,0 @@ await this.pool.ensureConnected(); |
@@ -20,2 +20,3 @@ /*! | ||
import type { CodecsRegistry } from "./codecs/registry"; | ||
import * as errors from "./errors"; | ||
import type { QueryOptions, ProtocolVersion, QueryArgs } from "./ifaces"; | ||
@@ -47,3 +48,4 @@ import { Cardinality, OutputFormat } from "./ifaces"; | ||
inCodecBuffer: Uint8Array | null, | ||
outCodecBuffer: Uint8Array | null | ||
outCodecBuffer: Uint8Array | null, | ||
warnings: errors.EdgeDBError[] | ||
]; | ||
@@ -76,2 +78,3 @@ export type connConstructor = new (registry: CodecsRegistry) => BaseRawConnection; | ||
protected _ignoreHeaders(): void; | ||
protected _readHeaders(): Record<string, string>; | ||
protected _abortWaiters(err: Error): void; | ||
@@ -100,6 +103,9 @@ protected _parseHeaders(): Map<number, Uint8Array>; | ||
_parse(query: string, outputFormat: OutputFormat, expectedCardinality: Cardinality, state: Session, capabilitiesFlags?: number, options?: QueryOptions): Promise<ParseResult>; | ||
protected _executeFlow(query: string, args: QueryArgs, outputFormat: OutputFormat, expectedCardinality: Cardinality, state: Session, inCodec: ICodec, outCodec: ICodec, result: any[] | WriteBuffer, capabilitiesFlags?: number, options?: QueryOptions): Promise<void>; | ||
protected _executeFlow(query: string, args: QueryArgs, outputFormat: OutputFormat, expectedCardinality: Cardinality, state: Session, inCodec: ICodec, outCodec: ICodec, result: any[] | WriteBuffer, capabilitiesFlags?: number, options?: QueryOptions): Promise<errors.EdgeDBError[]>; | ||
private _getQueryCacheKey; | ||
private _validateFetchCardinality; | ||
fetch(query: string, args: QueryArgs | undefined, outputFormat: OutputFormat, expectedCardinality: Cardinality, state: Session, privilegedMode?: boolean): Promise<any>; | ||
fetch(query: string, args: QueryArgs | undefined, outputFormat: OutputFormat, expectedCardinality: Cardinality, state: Session, privilegedMode?: boolean): Promise<{ | ||
result: any; | ||
warnings: errors.EdgeDBError[]; | ||
}>; | ||
getQueryCapabilities(query: string, outputFormat: OutputFormat, expectedCardinality: Cardinality): number | null; | ||
@@ -106,0 +112,0 @@ legacyExecute(query: string, allowTransactionCommands?: boolean): Promise<void>; |
@@ -159,2 +159,12 @@ "use strict"; | ||
} | ||
_readHeaders() { | ||
const numFields = this.buffer.readInt16(); | ||
const headers = {}; | ||
for (let i = 0; i < numFields; i++) { | ||
const key = this.buffer.readString(); | ||
const value = this.buffer.readString(); | ||
headers[key] = value; | ||
} | ||
return headers; | ||
} | ||
_abortWaiters(err) { | ||
@@ -178,4 +188,5 @@ if (!this.connWaiter.done) { | ||
} | ||
_parseDescribeTypeMessage() { | ||
_parseDescribeTypeMessage(query) { | ||
let capabilities = -1; | ||
let warnings = []; | ||
if (this.isLegacyProtocol) { | ||
@@ -189,3 +200,10 @@ const headers = this._parseHeaders(); | ||
else { | ||
this._ignoreHeaders(); | ||
const headers = this._readHeaders(); | ||
if (headers["warnings"] != null) { | ||
warnings = JSON.parse(headers.warnings).map((warning) => { | ||
const err = (0, resolve_1.errorFromJSON)(warning); | ||
err._query = query; | ||
return err; | ||
}); | ||
} | ||
capabilities = Number(this.buffer.readBigInt64()); | ||
@@ -214,2 +232,3 @@ } | ||
outTypeData, | ||
warnings, | ||
]; | ||
@@ -454,3 +473,3 @@ } | ||
outCodecData, | ||
] = this._parseDescribeTypeMessage(); | ||
] = this._parseDescribeTypeMessage(query); | ||
} | ||
@@ -631,3 +650,3 @@ catch (e) { | ||
[newCard, inCodec, outCodec, capabilities] = | ||
this._parseDescribeTypeMessage(); | ||
this._parseDescribeTypeMessage(query); | ||
const key = this._getQueryCacheKey(query, outputFormat, expectedCardinality); | ||
@@ -716,2 +735,3 @@ this.queryCodecCache.set(key, [ | ||
let outCodecBuf = null; | ||
let warnings = []; | ||
while (parsing) { | ||
@@ -732,3 +752,4 @@ if (!this.buffer.takeMessage()) { | ||
outCodecBuf, | ||
] = this._parseDescribeTypeMessage(); | ||
warnings, | ||
] = this._parseDescribeTypeMessage(query); | ||
const key = this._getQueryCacheKey(query, outputFormat, expectedCardinality); | ||
@@ -778,2 +799,3 @@ this.queryCodecCache.set(key, [ | ||
outCodecBuf, | ||
warnings, | ||
]; | ||
@@ -799,2 +821,3 @@ } | ||
let parsing = true; | ||
let warnings = []; | ||
while (parsing) { | ||
@@ -832,3 +855,3 @@ if (!this.buffer.takeMessage()) { | ||
try { | ||
const [newCard, newInCodec, newOutCodec, capabilities] = this._parseDescribeTypeMessage(); | ||
const [newCard, newInCodec, newOutCodec, capabilities, _, __, _warnings,] = this._parseDescribeTypeMessage(query); | ||
const key = this._getQueryCacheKey(query, outputFormat, expectedCardinality); | ||
@@ -842,2 +865,3 @@ this.queryCodecCache.set(key, [ | ||
outCodec = newOutCodec; | ||
warnings = _warnings; | ||
} | ||
@@ -868,2 +892,3 @@ catch (e) { | ||
} | ||
return warnings; | ||
} | ||
@@ -887,3 +912,4 @@ _getQueryCacheKey(query, outputFormat, expectedCardinality) { | ||
} | ||
return this.legacyExecute(query, privilegedMode); | ||
await this.legacyExecute(query, privilegedMode); | ||
return { result: null, warnings: [] }; | ||
} | ||
@@ -896,2 +922,4 @@ this._checkState(); | ||
const ret = []; | ||
let _; | ||
let warnings = []; | ||
if (!this.isLegacyProtocol) { | ||
@@ -904,7 +932,7 @@ let [card, inCodec, outCodec] = this.queryCodecCache.get(key) ?? []; | ||
(this.stateCodec === codecs_1.INVALID_CODEC && state !== options_1.Session.defaults())) { | ||
[card, inCodec, outCodec] = await this._parse(query, outputFormat, expectedCardinality, state, privilegedMode ? Capabilities.ALL : undefined); | ||
[card, inCodec, outCodec, _, _, _, warnings] = await this._parse(query, outputFormat, expectedCardinality, state, privilegedMode ? Capabilities.ALL : undefined); | ||
this._validateFetchCardinality(card, outputFormat, expectedCardinality); | ||
} | ||
try { | ||
await this._executeFlow(query, args, outputFormat, expectedCardinality, state, inCodec ?? codecs_1.NULL_CODEC, outCodec ?? codecs_1.NULL_CODEC, ret, privilegedMode ? Capabilities.ALL : undefined); | ||
warnings = await this._executeFlow(query, args, outputFormat, expectedCardinality, state, inCodec ?? codecs_1.NULL_CODEC, outCodec ?? codecs_1.NULL_CODEC, ret, privilegedMode ? Capabilities.ALL : undefined); | ||
} | ||
@@ -914,3 +942,3 @@ catch (e) { | ||
[card, inCodec, outCodec] = this.queryCodecCache.get(key); | ||
await this._executeFlow(query, args, outputFormat, expectedCardinality, state, inCodec ?? codecs_1.NULL_CODEC, outCodec ?? codecs_1.NULL_CODEC, ret, privilegedMode ? Capabilities.ALL : undefined); | ||
warnings = await this._executeFlow(query, args, outputFormat, expectedCardinality, state, inCodec ?? codecs_1.NULL_CODEC, outCodec ?? codecs_1.NULL_CODEC, ret, privilegedMode ? Capabilities.ALL : undefined); | ||
} | ||
@@ -940,3 +968,3 @@ else { | ||
if (outputFormat === ifaces_1.OutputFormat.NONE) { | ||
return; | ||
return { result: null, warnings }; | ||
} | ||
@@ -948,3 +976,3 @@ if (expectOne) { | ||
else { | ||
return ret[0] ?? (asJson ? "null" : null); | ||
return { result: ret[0] ?? (asJson ? "null" : null), warnings }; | ||
} | ||
@@ -955,6 +983,6 @@ } | ||
if (asJson) { | ||
return ret[0]; | ||
return { result: ret[0], warnings }; | ||
} | ||
else { | ||
return ret; | ||
return { result: ret, warnings }; | ||
} | ||
@@ -964,6 +992,6 @@ } | ||
if (asJson) { | ||
return "[]"; | ||
return { result: "[]", warnings }; | ||
} | ||
else { | ||
return ret; | ||
return { result: ret, warnings }; | ||
} | ||
@@ -970,0 +998,0 @@ } |
@@ -33,3 +33,2 @@ "use strict"; | ||
const pgvector_1 = require("./pgvector"); | ||
const postgis_1 = require("./postgis"); | ||
const errors_1 = require("../errors"); | ||
@@ -84,5 +83,1 @@ const consts_1 = require("./consts"); | ||
registerScalarCodec("ext::pgvector::vector", pgvector_1.PgVectorCodec); | ||
registerScalarCodec("ext::postgis::geometry", postgis_1.PostgisGeometryCodec); | ||
registerScalarCodec("ext::postgis::geography", postgis_1.PostgisGeometryCodec); | ||
registerScalarCodec("ext::postgis::box2d", postgis_1.PostgisBox2dCodec); | ||
registerScalarCodec("ext::postgis::box3d", postgis_1.PostgisBox3dCodec); |
@@ -50,6 +50,2 @@ "use strict"; | ||
["9565dd8804f511eea6910b6ebe179825", "ext::pgvector::vector"], | ||
["44c901c0d922489483c8061bd05e4840", "ext::postgis::geometry"], | ||
["4d7388783a5f4821ab769d8e7d6b32c4", "ext::postgis::geography"], | ||
["7fae553663114f608eb9096a5d972f48", "ext::postgis::box2d"], | ||
["c1a50ff8fded48b085c24905a8481433", "ext::postgis::box3d"], | ||
]); | ||
@@ -56,0 +52,0 @@ exports.KNOWN_TYPENAMES = (() => { |
@@ -0,3 +1,6 @@ | ||
import { tags } from "./tags"; | ||
export declare class EdgeDBError extends Error { | ||
protected static tags: object; | ||
protected static tags: { | ||
[tag in tags]?: boolean; | ||
}; | ||
private _message; | ||
@@ -11,5 +14,20 @@ private _query?; | ||
get name(): string; | ||
hasTag(tag: symbol): boolean; | ||
hasTag(tag: tags): boolean; | ||
} | ||
export type ErrorType = new (msg: string) => EdgeDBError; | ||
export declare function prettyPrintError(attrs: Map<number, Uint8Array>, query: string): string; | ||
export declare enum ErrorAttr { | ||
hint = 1, | ||
details = 2, | ||
serverTraceback = 257, | ||
positionStart = -15, | ||
positionEnd = -14, | ||
lineStart = -13, | ||
columnStart = -12, | ||
utf16ColumnStart = -11, | ||
lineEnd = -10, | ||
columnEnd = -9, | ||
utf16ColumnEnd = -8, | ||
characterStart = -7, | ||
characterEnd = -6 | ||
} | ||
export declare function prettyPrintError(attrs: Map<number, Uint8Array | string>, query: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EdgeDBError = void 0; | ||
exports.ErrorAttr = exports.EdgeDBError = void 0; | ||
exports.prettyPrintError = prettyPrintError; | ||
@@ -31,3 +31,3 @@ const buffer_1 = require("../primitives/buffer"); | ||
const error_type = this.constructor; | ||
return Boolean(error_type.tags?.[tag]); | ||
return error_type.tags[tag] ?? false; | ||
} | ||
@@ -51,8 +51,8 @@ } | ||
ErrorAttr[ErrorAttr["characterEnd"] = -6] = "characterEnd"; | ||
})(ErrorAttr || (ErrorAttr = {})); | ||
})(ErrorAttr || (exports.ErrorAttr = ErrorAttr = {})); | ||
function tryParseInt(val) { | ||
if (!(val instanceof Uint8Array)) | ||
if (val == null) | ||
return null; | ||
try { | ||
return parseInt(buffer_1.utf8Decoder.decode(val), 10); | ||
return parseInt(val instanceof Uint8Array ? buffer_1.utf8Decoder.decode(val) : val, 10); | ||
} | ||
@@ -63,2 +63,5 @@ catch { | ||
} | ||
function readAttrStr(val) { | ||
return val instanceof Uint8Array ? buffer_1.utf8Decoder.decode(val) : val ?? ""; | ||
} | ||
function prettyPrintError(attrs, query) { | ||
@@ -88,8 +91,8 @@ let errMessage = "\n"; | ||
if (attrs.has(ErrorAttr.details)) { | ||
errMessage += `Details: ${buffer_1.utf8Decoder.decode(attrs.get(ErrorAttr.details))}\n`; | ||
errMessage += `Details: ${readAttrStr(attrs.get(ErrorAttr.details))}\n`; | ||
} | ||
if (attrs.has(ErrorAttr.hint)) { | ||
errMessage += `Hint: ${buffer_1.utf8Decoder.decode(attrs.get(ErrorAttr.hint))}\n`; | ||
errMessage += `Hint: ${readAttrStr(attrs.get(ErrorAttr.hint))}\n`; | ||
} | ||
return errMessage; | ||
} |
@@ -18,3 +18,5 @@ /*! | ||
*/ | ||
import type { ErrorType } from "./base"; | ||
import * as errors from "./index"; | ||
import { type ErrorType } from "./base"; | ||
export declare function resolveErrorCode(code: number): ErrorType; | ||
export declare function errorFromJSON(data: any): errors.EdgeDBError; |
@@ -44,3 +44,5 @@ "use strict"; | ||
exports.resolveErrorCode = resolveErrorCode; | ||
exports.errorFromJSON = errorFromJSON; | ||
const errors = __importStar(require("./index")); | ||
const base_1 = require("./base"); | ||
const map_1 = require("./map"); | ||
@@ -70,1 +72,21 @@ function resolveErrorCode(code) { | ||
} | ||
const _JSON_FIELDS = { | ||
hint: base_1.ErrorAttr.hint, | ||
details: base_1.ErrorAttr.details, | ||
start: base_1.ErrorAttr.characterStart, | ||
end: base_1.ErrorAttr.characterEnd, | ||
line: base_1.ErrorAttr.lineStart, | ||
col: base_1.ErrorAttr.columnStart, | ||
}; | ||
function errorFromJSON(data) { | ||
const errType = resolveErrorCode(data.code); | ||
const err = new errType(data.message); | ||
const attrs = new Map(); | ||
for (const [name, field] of Object.entries(_JSON_FIELDS)) { | ||
if (data["name"] != null) { | ||
attrs.set(field, data[name]); | ||
} | ||
} | ||
err._attrs = attrs; | ||
return err; | ||
} |
export declare const SHOULD_RECONNECT: unique symbol; | ||
export declare const SHOULD_RETRY: unique symbol; | ||
export type tags = typeof SHOULD_RECONNECT | typeof SHOULD_RETRY; |
@@ -27,5 +27,5 @@ /*! | ||
export { IsolationLevel, RetryCondition, RetryOptions, Session, } from "./options"; | ||
export { defaultBackoff } from "./options"; | ||
export { defaultBackoff, logWarnings, throwWarnings } from "./options"; | ||
export type { BackoffFunction } from "./options"; | ||
export * from "./index.shared"; | ||
export * as $ from "./reflection"; |
@@ -46,3 +46,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.$ = exports.defaultBackoff = exports.Session = exports.RetryOptions = exports.RetryCondition = exports.IsolationLevel = exports._RawConnection = exports.adapter = exports.createHttpClient = exports.createClient = void 0; | ||
exports.$ = exports.throwWarnings = exports.logWarnings = exports.defaultBackoff = exports.Session = exports.RetryOptions = exports.RetryCondition = exports.IsolationLevel = exports._RawConnection = exports.adapter = exports.createHttpClient = exports.createClient = void 0; | ||
const nodeClient_1 = require("./nodeClient"); | ||
@@ -64,3 +64,5 @@ exports.default = nodeClient_1.createClient; | ||
Object.defineProperty(exports, "defaultBackoff", { enumerable: true, get: function () { return options_2.defaultBackoff; } }); | ||
Object.defineProperty(exports, "logWarnings", { enumerable: true, get: function () { return options_2.logWarnings; } }); | ||
Object.defineProperty(exports, "throwWarnings", { enumerable: true, get: function () { return options_2.throwWarnings; } }); | ||
__exportStar(require("./index.shared"), exports); | ||
exports.$ = __importStar(require("./reflection")); |
@@ -25,2 +25,5 @@ import * as errors from "./errors"; | ||
} | ||
export type WarningHandler = (warnings: errors.EdgeDBError[]) => void; | ||
export declare function throwWarnings(warnings: errors.EdgeDBError[]): void; | ||
export declare function logWarnings(warnings: errors.EdgeDBError[]): void; | ||
export declare class RetryOptions { | ||
@@ -83,6 +86,8 @@ readonly default: RetryRule; | ||
readonly session: Session; | ||
constructor({ retryOptions, transactionOptions, session, }?: { | ||
readonly warningHandler: WarningHandler; | ||
constructor({ retryOptions, transactionOptions, session, warningHandler, }?: { | ||
retryOptions?: RetryOptions; | ||
transactionOptions?: TransactionOptions; | ||
session?: Session; | ||
warningHandler?: WarningHandler; | ||
}); | ||
@@ -92,4 +97,5 @@ withTransactionOptions(opt: TransactionOptions | SimpleTransactionOptions): Options; | ||
withSession(opt: Session): Options; | ||
withWarningHandler(handler: WarningHandler): Options; | ||
static defaults(): Options; | ||
} | ||
export {}; |
@@ -28,2 +28,4 @@ "use strict"; | ||
exports.defaultBackoff = defaultBackoff; | ||
exports.throwWarnings = throwWarnings; | ||
exports.logWarnings = logWarnings; | ||
const errors = __importStar(require("./errors")); | ||
@@ -50,2 +52,10 @@ function defaultBackoff(attempt) { | ||
} | ||
function throwWarnings(warnings) { | ||
throw new Error(`warnings occurred while running query: ${warnings.map((warn) => warn.message)}`, { cause: warnings }); | ||
} | ||
function logWarnings(warnings) { | ||
for (const warning of warnings) { | ||
console.warn(new Error(`EdgeDB warning: ${warning.message}`, { cause: warning })); | ||
} | ||
} | ||
class RetryOptions { | ||
@@ -157,6 +167,8 @@ default; | ||
session; | ||
constructor({ retryOptions = RetryOptions.defaults(), transactionOptions = TransactionOptions.defaults(), session = Session.defaults(), } = {}) { | ||
warningHandler; | ||
constructor({ retryOptions = RetryOptions.defaults(), transactionOptions = TransactionOptions.defaults(), session = Session.defaults(), warningHandler = logWarnings, } = {}) { | ||
this.retryOptions = retryOptions; | ||
this.transactionOptions = transactionOptions; | ||
this.session = session; | ||
this.warningHandler = warningHandler; | ||
} | ||
@@ -183,2 +195,5 @@ withTransactionOptions(opt) { | ||
} | ||
withWarningHandler(handler) { | ||
return new Options({ ...this, warningHandler: handler }); | ||
} | ||
static defaults() { | ||
@@ -185,0 +200,0 @@ return new Options(); |
@@ -50,3 +50,2 @@ /*! | ||
writeBuffer(buf: Uint8Array): this; | ||
writeDeferredSize(): () => void; | ||
unwrap(): Uint8Array; | ||
@@ -135,4 +134,4 @@ } | ||
readFloat32(): number; | ||
readFloat64(le?: boolean): number; | ||
readUInt32(le?: boolean): number; | ||
readFloat64(): number; | ||
readUInt32(): number; | ||
private reportInt64Overflow; | ||
@@ -139,0 +138,0 @@ readInt64(): number; |
@@ -199,9 +199,2 @@ "use strict"; | ||
} | ||
writeDeferredSize() { | ||
const startPos = this.pos; | ||
this.writeInt32(0); | ||
return () => { | ||
this.buffer.setInt32(startPos, this.pos - (startPos + 4)); | ||
}; | ||
} | ||
unwrap() { | ||
@@ -804,15 +797,15 @@ return this._rawBuffer.subarray(0, this.pos); | ||
} | ||
readFloat64(le) { | ||
readFloat64() { | ||
if (this.pos + 8 > this.len) { | ||
throw new BufferError("buffer overread"); | ||
} | ||
const num = this.buffer.getFloat64(this.pos, le); | ||
const num = this.buffer.getFloat64(this.pos); | ||
this.pos += 8; | ||
return num; | ||
} | ||
readUInt32(le) { | ||
readUInt32() { | ||
if (this.pos + 4 > this.len) { | ||
throw new BufferError("buffer overread"); | ||
} | ||
const num = this.buffer.getUint32(this.pos, le); | ||
const num = this.buffer.getUint32(this.pos); | ||
this.pos += 4; | ||
@@ -819,0 +812,0 @@ return num; |
@@ -16,2 +16,3 @@ import type { ClientConnectionHolder } from "./baseClient"; | ||
private _runOp; | ||
private _runFetchOp; | ||
execute(query: string, args?: QueryArgs): Promise<void>; | ||
@@ -18,0 +19,0 @@ query<T = unknown>(query: string, args?: QueryArgs): Promise<T[]>; |
@@ -86,2 +86,9 @@ "use strict"; | ||
} | ||
async _runFetchOp(opName, ...args) { | ||
const { result, warnings } = await this._runOp(opName, () => this._rawConn.fetch(...args)); | ||
if (warnings.length) { | ||
this._holder.options.warningHandler(warnings); | ||
} | ||
return result; | ||
} | ||
async _commit() { | ||
@@ -100,29 +107,29 @@ await this._runOp("commit", async () => { | ||
async execute(query, args) { | ||
return this._runOp("execute", () => this._rawConn.fetch(query, args, ifaces_1.OutputFormat.NONE, ifaces_1.Cardinality.NO_RESULT, this._holder.options.session)); | ||
await this._runFetchOp("execute", query, args, ifaces_1.OutputFormat.NONE, ifaces_1.Cardinality.NO_RESULT, this._holder.options.session); | ||
} | ||
async query(query, args) { | ||
return this._runOp("query", () => this._rawConn.fetch(query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.MANY, this._holder.options.session)); | ||
return this._runFetchOp("query", query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.MANY, this._holder.options.session); | ||
} | ||
async queryJSON(query, args) { | ||
return this._runOp("queryJSON", () => this._rawConn.fetch(query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.MANY, this._holder.options.session)); | ||
return this._runFetchOp("queryJSON", query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.MANY, this._holder.options.session); | ||
} | ||
async querySingle(query, args) { | ||
return this._runOp("querySingle", () => this._rawConn.fetch(query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.AT_MOST_ONE, this._holder.options.session)); | ||
return this._runFetchOp("querySingle", query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.AT_MOST_ONE, this._holder.options.session); | ||
} | ||
async querySingleJSON(query, args) { | ||
return this._runOp("querySingleJSON", () => this._rawConn.fetch(query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.AT_MOST_ONE, this._holder.options.session)); | ||
return this._runFetchOp("querySingleJSON", query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.AT_MOST_ONE, this._holder.options.session); | ||
} | ||
async queryRequired(query, args) { | ||
return this._runOp("queryRequired", () => this._rawConn.fetch(query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.AT_LEAST_ONE, this._holder.options.session)); | ||
return this._runFetchOp("queryRequired", query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.AT_LEAST_ONE, this._holder.options.session); | ||
} | ||
async queryRequiredJSON(query, args) { | ||
return this._runOp("queryRequiredJSON", () => this._rawConn.fetch(query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.AT_LEAST_ONE, this._holder.options.session)); | ||
return this._runFetchOp("queryRequiredJSON", query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.AT_LEAST_ONE, this._holder.options.session); | ||
} | ||
async queryRequiredSingle(query, args) { | ||
return this._runOp("queryRequiredSingle", () => this._rawConn.fetch(query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.ONE, this._holder.options.session)); | ||
return this._runFetchOp("queryRequiredSingle", query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.ONE, this._holder.options.session); | ||
} | ||
async queryRequiredSingleJSON(query, args) { | ||
return this._runOp("queryRequiredSingleJSON", () => this._rawConn.fetch(query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.ONE, this._holder.options.session)); | ||
return this._runFetchOp("queryRequiredSingleJSON", query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.ONE, this._holder.options.session); | ||
} | ||
} | ||
exports.Transaction = Transaction; |
{ | ||
"name": "edgedb", | ||
"version": "1.6.0-canary.20241008T130000", | ||
"version": "1.6.0-canary.20241008T210338", | ||
"description": "The official Node.js client library for EdgeDB", | ||
@@ -5,0 +5,0 @@ "homepage": "https://edgedb.com/docs", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
0
245
555237
159
14447