ts-sql-query
Advanced tools
Comparing version 1.16.0 to 1.17.0
@@ -37,3 +37,5 @@ import type { SqlBuilder } from "../sqlBuilders/SqlBuilder"; | ||
executeAfterNextCommit(fn: () => void): void; | ||
executeAfterNextCommit(fn: () => Promise<void>): void; | ||
executeAfterNextRollback(fn: () => void): void; | ||
executeAfterNextRollback(fn: () => Promise<void>): void; | ||
transaction<P extends Promise<any>[]>(fn: () => [...P]): Promise<UnwrapPromiseTuple<P>>; | ||
@@ -40,0 +42,0 @@ transaction<T>(fn: () => Promise<T>): Promise<T>; |
@@ -16,2 +16,3 @@ "use strict"; | ||
const symbols_1 = require("../utils/symbols"); | ||
const PromiseProvider_1 = require("../utils/PromiseProvider"); | ||
const DynamicConditionBuilder_1 = require("../queryBuilders/DynamicConditionBuilder"); | ||
@@ -30,3 +31,3 @@ const RawFragmentImpl_1 = require("../internal/RawFragmentImpl"); | ||
pushTransactionStack() { | ||
if (this.onCommit || this.onCommitStack) { | ||
if (this.onCommit || this.onCommitStack || this.onRollback || this.onRollbackStack) { | ||
if (!this.onCommitStack) { | ||
@@ -37,4 +38,2 @@ this.onCommitStack = []; | ||
this.onCommit = undefined; | ||
} | ||
if (this.onRollback || this.onRollbackStack) { | ||
if (!this.onRollbackStack) { | ||
@@ -98,35 +97,10 @@ this.onRollbackStack = []; | ||
}, this.queryRunner).then((result) => { | ||
try { | ||
const onCommit = this.onCommit; | ||
if (onCommit) { | ||
for (let i = 0, length = onCommit.length; i < length; i++) { | ||
onCommit[i](); | ||
} | ||
} | ||
} | ||
catch (e) { | ||
throw (0, attachSource_1.attachTransactionSource)(new chained_error_1.default(e), source); | ||
} | ||
finally { | ||
this.popTransactionStack(); | ||
} | ||
return result; | ||
const onCommit = this.onCommit; | ||
this.popTransactionStack(); | ||
return (0, PromiseProvider_1.callDeferredFunctions)('after next commit', onCommit, result, source); | ||
}, (e) => { | ||
try { | ||
const onRollback = this.onRollback; | ||
if (onRollback) { | ||
for (let i = 0, length = onRollback.length; i < length; i++) { | ||
onRollback[i](); | ||
} | ||
} | ||
} | ||
catch (err) { | ||
const newError = (0, attachSource_1.attachTransactionSource)(new chained_error_1.default(err), source); | ||
(0, attachSource_1.attachTransactionError)(newError, e); | ||
throw newError; | ||
} | ||
finally { | ||
this.popTransactionStack(); | ||
} | ||
throw (0, attachSource_1.attachTransactionSource)(new chained_error_1.default(e), source); | ||
const throwError = (0, attachSource_1.attachTransactionSource)(new chained_error_1.default(e), source); | ||
const onRollback = this.onRollback; | ||
this.popTransactionStack(); | ||
return (0, PromiseProvider_1.callDeferredFunctions)('after next rollback', onRollback, undefined, source, e, throwError); | ||
}); | ||
@@ -156,19 +130,10 @@ } | ||
return this.queryRunner.executeCommit().then(() => { | ||
try { | ||
const onCommit = this.onCommit; | ||
if (onCommit) { | ||
for (let i = 0, length = onCommit.length; i < length; i++) { | ||
onCommit[i](); | ||
} | ||
} | ||
} | ||
catch (e) { | ||
throw (0, attachSource_1.attachSource)(new chained_error_1.default(e), source); | ||
} | ||
finally { | ||
this.popTransactionStack(); | ||
} | ||
const onCommit = this.onCommit; | ||
this.popTransactionStack(); | ||
return (0, PromiseProvider_1.callDeferredFunctions)('after next commit', onCommit, undefined, source); | ||
}, (e) => { | ||
const throwError = (0, attachSource_1.attachSource)(new chained_error_1.default(e), source); | ||
const onRollback = this.onRollback; | ||
this.popTransactionStack(); | ||
throw (0, attachSource_1.attachSource)(new chained_error_1.default(e), source); | ||
return (0, PromiseProvider_1.callDeferredFunctions)('after next rollback', onRollback, undefined, source, e, throwError); | ||
}); | ||
@@ -184,34 +149,10 @@ } | ||
return this.queryRunner.executeRollback().then(() => { | ||
try { | ||
const onRollback = this.onRollback; | ||
if (onRollback) { | ||
for (let i = 0, length = onRollback.length; i < length; i++) { | ||
onRollback[i](); | ||
} | ||
} | ||
} | ||
catch (e) { | ||
throw (0, attachSource_1.attachSource)(new chained_error_1.default(e), source); | ||
} | ||
finally { | ||
this.popTransactionStack(); | ||
} | ||
const onRollback = this.onRollback; | ||
this.popTransactionStack(); | ||
return (0, PromiseProvider_1.callDeferredFunctions)('after next rollback', onRollback, undefined, source); | ||
}, (e) => { | ||
try { | ||
const onRollback = this.onRollback; | ||
if (onRollback) { | ||
for (let i = 0, length = onRollback.length; i < length; i++) { | ||
onRollback[i](); | ||
} | ||
} | ||
} | ||
catch (err) { | ||
const newError = (0, attachSource_1.attachSource)(new chained_error_1.default(err), source); | ||
(0, attachSource_1.attachRollbackError)(newError, e); | ||
throw newError; | ||
} | ||
finally { | ||
this.popTransactionStack(); | ||
} | ||
throw (0, attachSource_1.attachSource)(new chained_error_1.default(e), source); | ||
const throwError = (0, attachSource_1.attachSource)(new chained_error_1.default(e), source); | ||
const onRollback = this.onRollback; | ||
this.popTransactionStack(); | ||
return (0, PromiseProvider_1.callDeferredFunctions)('after next rollback', onRollback, undefined, source, e, throwError); | ||
}); | ||
@@ -218,0 +159,0 @@ } |
@@ -22,4 +22,5 @@ import type { SqliteSqlBuilder } from "../sqlBuilders/SqliteSqlBuilder"; | ||
protected treatUxepectedStringDateTimeAsUTC: boolean; | ||
protected uxepectedUnixDateTimeAreMilliseconds: boolean; | ||
protected transformValueFromDB(value: unknown, type: string): unknown; | ||
protected transformValueToDB(value: unknown, type: string): unknown; | ||
} |
@@ -21,2 +21,3 @@ "use strict"; | ||
this.treatUxepectedStringDateTimeAsUTC = false; | ||
this.uxepectedUnixDateTimeAreMilliseconds = false; | ||
queryRunner.useDatabase('sqlite'); | ||
@@ -62,2 +63,3 @@ } | ||
case 'Unix time seconds as integer': | ||
case 'Unix time milliseconds as integer': | ||
if (!this.treatUxepectedStringDateTimeAsUTC) { | ||
@@ -93,2 +95,5 @@ if (value.length <= 10) { | ||
} | ||
else if (dateTimeFormat === 'Unix time milliseconds as integer') { | ||
result = new Date(value); | ||
} | ||
else { | ||
@@ -100,2 +105,5 @@ // Try to automatically detect if it is a jualian or a unix time | ||
} | ||
else if (this.uxepectedUnixDateTimeAreMilliseconds) { | ||
result = new Date(value); | ||
} | ||
else { | ||
@@ -152,2 +160,3 @@ result = new Date(value * 1000); | ||
case 'Unix time seconds as integer': | ||
case 'Unix time milliseconds as integer': | ||
if (containsDate(value)) { | ||
@@ -186,45 +195,28 @@ if (this.treatUxepectedStringDateTimeAsUTC) { | ||
else if (typeof value === 'number') { | ||
switch (dateTimeFormat) { | ||
case 'Julian day as real number': | ||
result = new Date(julianToMilliseconds(value + 2440587.5 /* 1970-01-01 */)); | ||
break; | ||
case 'Unix time seconds as integer': | ||
result = new Date(value * 1000); | ||
break; | ||
case 'localdate as text': | ||
case 'localdate as text using T separator': | ||
// Try to automatically detect if it is a jualian or a unix time | ||
// If it have decimal, it will be considered julian, otherwise unix time | ||
if (this.treatUnexpectedIntegerDateTimeAsJulian || !Number.isInteger(value)) { | ||
if (value >= -1 && value <= 1) { | ||
result = new Date(julianToMilliseconds(value + 2440587.5 /* 1970-01-01 */)); | ||
} | ||
else { | ||
result = new Date(julianToMilliseconds(value)); | ||
} | ||
if (dateTimeFormat === 'Julian day as real number') { | ||
result = new Date(julianToMilliseconds(value + 2440587.5 /* 1970-01-01 */)); | ||
} | ||
else if (dateTimeFormat === 'Unix time seconds as integer') { | ||
result = new Date(value * 1000); | ||
} | ||
else if (dateTimeFormat === 'Unix time milliseconds as integer') { | ||
result = new Date(value); | ||
} | ||
else { | ||
// Try to automatically detect if it is a jualian or a unix time | ||
// If it have decimal, it will be considered julian, otherwise unix time | ||
if (this.treatUnexpectedIntegerDateTimeAsJulian || !Number.isInteger(value)) { | ||
if (value >= -1 && value <= 1) { | ||
result = new Date(julianToMilliseconds(value + 2440587.5 /* 1970-01-01 */)); | ||
} | ||
else { | ||
result = new Date(value * 1000); | ||
result = new Date(julianToMilliseconds(value)); | ||
} | ||
break; | ||
case 'UTC as text': | ||
case 'UTC as text using T separator': | ||
case 'UTC as text using Z timezone': | ||
case 'UTC as text using T separator and Z timezone': | ||
// Try to automatically detect if it is a jualian or a unix time | ||
// If it have decimal, it will be considered julian, otherwise unix time | ||
if (this.treatUnexpectedIntegerDateTimeAsJulian || !Number.isInteger(value)) { | ||
if (value >= -1 && value <= 1) { | ||
result = new Date(julianToMilliseconds(value + 2440587.5 /* 1970-01-01 */)); | ||
} | ||
else { | ||
result = new Date(julianToMilliseconds(value)); | ||
} | ||
} | ||
else { | ||
result = new Date(value * 1000); | ||
} | ||
break; | ||
default: | ||
throw new Error('Invalid sqlite date time format: ' + dateTimeFormat); | ||
} | ||
else if (this.uxepectedUnixDateTimeAreMilliseconds) { | ||
result = new Date(value); | ||
} | ||
else { | ||
result = new Date(value * 1000); | ||
} | ||
} | ||
@@ -284,26 +276,23 @@ } | ||
else if (typeof value === 'number') { | ||
switch (dateTimeFormat) { | ||
case 'Julian day as real number': | ||
if (dateTimeFormat === 'Julian day as real number') { | ||
result = new Date(julianToMilliseconds(value)); // Timezone is not compesated due down time is overwrited | ||
} | ||
else if (dateTimeFormat === 'Unix time seconds as integer') { | ||
result = new Date(value * 1000); | ||
} | ||
else if (dateTimeFormat === 'Unix time milliseconds as integer') { | ||
result = new Date(value); | ||
} | ||
else { | ||
// Try to automatically detect if it is a jualian or a unix time | ||
// If it have decimal, it will be considered julian, otherwise unix time | ||
if (this.treatUnexpectedIntegerDateTimeAsJulian || !Number.isInteger(value)) { | ||
result = new Date(julianToMilliseconds(value)); | ||
break; | ||
case 'Unix time seconds as integer': | ||
} | ||
else if (this.uxepectedUnixDateTimeAreMilliseconds) { | ||
result = new Date(value); | ||
} | ||
else { | ||
result = new Date(value * 1000); | ||
break; | ||
case 'localdate as text': | ||
case 'localdate as text using T separator': | ||
case 'UTC as text': | ||
case 'UTC as text using T separator': | ||
case 'UTC as text using Z timezone': | ||
case 'UTC as text using T separator and Z timezone': | ||
// Try to automatically detect if it is a jualian or a unix time | ||
// If it have decimal, it will be considered julian, otherwise unix time | ||
if (this.treatUnexpectedIntegerDateTimeAsJulian || !Number.isInteger(value)) { | ||
result = new Date(julianToMilliseconds(value)); | ||
} | ||
else { | ||
result = new Date(value * 1000); | ||
} | ||
break; | ||
default: | ||
throw new Error('Invalid sqlite date time format: ' + dateTimeFormat); | ||
} | ||
} | ||
@@ -343,2 +332,4 @@ } | ||
return Math.trunc(Date.UTC(value.getFullYear(), value.getMonth(), value.getDate()) / 1000); | ||
case 'Unix time milliseconds as integer': | ||
return Date.UTC(value.getFullYear(), value.getMonth(), value.getDate()); | ||
default: | ||
@@ -366,2 +357,4 @@ throw new Error('Invalid sqlite date time format: ' + dateTimeFormat); | ||
return Math.trunc(Date.UTC(1970, 0, 1, value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds()) / 1000); | ||
case 'Unix time milliseconds as integer': | ||
return Date.UTC(1970, 0, 1, value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds()); | ||
default: | ||
@@ -398,2 +391,4 @@ throw new Error('Invalid sqlite date time format: ' + dateTimeFormat); | ||
return Math.trunc(value.getTime() / 1000); | ||
case 'Unix time milliseconds as integer': | ||
return value.getTime(); | ||
default: | ||
@@ -400,0 +395,0 @@ throw new Error('Invalid sqlite date time format: ' + dateTimeFormat); |
@@ -1,2 +0,2 @@ | ||
export declare type SqliteDateTimeFormat = 'localdate as text' | 'localdate as text using T separator' | 'UTC as text' | 'UTC as text using T separator' | 'UTC as text using Z timezone' | 'UTC as text using T separator and Z timezone' | 'Julian day as real number' | 'Unix time seconds as integer'; | ||
export declare type SqliteDateTimeFormat = 'localdate as text' | 'localdate as text using T separator' | 'UTC as text' | 'UTC as text using T separator' | 'UTC as text using Z timezone' | 'UTC as text using T separator and Z timezone' | 'Julian day as real number' | 'Unix time seconds as integer' | 'Unix time milliseconds as integer'; | ||
export declare type SqliteDateTimeFormatType = 'date' | 'time' | 'dateTime'; |
{ | ||
"name": "ts-sql-query", | ||
"version": "1.16.0", | ||
"version": "1.17.0", | ||
"description": "Type-safe SQL query builder like QueryDSL or JOOQ in Java or Linq in .Net for TypeScript with MariaDB, MySql, Oracle, PostgreSql, Sqlite and SqlServer support.", | ||
@@ -38,2 +38,3 @@ "license": "MIT", | ||
"all-examples": "sh ./scripts/run-all-examples.sh", | ||
"coverage": "nyc sh ./scripts/run-all-examples.sh", | ||
"build": "rm -rf dist/*; tsc && npm run copy-prisma", | ||
@@ -82,2 +83,3 @@ "dist": "npm run build && cp LICENSE.md package.json README.md dist && cd dist && rm exampleTests* && rm -Rf examples && npm publish", | ||
"mysql2": "^2.2.5", | ||
"nyc": "^15.1.0", | ||
"oracledb": "^5.1.0", | ||
@@ -96,3 +98,14 @@ "pg": "^8.5.1", | ||
"ts-extended-types": "^1.0.0" | ||
}, | ||
"nyc": { | ||
"exclude": [ | ||
"src/examples/**" | ||
], | ||
"reporter": [ | ||
"html" | ||
], | ||
"include": [ | ||
"src/**" | ||
] | ||
} | ||
} |
@@ -271,4 +271,12 @@ "use strict"; | ||
addOutParam(params, name) { | ||
if (this.database !== 'oracle') { | ||
throw new Error('Unsupported output parameters'); | ||
} | ||
const index = params.length; | ||
params.push({ out_param_with_name: name }); | ||
if (name) { | ||
params.push({ dir: 3003 /*oracledb.BIND_OUT*/, as: name }); // See https://github.com/oracle/node-oracledb/blob/master/lib/oracledb.js | ||
} | ||
else { | ||
params.push({ dir: 3003 /*oracledb.BIND_OUT*/ }); // See https://github.com/oracle/node-oracledb/blob/master/lib/oracledb.js | ||
} | ||
return ':' + index; | ||
@@ -275,0 +283,0 @@ } |
@@ -176,2 +176,4 @@ "use strict"; | ||
return "cast(strftime('%s', date('now')) as integer)"; | ||
case 'Unix time milliseconds as integer': | ||
return "(cast(strftime('%s', date('now')) as integer) * 1000)"; | ||
default: | ||
@@ -194,5 +196,7 @@ throw new Error('Invalid sqlite date time format: ' + dateTimeFormat); | ||
case 'Julian day as real number': | ||
return "(julianday('2000-01-01 ' || time('now')) - julianday('2000-01-01'))"; | ||
return "(julianday(strftime('1970-01-01 %H:%M:%f', 'now')) - julianday('1970-01-01'))"; | ||
case 'Unix time seconds as integer': | ||
return "cast(strftime('%s', '1970-01-01 ' || time('now')) as integer)"; | ||
return "cast(strftime('%s', strftime('1970-01-01 %H:%M:%S', 'now')) as integer)"; | ||
case 'Unix time milliseconds as integer': | ||
return "cast((julianday(strftime('1970-01-01 %H:%M:%f', 'now')) - 2440587.5) * 86400000.0 as integer)"; | ||
default: | ||
@@ -221,2 +225,4 @@ throw new Error('Invalid sqlite date time format: ' + dateTimeFormat); | ||
return "cast(strftime('%s', 'now') as integer)"; | ||
case 'Unix time milliseconds as integer': | ||
return "cast((julianday('now') - 2440587.5) * 86400000.0 as integer)"; | ||
default: | ||
@@ -254,2 +260,5 @@ throw new Error('Invalid sqlite date time format: ' + dateTimeFormat); | ||
} | ||
else if (this._getValueSourceDateTimeFormat(valueSource) === 'Unix time milliseconds as integer') { | ||
return "cast(strftime('%d', " + this._appendSqlParenthesis(valueSource, params) + " / 1000, 'unixepoch') as integer)"; | ||
} | ||
return "cast(strftime('%d', " + this._appendSql(valueSource, params) + ") as integer)"; | ||
@@ -259,4 +268,7 @@ } | ||
if (this._getValueSourceDateTimeFormat(valueSource) === 'Unix time seconds as integer') { | ||
return "round((julianday(" + this._appendSql(valueSource, params) + ", 'unixepoch') - 2440587.5) * 86400000.0)"; | ||
return '(' + this._appendSql(valueSource, params) + ' * 1000)'; | ||
} | ||
else if (this._getValueSourceDateTimeFormat(valueSource) === 'Unix time milliseconds as integer') { | ||
return this._appendSql(valueSource, params); | ||
} | ||
return "round((julianday(" + this._appendSql(valueSource, params) + ") - 2440587.5) * 86400000.0)"; | ||
@@ -268,2 +280,5 @@ } | ||
} | ||
else if (this._getValueSourceDateTimeFormat(valueSource) === 'Unix time milliseconds as integer') { | ||
return "cast(strftime('%Y', " + this._appendSqlParenthesis(valueSource, params) + " / 1000, 'unixepoch') as integer)"; | ||
} | ||
return "cast(strftime('%Y', " + this._appendSql(valueSource, params) + ") as integer)"; | ||
@@ -275,2 +290,5 @@ } | ||
} | ||
else if (this._getValueSourceDateTimeFormat(valueSource) === 'Unix time milliseconds as integer') { | ||
return "cast(strftime('%m', " + this._appendSqlParenthesis(valueSource, params) + " / 1000, 'unixepoch') as integer)"; | ||
} | ||
return "cast(strftime('%m', " + this._appendSql(valueSource, params) + ") as integer)"; | ||
@@ -282,2 +300,5 @@ } | ||
} | ||
else if (this._getValueSourceDateTimeFormat(valueSource) === 'Unix time milliseconds as integer') { | ||
return "cast(strftime('%w'," + this._appendSqlParenthesis(valueSource, params) + " / 1000, 'unixepoch') as integer)"; | ||
} | ||
return "cast(strftime('%w'," + this._appendSql(valueSource, params) + ") as integer)"; | ||
@@ -289,2 +310,5 @@ } | ||
} | ||
else if (this._getValueSourceDateTimeFormat(valueSource) === 'Unix time milliseconds as integer') { | ||
return "cast(strftime('%H', " + this._appendSqlParenthesis(valueSource, params) + " / 1000, 'unixepoch') as integer)"; | ||
} | ||
return "cast(strftime('%H', " + this._appendSql(valueSource, params) + ") as integer)"; | ||
@@ -296,2 +320,5 @@ } | ||
} | ||
else if (this._getValueSourceDateTimeFormat(valueSource) === 'Unix time milliseconds as integer') { | ||
return "cast(strftime('%M', " + this._appendSqlParenthesis(valueSource, params) + " / 1000, 'unixepoch') as integer)"; | ||
} | ||
return "cast(strftime('%M', " + this._appendSql(valueSource, params) + ") as integer)"; | ||
@@ -303,2 +330,5 @@ } | ||
} | ||
else if (this._getValueSourceDateTimeFormat(valueSource) === 'Unix time milliseconds as integer') { | ||
return "cast(strftime('%S', " + this._appendSqlParenthesis(valueSource, params) + " / 1000, 'unixepoch') as integer)"; | ||
} | ||
return "cast(strftime('%S', " + this._appendSql(valueSource, params) + ") as integer)"; | ||
@@ -308,4 +338,7 @@ } | ||
if (this._getValueSourceDateTimeFormat(valueSource) === 'Unix time seconds as integer') { | ||
return "(strftime('%f', " + this._appendSql(valueSource, params) + ", 'unixepoch') * 1000 % 1000)"; | ||
return '0'; | ||
} | ||
else if (this._getValueSourceDateTimeFormat(valueSource) === 'Unix time milliseconds as integer') { | ||
return '(' + this._appendSqlParenthesis(valueSource, params) + ' % 1000)'; | ||
} | ||
return "(strftime('%f', " + this._appendSql(valueSource, params) + ") * 1000 % 1000)"; | ||
@@ -312,0 +345,0 @@ } |
@@ -10,1 +10,3 @@ export declare type PromiseProvider = PromiseConstructorLike & { | ||
}; | ||
export declare function isPromise(value: any): value is Promise<unknown>; | ||
export declare function callDeferredFunctions<T>(name: string, fns: Array<() => void | Promise<void>> | undefined, result: T, source: Error, transactionError?: Error, throwError?: Error): T | Promise<T>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.callDeferredFunctions = exports.isPromise = void 0; | ||
const chained_error_1 = require("chained-error"); | ||
const attachSource_1 = require("./attachSource"); | ||
function isPromise(value) { | ||
return value && (typeof value === 'object') && (typeof value.then === 'function'); | ||
} | ||
exports.isPromise = isPromise; | ||
function callDeferredFunctions(name, fns, result, source, transactionError, throwError) { | ||
if (!fns) { | ||
if (throwError) { | ||
throw throwError; | ||
} | ||
return result; | ||
} | ||
try { | ||
let promise; | ||
for (let i = 0, length = fns.length; i < length; i++) { | ||
if (!promise) { | ||
const fnResult = fns[i](); | ||
if (isPromise(fnResult)) { | ||
promise = fnResult; | ||
} | ||
} | ||
else { | ||
const fn = fns[i]; | ||
promise = promise.then(callDeferredFunctionAsThen.bind(undefined, fn)); | ||
} | ||
} | ||
if (promise) { | ||
return promise.then(() => { | ||
if (throwError) { | ||
throw throwError; | ||
} | ||
return result; | ||
}, (e) => { | ||
const newError = (0, attachSource_1.attachTransactionSource)(new chained_error_1.default('Error executing ' + name + ' functions', e), source); | ||
if (transactionError) { | ||
(0, attachSource_1.attachTransactionError)(newError, transactionError); | ||
} | ||
throw newError; | ||
}); | ||
} | ||
if (throwError) { | ||
throw throwError; | ||
} | ||
return result; | ||
} | ||
catch (e) { | ||
const newError = (0, attachSource_1.attachTransactionSource)(new chained_error_1.default('Error executing ' + name + ' functions', e), source); | ||
if (transactionError) { | ||
(0, attachSource_1.attachTransactionError)(newError, transactionError); | ||
} | ||
throw newError; | ||
} | ||
} | ||
exports.callDeferredFunctions = callDeferredFunctions; | ||
function callDeferredFunctionAsThen(fn) { | ||
const fnResult = fn(); | ||
if (isPromise(fnResult)) { | ||
return fnResult; | ||
} | ||
} |
1349402
23154
38