"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.executeScriptFunction = exports.ScriptFunction = exports.AsyncFunction = exports.BASE_ARGS = exports.BASE_ARGS_NAME = void 0;
const DateUtils_1 = require("./DateUtils");
const ObjectUtils_1 = require("./ObjectUtils");
const StringUtils_1 = require("./StringUtils");
const UUIDUtils_1 = require("./UUIDUtils");
exports.BASE_ARGS_NAME = [
    'uuid',
    'is_blank',
    'not_blank',
    'is_empty',
    'not_empty',
    'is_null',
    'not_null',
    'ifnull',
    'dayjs',
    'now',
    'current_timestamp_millis',
    'current_timestamp',
];
exports.BASE_ARGS = [
    UUIDUtils_1.randomUUID,
    StringUtils_1.isBlank,
    StringUtils_1.isNotBlank,
    StringUtils_1.isEmpty,
    StringUtils_1.isNotEmpty,
    ObjectUtils_1.isNull,
    ObjectUtils_1.isNotNull,
    ObjectUtils_1.ifNull,
    require('dayjs'),
    DateUtils_1.now,
    DateUtils_1.currentTimestampMillis,
    DateUtils_1.currentTimestamp,
];
/**
 * 动态异步方法
 */
exports.AsyncFunction = Object.getPrototypeOf(async () => { }).constructor;
/**
 * 动态Script异步方法
 * @param script
 * @param args
 * @param params
 * @return {*}
 * @constructor
 */
const ScriptFunction = (script, args = []) => {
    return new exports.AsyncFunction('require', ...exports.BASE_ARGS_NAME, ...args, script);
};
exports.ScriptFunction = ScriptFunction;
/**
 * 执行scriptFunction
 * @param scriptFunction
 * @param args
 */
const executeScriptFunction = async (scriptFunction, ...args) => {
    return await scriptFunction(require, ...exports.BASE_ARGS, ...args);
};
exports.executeScriptFunction = executeScriptFunction;
//# sourceMappingURL=FunctionUtils.js.map