/
opt
/
canhelp
/
node_modules
/
gel
/
dist
/
/opt/canhelp/node_modules/gel/dist
mkdir
upload
Name
Size
Mode
Actions
codecs/
-
0755
rm
datatypes/
-
0755
rm
errors/
-
0755
rm
primitives/
-
0755
rm
reflection/
-
0755
rm
baseClient.d.ts
5887
0644
edit
dl
rm
baseClient.js
19887
0644
edit
dl
rm
baseConn.d.ts
4890
0644
edit
dl
rm
baseConn.js
31588
0644
edit
dl
rm
browserClient.d.ts
200
0644
edit
dl
rm
browserClient.js
1212
0644
edit
dl
rm
browserCrypto.d.ts
91
0644
edit
dl
rm
browserCrypto.js
724
0644
edit
dl
rm
cli.mjs
7439
0755
edit
dl
rm
codecTypeRegistry.d.ts
195
0644
edit
dl
rm
codecTypeRegistry.js
77
0644
edit
dl
rm
conUtils.d.ts
5540
0644
edit
dl
rm
conUtils.js
36259
0644
edit
dl
rm
conUtils.server.d.ts
555
0644
edit
dl
rm
conUtils.server.js
3266
0644
edit
dl
rm
credentials.d.ts
561
0644
edit
dl
rm
credentials.js
4158
0644
edit
dl
rm
cryptoUtils.d.ts
106
0644
edit
dl
rm
cryptoUtils.js
811
0644
edit
dl
rm
fetchConn.d.ts
2800
0644
edit
dl
rm
fetchConn.js
7545
0644
edit
dl
rm
httpScram.d.ts
229
0644
edit
dl
rm
httpScram.js
3970
0644
edit
dl
rm
ifaces.d.ts
2530
0644
edit
dl
rm
ifaces.js
2847
0644
edit
dl
rm
index.browser.d.ts
867
0644
edit
dl
rm
index.browser.js
1973
0644
edit
dl
rm
index.node.d.ts
1275
0644
edit
dl
rm
index.node.js
3266
0644
edit
dl
rm
index.shared.d.ts
1896
0644
edit
dl
rm
index.shared.js
5486
0644
edit
dl
rm
nodeClient.d.ts
240
0644
edit
dl
rm
nodeClient.js
1529
0644
edit
dl
rm
nodeCrypto.d.ts
91
0644
edit
dl
rm
nodeCrypto.js
917
0644
edit
dl
rm
options.d.ts
4254
0644
edit
dl
rm
options.js
11249
0644
edit
dl
rm
platform.d.ts
124
0644
edit
dl
rm
platform.js
1731
0644
edit
dl
rm
rawConn.d.ts
1218
0644
edit
dl
rm
rawConn.js
17314
0644
edit
dl
rm
retry.d.ts
1153
0644
edit
dl
rm
retry.js
3925
0644
edit
dl
rm
scram.d.ts
1723
0644
edit
dl
rm
scram.js
6004
0644
edit
dl
rm
systemUtils.d.ts
483
0644
edit
dl
rm
systemUtils.js
3840
0644
edit
dl
rm
transaction.d.ts
1738
0644
edit
dl
rm
transaction.js
8113
0644
edit
dl
rm
typeutil.d.ts
243
0644
edit
dl
rm
typeutil.js
77
0644
edit
dl
rm
utils.d.ts
1925
0644
edit
dl
rm
utils.js
3727
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/gel/dist/transaction.js
(8113B)
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Transaction = exports.TransactionImpl = exports.TransactionState = void 0; const errors = __importStar(require("./errors")); const ifaces_1 = require("./ifaces"); const options_1 = require("./options"); var TransactionState; (function (TransactionState) { TransactionState[TransactionState["ACTIVE"] = 0] = "ACTIVE"; TransactionState[TransactionState["COMMITTED"] = 1] = "COMMITTED"; TransactionState[TransactionState["ROLLEDBACK"] = 2] = "ROLLEDBACK"; TransactionState[TransactionState["FAILED"] = 3] = "FAILED"; })(TransactionState || (exports.TransactionState = TransactionState = {})); class TransactionImpl { _holder; _rawConn; _state; _opInProgress; constructor(holder, rawConn) { this._holder = holder; this._rawConn = rawConn; this._state = TransactionState.ACTIVE; this._opInProgress = false; } static async _startTransaction(holder, optimisticRepeatableRead) { const rawConn = await holder._getConnection(); await rawConn.resetState(); const options = holder.options.transactionOptions; const txOptions = []; if (options.isolation === options_1.IsolationLevel.RepeatableRead) { txOptions.push(`ISOLATION REPEATABLE READ`); } else if (options.isolation === options_1.IsolationLevel.Serializable) { txOptions.push(`ISOLATION SERIALIZABLE`); } else if (options.isolation === options_1.IsolationLevel.PreferRepeatableRead) { if (optimisticRepeatableRead) { txOptions.push(`ISOLATION REPEATABLE READ`); } else { txOptions.push(`ISOLATION SERIALIZABLE`); } } else if (options.isolation != null) { throw new errors.InterfaceError(`Invalid isolation level: ${options.isolation}`); } if (options.readonly !== undefined) { txOptions.push(options.readonly ? "READ ONLY" : "READ WRITE"); } if (options.deferrable !== undefined) { txOptions.push(options.deferrable ? "DEFERRABLE" : "NOT DEFERRABLE"); } await rawConn.fetch(`START TRANSACTION ${txOptions.join(", ")};`, undefined, ifaces_1.OutputFormat.NONE, ifaces_1.Cardinality.NO_RESULT, holder.options, true); return new TransactionImpl(holder, rawConn); } async _waitForConnAbort() { await this._rawConn.connAbortWaiter.wait(); const abortError = this._rawConn.getConnAbortError(); if (abortError instanceof errors.GelError && abortError.cause instanceof errors.TransactionTimeoutError) { throw abortError.cause; } else { throw abortError; } } async _runOp(opname, op, errMessage) { if (this._opInProgress) { throw new errors.InterfaceError(errMessage ?? "Another query is in progress. Use the query methods " + "on 'Client' to run queries concurrently."); } if (this._state !== TransactionState.ACTIVE) { throw new errors.InterfaceError(`cannot ${opname}; the transaction is ${this._state === TransactionState.COMMITTED ? "already committed" : this._state === TransactionState.ROLLEDBACK ? "already rolled back" : "in error state"}`); } this._opInProgress = true; try { return await op(); } finally { this._opInProgress = false; } } 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() { await this._runOp("commit", async () => { await this._rawConn.fetch("COMMIT", undefined, ifaces_1.OutputFormat.NONE, ifaces_1.Cardinality.NO_RESULT, this._holder.options, true); this._state = TransactionState.COMMITTED; }, "A query is still in progress after transaction block has returned."); } async _rollback() { await this._runOp("rollback", async () => { await this._rawConn.fetch("ROLLBACK", undefined, ifaces_1.OutputFormat.NONE, ifaces_1.Cardinality.NO_RESULT, this._holder.options, true); this._state = TransactionState.ROLLEDBACK; }, "A query is still in progress after transaction block has returned."); } } exports.TransactionImpl = TransactionImpl; class Transaction { impl; options; constructor(impl, options) { this.impl = impl; this.options = options; } withSQLRowMode(mode) { return new Transaction(this.impl, this.options.withSQLRowMode(mode)); } async execute(query, args) { await this.impl._runFetchOp("execute", query, args, ifaces_1.OutputFormat.NONE, ifaces_1.Cardinality.NO_RESULT, this.options); } async executeSQL(query, args) { await this.impl._runFetchOp("execute", query, args, ifaces_1.OutputFormat.NONE, ifaces_1.Cardinality.NO_RESULT, this.options, false, ifaces_1.Language.SQL); } async query(query, args) { return this.impl._runFetchOp("query", query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.MANY, this.options); } async querySQL(query, args) { return this.impl._runFetchOp("query", query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.MANY, this.options, false, ifaces_1.Language.SQL); } async queryJSON(query, args) { return this.impl._runFetchOp("queryJSON", query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.MANY, this.options); } async querySingle(query, args) { return this.impl._runFetchOp("querySingle", query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.AT_MOST_ONE, this.options); } async querySingleJSON(query, args) { return this.impl._runFetchOp("querySingleJSON", query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.AT_MOST_ONE, this.options); } async queryRequired(query, args) { return this.impl._runFetchOp("queryRequired", query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.AT_LEAST_ONE, this.options); } async queryRequiredJSON(query, args) { return this.impl._runFetchOp("queryRequiredJSON", query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.AT_LEAST_ONE, this.options); } async queryRequiredSingle(query, args) { return this.impl._runFetchOp("queryRequiredSingle", query, args, ifaces_1.OutputFormat.BINARY, ifaces_1.Cardinality.ONE, this.options); } async queryRequiredSingleJSON(query, args) { return this.impl._runFetchOp("queryRequiredSingleJSON", query, args, ifaces_1.OutputFormat.JSON, ifaces_1.Cardinality.ONE, this.options); } } exports.Transaction = Transaction;
Save
cmd:
run