mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-18 17:33:31 +00:00
add luci-app-jd-dailybonus from jerrykuku
This commit is contained in:
parent
332fe57a37
commit
3ac7bea729
72
package/lean/luci-app-jd-dailybonus/Makefile
Normal file
72
package/lean/luci-app-jd-dailybonus/Makefile
Normal file
@ -0,0 +1,72 @@
|
||||
#
|
||||
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||
#
|
||||
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=luci-app-jd-dailybonus
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_VERSION:=0.8.9
|
||||
PKG_RELEASE:=20201230
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/luci-app-jd-dailybonus
|
||||
SECTION:=luci
|
||||
CATEGORY:=LuCI
|
||||
SUBMENU:=3. Applications
|
||||
TITLE:=Luci for JD dailybonus Script
|
||||
PKGARCH:=all
|
||||
DEPENDS:=+node +wget
|
||||
endef
|
||||
|
||||
define Build/Prepare
|
||||
endef
|
||||
|
||||
define Build/Compile
|
||||
endef
|
||||
|
||||
define Package/$(PKG_NAME)/conffiles
|
||||
/etc/config/jd-dailybonus
|
||||
endef
|
||||
|
||||
define Package/luci-app-jd-dailybonus/install
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./root/etc/config/jd-dailybonus $(1)/etc/config/jd-dailybonus
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./root/etc/init.d/* $(1)/etc/init.d/
|
||||
|
||||
$(INSTALL_DIR) $(1)/etc/uci-defaults
|
||||
$(INSTALL_BIN) ./root/etc/uci-defaults/* $(1)/etc/uci-defaults/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/jd-dailybonus
|
||||
$(INSTALL_BIN) ./root/usr/share/jd-dailybonus/*.sh $(1)/usr/share/jd-dailybonus/
|
||||
$(INSTALL_DATA) ./root/usr/share/jd-dailybonus/*.js $(1)/usr/share/jd-dailybonus/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||
$(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/* $(1)/usr/share/rpcd/acl.d
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/node
|
||||
cp -pR ./root/usr/lib/node/* $(1)/usr/lib/node
|
||||
|
||||
$(INSTALL_DIR) $(1)/www/jd-dailybonus
|
||||
$(INSTALL_DATA) ./root//www/jd-dailybonus/* $(1)/www/jd-dailybonus
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller
|
||||
$(INSTALL_DATA) ./luasrc/controller/* $(1)/usr/lib/lua/luci/controller/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/jd-dailybonus
|
||||
$(INSTALL_DATA) ./luasrc/model/cbi/jd-dailybonus/* $(1)/usr/lib/lua/luci/model/cbi/jd-dailybonus/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/jd-dailybonus
|
||||
$(INSTALL_DATA) ./luasrc/view/jd-dailybonus/* $(1)/usr/lib/lua/luci/view/jd-dailybonus/
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n
|
||||
po2lmo ./po/zh-cn/jd-dailybonus.po $(1)/usr/lib/lua/luci/i18n/jd-dailybonus.zh-cn.lmo
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,luci-app-jd-dailybonus))
|
||||
|
||||
# call BuildPackage - OpenWrt buildroot signature
|
@ -0,0 +1,82 @@
|
||||
-- Copyright (C) 2020 jerrykuku <jerrykuku@gmail.com>
|
||||
-- Licensed to the public under the GNU General Public License v3.
|
||||
module("luci.controller.jd-dailybonus", package.seeall)
|
||||
function index()
|
||||
if not nixio.fs.access("/etc/config/jd-dailybonus") then
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "jd-dailybonus"}, alias("admin", "services", "jd-dailybonus", "client"), _("JD-DailyBonus"), 10).dependent = true -- 首页
|
||||
entry({"admin", "services", "jd-dailybonus", "client"}, cbi("jd-dailybonus/client"),_("Client"), 10).leaf = true -- 基本设置
|
||||
entry({"admin", "services", "jd-dailybonus", "log"},form("jd-dailybonus/log"),_("Log"), 30).leaf = true -- 日志页面
|
||||
entry({"admin", "services", "jd-dailybonus", "script"},form("jd-dailybonus/script"),_("Script"), 20).leaf = true -- 直接配置脚本
|
||||
entry({"admin", "services", "jd-dailybonus", "run"}, call("run")) -- 执行程序
|
||||
entry({"admin", "services", "jd-dailybonus", "update"}, call("update")) -- 执行更新
|
||||
entry({"admin", "services", "jd-dailybonus", "check_update"}, call("check_update")) -- 检查更新
|
||||
end
|
||||
|
||||
|
||||
-- 执行程序
|
||||
|
||||
function run()
|
||||
local e = {}
|
||||
local uci = luci.model.uci.cursor()
|
||||
local cookie = luci.http.formvalue("cookies")
|
||||
local cookie2 = luci.http.formvalue("cookies2")
|
||||
local auto_update = luci.http.formvalue("auto_update")
|
||||
local auto_update_time = luci.http.formvalue("auto_update_time")
|
||||
local auto_run = luci.http.formvalue("auto_run")
|
||||
local auto_run_time = luci.http.formvalue("auto_run_time")
|
||||
local stop = luci.http.formvalue("stop")
|
||||
local serverchan = luci.http.formvalue("serverchan")
|
||||
local failed = luci.http.formvalue("failed")
|
||||
local name = ""
|
||||
uci:foreach("vssr", "global", function(s) name = s[".name"] end)
|
||||
|
||||
if cookie ~= " " then
|
||||
uci:set("jd-dailybonus", '@global[0]', 'auto_update', auto_update)
|
||||
uci:set("jd-dailybonus", '@global[0]', 'auto_update_time', auto_update_time)
|
||||
uci:set("jd-dailybonus", '@global[0]', 'auto_run', auto_run)
|
||||
uci:set("jd-dailybonus", '@global[0]', 'auto_run_time', auto_run_time)
|
||||
uci:set("jd-dailybonus", '@global[0]', 'stop', stop)
|
||||
uci:set("jd-dailybonus", '@global[0]', 'cookie', cookie)
|
||||
uci:set("jd-dailybonus", '@global[0]', 'cookie2', cookie2)
|
||||
uci:set("jd-dailybonus", '@global[0]', 'serverchan', serverchan)
|
||||
uci:set("jd-dailybonus", '@global[0]', 'failed', failed)
|
||||
uci:save("jd-dailybonus")
|
||||
uci:commit("jd-dailybonus")
|
||||
luci.sys.call("/usr/share/jd-dailybonus/newapp.sh -r")
|
||||
luci.sys.call("/usr/share/jd-dailybonus/newapp.sh -a")
|
||||
e.error = 0
|
||||
else
|
||||
e.error = 1
|
||||
end
|
||||
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
|
||||
end
|
||||
|
||||
--检查更新
|
||||
function check_update()
|
||||
local jd = "jd-dailybonus"
|
||||
local e = {}
|
||||
local new_version = luci.sys.exec("/usr/share/jd-dailybonus/newapp.sh -n")
|
||||
e.new_version = new_version
|
||||
e.error = 0
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
||||
|
||||
--执行更新
|
||||
function update()
|
||||
local jd = "jd-dailybonus"
|
||||
local e = {}
|
||||
local uci = luci.model.uci.cursor()
|
||||
local version = luci.http.formvalue("version")
|
||||
--下载脚本
|
||||
local code = luci.sys.exec("/usr/share/jd-dailybonus/newapp.sh -u")
|
||||
e.error = code
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json(e)
|
||||
end
|
@ -0,0 +1,75 @@
|
||||
local jd = "jd-dailybonus"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local sys = require "luci.sys"
|
||||
|
||||
m = Map(jd)
|
||||
-- [[ 基本设置 ]]--
|
||||
|
||||
s = m:section(TypedSection, "global",
|
||||
translate("Base Config"))
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(DummyValue, "", "")
|
||||
o.rawhtml = true
|
||||
o.template = "jd-dailybonus/cookie_tools"
|
||||
|
||||
o = s:option(ListValue, "remote_url", translate("Source Update Url"))
|
||||
o:value("https://cdn.jsdelivr.net/gh/NobyDa/Script/JD-DailyBonus/JD_DailyBonus.js", translate("GitHub"))
|
||||
o:value("https://gitee.com/jerrykuku/staff/raw/master/JD_DailyBonus.js", translate("Gitee"))
|
||||
o.default = "nil"
|
||||
o.rmempty = false
|
||||
o.description = translate('当GitHub源无法更新时,可以选择使用国内Gitee源')
|
||||
|
||||
o = s:option(Value, "cookie", translate("First Cookie"))
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "cookie2", translate("Second Cookie"))
|
||||
o.rmempty = true
|
||||
o.description = translate('双账号用户抓取"账号1"Cookie后, 请勿点击退出账号(可能会导致Cookie失效), 需清除浏览器资料或更换浏览器登录"账号2"抓取.')
|
||||
|
||||
o = s:option(Value, "stop", translate("Execute Delay"))
|
||||
o.rmempty = false
|
||||
o.default = 0
|
||||
o.datatype = integer
|
||||
o.description = translate("自定义延迟签到,单位毫秒. 默认分批并发无延迟. (延迟作用于每个签到接口, 如填入延迟则切换顺序签到. ) ")
|
||||
|
||||
o = s:option(ListValue, "serverurl", translate("ServerURL"))
|
||||
o:value("scu", translate("SCU"))
|
||||
o:value("sct", translate("SCT"))
|
||||
o.default = "scu"
|
||||
o.rmempty = false
|
||||
o.description = translate('选择Server酱的推送接口')
|
||||
|
||||
o = s:option(Value, "serverchan", translate("ServerChan SCKEY"))
|
||||
o.rmempty = true
|
||||
o.description = translate("微信推送,基于Server酱服务,请自行登录 http://sc.ftqq.com/ 绑定并获取 SCKEY (仅在自动签到时推送)")
|
||||
|
||||
o = s:option(Flag, "failed", translate("Failed Push"))
|
||||
o.rmempty = false
|
||||
o.description = translate("仅当cookie失效时推送")
|
||||
|
||||
o = s:option(Flag, "auto_update", translate("Auto Update"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Auto Update Script Service")
|
||||
|
||||
o =s:option(ListValue, "auto_update_time", translate("Update time (every day)"))
|
||||
for t = 0, 23 do o:value(t, t .. ":01") end
|
||||
o.default = 1
|
||||
o.rmempty = true
|
||||
o:depends("auto_update", "1")
|
||||
|
||||
o = s:option(Flag, "auto_run", translate("Auto Run"))
|
||||
o.rmempty = false
|
||||
o.description = translate("Auto Run Script Service")
|
||||
|
||||
o =s:option(ListValue, "auto_run_time", translate("Run time (every day)"))
|
||||
for t = 0, 23 do o:value(t, t .. ":05") end
|
||||
o.default = 1
|
||||
o.rmempty = true
|
||||
o:depends("auto_run", "1")
|
||||
|
||||
o = s:option(DummyValue, "", "")
|
||||
o.rawhtml = true
|
||||
o.version = sys.exec('uci get jd-dailybonus.@global[0].version')
|
||||
o.template = "jd-dailybonus/update_service"
|
||||
return m
|
@ -0,0 +1,18 @@
|
||||
local fs = require "nixio.fs"
|
||||
local jd = "jd-dailybonus"
|
||||
local conffile = "/www/JD_DailyBonus.htm"
|
||||
|
||||
log = SimpleForm("logview")
|
||||
log.submit = false
|
||||
log.reset = false
|
||||
|
||||
-- [[ 日志显示 ]]--
|
||||
t = log:field(TextValue, "1", nil)
|
||||
t.rmempty = true
|
||||
t.rows = 30
|
||||
function t.cfgvalue()
|
||||
return fs.readfile(conffile) or ""
|
||||
end
|
||||
t.readonly="readonly"
|
||||
|
||||
return log
|
@ -0,0 +1,23 @@
|
||||
local fs = require "nixio.fs"
|
||||
local jd = "jd-dailybonus"
|
||||
|
||||
s = SimpleForm("scriptview")
|
||||
|
||||
view_cfg = s:field(TextValue, "conf")
|
||||
view_cfg.rmempty = false
|
||||
view_cfg.rows = 43
|
||||
|
||||
function sync_value_to_file(value, file)
|
||||
value = value:gsub("\r\n?", "\n")
|
||||
local old_value = fs.readfile(file)
|
||||
if value ~= old_value then fs.writefile(file, value) end
|
||||
end
|
||||
|
||||
function view_cfg.cfgvalue()
|
||||
return fs.readfile("/usr/share/jd-dailybonus/JD_DailyBonus.js") or ""
|
||||
end
|
||||
function view_cfg.write(self, section, value)
|
||||
sync_value_to_file(value, "/usr/share/jd-dailybonus/JD_DailyBonus.js")
|
||||
end
|
||||
|
||||
return s
|
@ -0,0 +1,26 @@
|
||||
<%+cbi/valueheader%>
|
||||
|
||||
<label class="cbi-value-title"><%= translate("Cookie Tools") %></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="button" class="cbi-button cbi-input-reload" value="<%= translate('JDCookie Tools') %>" onclick="javascript:window.open('/jd-dailybonus/JDCookie.zip','target');" />
|
||||
<br>
|
||||
<div class="cbi-value-description">
|
||||
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="帮助"></span>
|
||||
<%= translate("Click to download the JDCookie.zip,unzip it,and use load Unpacked extensions to install.link:[chrome://extensions/]")%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%+cbi/valuefooter%>
|
||||
<%+cbi/valueheader%>
|
||||
|
||||
<label class="cbi-value-title"><%= translate("JD Url") %></label>
|
||||
<div class="cbi-value-field">
|
||||
<input type="button" class="cbi-button cbi-input-reload" value="bean.m.jd.com" onclick="javascript:window.open('https://bean.m.jd.com','target');" />
|
||||
<br>
|
||||
<div class="cbi-value-description">
|
||||
<span class="cbi-value-helpicon"><img src="/luci-static/resources/cbi/help.gif" alt="帮助"></span>
|
||||
<%= translate("Sign in ,then click JDCookie button.you will copy JD cookies, paste the cookie below.")%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%+cbi/valuefooter%>
|
@ -0,0 +1,301 @@
|
||||
<%+cbi/valueheader%>
|
||||
<script src="/jd-dailybonus/jquery.min.js"></script>
|
||||
<style>
|
||||
.modals-bg {
|
||||
position: fixed;
|
||||
z-index: 999;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
display: none;
|
||||
}
|
||||
|
||||
.modals {
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
width: 60%;
|
||||
height: 500px;
|
||||
background: #172b4d;
|
||||
left: 20%;
|
||||
top: 15%;
|
||||
color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
/* Firefox */
|
||||
-webkit-box-sizing: border-box;
|
||||
/* Safari */
|
||||
}
|
||||
|
||||
.modals h2 {
|
||||
color: #fff;
|
||||
background: transparent;
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.modals h3 {
|
||||
font-size: 14px;
|
||||
color: #f5365c !important;
|
||||
background: transparent;
|
||||
margin: 0 0 1em 0;
|
||||
padding: 0 0 0.5em 0;
|
||||
}
|
||||
|
||||
#log_content3 {
|
||||
border: 0;
|
||||
width: 99%;
|
||||
height: calc(100% - 4rem);
|
||||
font-family: 'Lucida Console';
|
||||
font-size: 11px;
|
||||
background: transparent;
|
||||
color: #FFFFFF;
|
||||
outline: none;
|
||||
padding-left: 3px;
|
||||
padding-right: 22px;
|
||||
overflow: hidden
|
||||
}
|
||||
|
||||
.cbi-value-version {
|
||||
word-wrap: break-word;
|
||||
font-size: 0.875rem;
|
||||
line-height: 1.6;
|
||||
color: #5e72e4;
|
||||
font-weight: bold;
|
||||
padding: .7rem;
|
||||
padding-left: 0;
|
||||
width: 23rem;
|
||||
float: left;
|
||||
text-align: left;
|
||||
display: table-cell;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
.modals {
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
width: 80%;
|
||||
height: 500px;
|
||||
background: #172b4d;
|
||||
left: 10%;
|
||||
top: 15%;
|
||||
color: #fff;
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 700px) {
|
||||
.modals-bg {
|
||||
position: fixed;
|
||||
z-index: 100000;
|
||||
|
||||
}
|
||||
|
||||
.modals {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
<label class="cbi-value-title"><%= translate("Run") %></label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-button cbi-button-reload" id="update_service" type="button" size="0"
|
||||
value="<%= translate("Save Cookies And Run Service") %>">
|
||||
</div>
|
||||
|
||||
<%+cbi/valuefooter%>
|
||||
<%+cbi/valueheader%>
|
||||
<label class="cbi-value-title"><%= translate("Current Script Version") %></label>
|
||||
<div class="cbi-value-field">
|
||||
<div class="cbi-value-version">
|
||||
v<%=self.version%>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<%+cbi/valuefooter%>
|
||||
|
||||
<%+cbi/valueheader%>
|
||||
<label class="cbi-value-title"><%= translate("Update Script") %></label>
|
||||
<div class="cbi-value-field">
|
||||
<input class="cbi-button cbi-button-reload" id="update_script" type="button" size="0"
|
||||
value="<%= translate("Check Script Version") %>">
|
||||
|
||||
</div>
|
||||
<%+cbi/valuefooter%>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
const SAVE_URL = '<%=luci.dispatcher.build_url("admin", "services", "jd-dailybonus","run")%>';
|
||||
const CHECK_URL = '<%=luci.dispatcher.build_url("admin", "services", "jd-dailybonus","check_update")%>';
|
||||
const UPDATE_URL = '<%=luci.dispatcher.build_url("admin", "services", "jd-dailybonus","update")%>';
|
||||
const CHECKING_TEXT = '<%= translate("Checking the New Version ...") %>';
|
||||
const UPDATING_TEXT = '<%= translate("Updating script,please wait ...") %>';
|
||||
const NEW_VERSION = '<%= translate("Is currently the latest version") %>';
|
||||
const UPDATE_TEXT = '<%= translate("There is a new version, click to update") %>';
|
||||
|
||||
var needUpdate = false;
|
||||
var newVersion;
|
||||
var _responseLen;
|
||||
var noChange = 0;
|
||||
var modal = '<div class="modals-bg">' +
|
||||
'<div class="modals">' +
|
||||
'<h2><%:Sign in info%></h2>' +
|
||||
'<h3 style="margin-left:0;"><%:Service is running,Please do not refresh!%></h3>' +
|
||||
'<textarea cols="63" rows="28" wrap="on" readonly="readonly" id="log_content3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></textarea>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
|
||||
//显示并开始刷新订阅
|
||||
function update_service() {
|
||||
$("body").append(modal);
|
||||
$(".modals-bg").show();
|
||||
setTimeout("get_realtime_log();", 500);
|
||||
}
|
||||
//保存订阅按钮
|
||||
$("#update_service").click(function () {
|
||||
prefix_array = $("#cbi-jd-dailybonus-global .cbi-section-node").attr("id").split("-");
|
||||
prefix = prefix_array[prefix_array.length - 1];
|
||||
//console.log(prefix);
|
||||
if ($("[name='cbid.jd-dailybonus." + prefix + ".auto_update']").is(":checked")) {
|
||||
var auto_update = "1";
|
||||
var auto_update_time = $("[name='cbid.jd-dailybonus." + prefix + ".auto_update_time']").val();
|
||||
} else {
|
||||
var auto_update = "0";
|
||||
var auto_update_time = "0";
|
||||
}
|
||||
|
||||
if ($("[name='cbid.jd-dailybonus." + prefix + ".auto_run']").is(":checked")) {
|
||||
var auto_run = "1";
|
||||
var auto_run_time = $("[name='cbid.jd-dailybonus." + prefix + ".auto_run_time']").val();
|
||||
} else {
|
||||
var auto_run = "0";
|
||||
var auto_run_time = "0";
|
||||
}
|
||||
var stop = $("[name='cbid.jd-dailybonus." + prefix + ".stop']").val();
|
||||
var cookies = $("[name='cbid.jd-dailybonus." + prefix + ".cookie']").val();
|
||||
var cookies2 = $("[name='cbid.jd-dailybonus." + prefix + ".cookie2']").val();
|
||||
var failed=($("[name='cbid.jd-dailybonus." + prefix + ".failed']").is(":checked"))?"1":"0";
|
||||
var serverchan = $("[name='cbid.jd-dailybonus." + prefix + ".serverchan']").val();
|
||||
var data = {
|
||||
auto_update: auto_update,
|
||||
auto_update_time: auto_update_time,
|
||||
auto_run: auto_run,
|
||||
auto_run_time: auto_run_time,
|
||||
cookies: cookies,
|
||||
cookies2: cookies2,
|
||||
stop: stop,
|
||||
serverchan: serverchan,
|
||||
failed: failed
|
||||
}
|
||||
//console.log(data);
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: SAVE_URL,
|
||||
dataType: "json",
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.error == 0) {
|
||||
update_service();
|
||||
} else {
|
||||
alert("请填写cookies");
|
||||
}
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
//更新脚本
|
||||
$("#update_script").click(function () {
|
||||
check_version()
|
||||
return false;
|
||||
});
|
||||
|
||||
function updateS(){
|
||||
$("#update_script").attr("disabled", true);
|
||||
$("#update_script").val(UPDATING_TEXT);
|
||||
//console.log(data);
|
||||
var data = {
|
||||
version: $("#update_script").attr("data-version")
|
||||
}
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: UPDATE_URL,
|
||||
dataType: "json",
|
||||
data: data,
|
||||
success: function (d) {
|
||||
if (d.error == 0) {
|
||||
$("#update_script").val(NEW_VERSION);
|
||||
$(".cbi-value-version").text("v" + newVersion);
|
||||
} else {
|
||||
$("#update_script").attr("disabled", false);
|
||||
alert("更新错误请重试");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function get_realtime_log() {
|
||||
$.ajax({
|
||||
url: '/JD_DailyBonus.htm?v=' + parseInt(Math.random() * 100000000),
|
||||
dataType: 'html',
|
||||
error: function (xhr) {
|
||||
setTimeout("get_realtime_log();", 1000);
|
||||
},
|
||||
success: function (response) {
|
||||
var retArea = document.getElementById("log_content3");
|
||||
if (response.search(" 秒") != -1) {
|
||||
noChange++;
|
||||
}
|
||||
console.log(noChange);
|
||||
if (noChange > 10) {
|
||||
window.location.href = '<%=luci.dispatcher.build_url("admin", "services", "jd-dailybonus")%>';
|
||||
return false;
|
||||
} else {
|
||||
setTimeout("get_realtime_log();", 250);
|
||||
}
|
||||
retArea.value = response;
|
||||
retArea.scrollTop = retArea.scrollHeight;
|
||||
_responseLen = response.length;
|
||||
},
|
||||
error: function () {
|
||||
setTimeout("get_realtime_log();", 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function check_version() {
|
||||
$("#update_script").attr("disabled", true);
|
||||
$("#update_script").val(CHECKING_TEXT);
|
||||
$.ajax({
|
||||
url: CHECK_URL,
|
||||
dataType: 'json',
|
||||
error: function (xhr) {
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
if(data.new_version == 501){
|
||||
$("#update_script").attr("disabled", false);
|
||||
$("#update_script").val("无法获取新版本,请重试!");
|
||||
}else if (data.new_version > <%= self.version %>) {
|
||||
$("#update_script").attr("disabled", false);
|
||||
$("#update_script").val(UPDATE_TEXT + " v" + data.new_version);
|
||||
$("#update_script").attr("data-version", data.new_version);
|
||||
newVersion = data.new_version;
|
||||
updateS();
|
||||
} else {
|
||||
$("#update_script").val(NEW_VERSION + " v" + data.new_version);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
111
package/lean/luci-app-jd-dailybonus/po/zh-cn/jd-dailybonus.po
Normal file
111
package/lean/luci-app-jd-dailybonus/po/zh-cn/jd-dailybonus.po
Normal file
@ -0,0 +1,111 @@
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
||||
msgid "JD-DailyBonus"
|
||||
msgstr "京东签到服务"
|
||||
|
||||
msgid "Enable"
|
||||
msgstr "启用"
|
||||
|
||||
msgid "Disable"
|
||||
msgstr "停用"
|
||||
|
||||
msgid "Log"
|
||||
msgstr "日志"
|
||||
|
||||
msgid "Script"
|
||||
msgstr "脚本"
|
||||
|
||||
msgid "Base Config"
|
||||
msgstr "基本设置"
|
||||
|
||||
msgid "Cookie Tools"
|
||||
msgstr "Cookie 工具"
|
||||
|
||||
msgid "JDCookie Tools"
|
||||
msgstr "获取京东cookie扩展工具"
|
||||
|
||||
msgid "Source Update Url"
|
||||
msgstr "更新源地址"
|
||||
|
||||
msgid "First Cookie"
|
||||
msgstr "主账号Cookie"
|
||||
|
||||
msgid "Second Cookie"
|
||||
msgstr "第二账号Cookie"
|
||||
|
||||
msgid "Click to download the JDCookie.zip,unzip it,and use load Unpacked extensions to install.link:[chrome://extensions/]")"
|
||||
msgstr "点击上面的按钮安装下载JDCookie.zip(获取京东cookie扩展工具),解压后在[chrome://extensions/]中使用加载已解压的扩展程序进行安装。 "
|
||||
|
||||
msgid "JD Url"
|
||||
msgstr "京东链接"
|
||||
|
||||
msgid "Sign in ,then click JDCookie button.you will copy JD cookies, paste the cookie below."
|
||||
msgstr "登录后点击JDCookie 扩展工具复制cookie,然后粘贴到下面输入框中。(请使用F12调试工具,进入模拟手机浏览器模式)"
|
||||
|
||||
msgid "Auto Update Script Service"
|
||||
msgstr "自动更新脚本服务"
|
||||
|
||||
msgid "Update time (every day)"
|
||||
msgstr "更新时间 (每天)"
|
||||
|
||||
msgid "Update Script"
|
||||
msgstr "更新脚本"
|
||||
|
||||
msgid "Execute Delay"
|
||||
msgstr "延迟签到"
|
||||
|
||||
msgid "ServerChan SCKEY"
|
||||
msgstr "Server酱 SCKEY"
|
||||
|
||||
msgid "ServerURL"
|
||||
msgstr "Server酱的推送接口地址"
|
||||
|
||||
msgid "SCT"
|
||||
msgstr "测试版推送接口地址"
|
||||
|
||||
msgid "SCU"
|
||||
msgstr "原版推送接口地址"
|
||||
|
||||
msgid "Failed Push"
|
||||
msgstr "失效时推送"
|
||||
|
||||
msgid "Auto Run"
|
||||
msgstr "自动签到"
|
||||
|
||||
msgid "Run"
|
||||
msgstr "执行"
|
||||
|
||||
msgid "Auto Run Script Service"
|
||||
msgstr "自动签到服务"
|
||||
|
||||
msgid "Run time (every day)"
|
||||
msgstr "签到时间 (每天)"
|
||||
|
||||
msgid "Save Cookies And Run Service"
|
||||
msgstr "保存Cookie并签到"
|
||||
|
||||
msgid "Sign in info"
|
||||
msgstr "签到信息"
|
||||
|
||||
msgid "Service is running,Please do not refresh!"
|
||||
msgstr "服务正在执行中,请勿刷新!"
|
||||
|
||||
msgid "Updating script,please wait ..."
|
||||
msgstr "正在更新脚本,请稍候 ..."
|
||||
|
||||
msgid "Is currently the latest version"
|
||||
msgstr "当前已是最新版本。"
|
||||
|
||||
msgid "There is a new version, click to update"
|
||||
msgstr "有新的版本,请点击更新"
|
||||
|
||||
msgid "Checking the New Version ..."
|
||||
msgstr "正在检查是否存在新的版本 ..."
|
||||
|
||||
msgid "Check Script Version"
|
||||
msgstr "手动检查脚本更新"
|
||||
|
||||
msgid "Current Script Version"
|
||||
msgstr "当前脚本版本"
|
||||
|
@ -0,0 +1,9 @@
|
||||
config global
|
||||
option version '1.87'
|
||||
option auto_run_time '1'
|
||||
option auto_run '1'
|
||||
option auto_update_time '1'
|
||||
option auto_update '1'
|
||||
option stop '0'
|
||||
option failed '0'
|
||||
option remote_url 'https://cdn.jsdelivr.net/gh/NobyDa/Script/JD-DailyBonus/JD_DailyBonus.js'
|
31
package/lean/luci-app-jd-dailybonus/root/etc/init.d/jd-dailybonus
Executable file
31
package/lean/luci-app-jd-dailybonus/root/etc/init.d/jd-dailybonus
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
#
|
||||
# Copyright (C) 2020 Jerryk
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v3.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
USE_PROCD=1
|
||||
START=25
|
||||
|
||||
NAME=jd-dailybonus
|
||||
CRON_FILE=/etc/crontabs/root
|
||||
|
||||
|
||||
del_cron() {
|
||||
sed -i '/jd-dailybonus/d' $CRON_FILE
|
||||
/etc/init.d/cron restart
|
||||
}
|
||||
|
||||
start_service(){
|
||||
/usr/share/jd-dailybonus/newapp.sh -s
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
del_cron
|
||||
}
|
||||
|
||||
service_triggers() {
|
||||
procd_add_reload_trigger "jd-dailybonus"
|
||||
}
|
11
package/lean/luci-app-jd-dailybonus/root/etc/uci-defaults/luci-jd-dailybonus
Executable file
11
package/lean/luci-app-jd-dailybonus/root/etc/uci-defaults/luci-jd-dailybonus
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
uci -q batch <<-EOF >/dev/null
|
||||
delete ucitrack.@jd-dailybonus[-1]
|
||||
add ucitrack jd-dailybonus
|
||||
set ucitrack.@jd-dailybonus[-1].init=jd-dailybonus
|
||||
commit ucitrack
|
||||
EOF
|
||||
|
||||
rm -f /tmp/luci-indexcache
|
||||
exit 0
|
@ -0,0 +1,717 @@
|
||||
## Change Log
|
||||
|
||||
### v2.88.0 (2018/08/10)
|
||||
- [#2996](https://github.com/request/request/pull/2996) fix(uuid): import versioned uuid (@kwonoj)
|
||||
- [#2994](https://github.com/request/request/pull/2994) Update to oauth-sign 0.9.0 (@dlecocq)
|
||||
- [#2993](https://github.com/request/request/pull/2993) Fix header tests (@simov)
|
||||
- [#2904](https://github.com/request/request/pull/2904) #515, #2894 Strip port suffix from Host header if the protocol is known. (#2904) (@paambaati)
|
||||
- [#2791](https://github.com/request/request/pull/2791) Improve AWS SigV4 support. (#2791) (@vikhyat)
|
||||
- [#2977](https://github.com/request/request/pull/2977) Update test certificates (@simov)
|
||||
|
||||
### v2.87.0 (2018/05/21)
|
||||
- [#2943](https://github.com/request/request/pull/2943) Replace hawk dependency with a local implemenation (#2943) (@hueniverse)
|
||||
|
||||
### v2.86.0 (2018/05/15)
|
||||
- [#2885](https://github.com/request/request/pull/2885) Remove redundant code (for Node.js 0.9.4 and below) and dependency (@ChALkeR)
|
||||
- [#2942](https://github.com/request/request/pull/2942) Make Test GREEN Again! (@simov)
|
||||
- [#2923](https://github.com/request/request/pull/2923) Alterations for failing CI tests (@gareth-robinson)
|
||||
|
||||
### v2.85.0 (2018/03/12)
|
||||
- [#2880](https://github.com/request/request/pull/2880) Revert "Update hawk to 7.0.7 (#2880)" (@simov)
|
||||
|
||||
### v2.84.0 (2018/03/12)
|
||||
- [#2793](https://github.com/request/request/pull/2793) Fixed calculation of oauth_body_hash, issue #2792 (@dvishniakov)
|
||||
- [#2880](https://github.com/request/request/pull/2880) Update hawk to 7.0.7 (#2880) (@kornel-kedzierski)
|
||||
|
||||
### v2.83.0 (2017/09/27)
|
||||
- [#2776](https://github.com/request/request/pull/2776) Updating tough-cookie due to security fix. (#2776) (@karlnorling)
|
||||
|
||||
### v2.82.0 (2017/09/19)
|
||||
- [#2703](https://github.com/request/request/pull/2703) Add Node.js v8 to Travis CI (@ryysud)
|
||||
- [#2751](https://github.com/request/request/pull/2751) Update of hawk and qs to latest version (#2751) (@Olivier-Moreau)
|
||||
- [#2658](https://github.com/request/request/pull/2658) Fixed some text in README.md (#2658) (@Marketionist)
|
||||
- [#2635](https://github.com/request/request/pull/2635) chore(package): update aws-sign2 to version 0.7.0 (#2635) (@greenkeeperio-bot)
|
||||
- [#2641](https://github.com/request/request/pull/2641) Update README to simplify & update convenience methods (#2641) (@FredKSchott)
|
||||
- [#2541](https://github.com/request/request/pull/2541) Add convenience method for HTTP OPTIONS (#2541) (@jamesseanwright)
|
||||
- [#2605](https://github.com/request/request/pull/2605) Add promise support section to README (#2605) (@FredKSchott)
|
||||
- [#2579](https://github.com/request/request/pull/2579) refactor(lint): replace eslint with standard (#2579) (@ahmadnassri)
|
||||
- [#2598](https://github.com/request/request/pull/2598) Update codecov to version 2.0.2 🚀 (@greenkeeperio-bot)
|
||||
- [#2590](https://github.com/request/request/pull/2590) Adds test-timing keepAlive test (@nicjansma)
|
||||
- [#2589](https://github.com/request/request/pull/2589) fix tabulation on request example README.MD (@odykyi)
|
||||
- [#2594](https://github.com/request/request/pull/2594) chore(dependencies): har-validator to 5.x [removes babel dep] (@ahmadnassri)
|
||||
|
||||
### v2.81.0 (2017/03/09)
|
||||
- [#2584](https://github.com/request/request/pull/2584) Security issue: Upgrade qs to version 6.4.0 (@sergejmueller)
|
||||
- [#2578](https://github.com/request/request/pull/2578) safe-buffer doesn't zero-fill by default, its just a polyfill. (#2578) (@mikeal)
|
||||
- [#2566](https://github.com/request/request/pull/2566) Timings: Tracks 'lookup', adds 'wait' time, fixes connection re-use (#2566) (@nicjansma)
|
||||
- [#2574](https://github.com/request/request/pull/2574) Migrating to safe-buffer for improved security. (@mikeal)
|
||||
- [#2573](https://github.com/request/request/pull/2573) fixes #2572 (@ahmadnassri)
|
||||
|
||||
### v2.80.0 (2017/03/04)
|
||||
- [#2571](https://github.com/request/request/pull/2571) Correctly format the Host header for IPv6 addresses (@JamesMGreene)
|
||||
- [#2558](https://github.com/request/request/pull/2558) Update README.md example snippet (@FredKSchott)
|
||||
- [#2221](https://github.com/request/request/pull/2221) Adding a simple Response object reference in argument specification (@calamarico)
|
||||
- [#2452](https://github.com/request/request/pull/2452) Adds .timings array with DNC, TCP, request and response times (@nicjansma)
|
||||
- [#2553](https://github.com/request/request/pull/2553) add ISSUE_TEMPLATE, move PR template (@FredKSchott)
|
||||
- [#2539](https://github.com/request/request/pull/2539) Create PULL_REQUEST_TEMPLATE.md (@FredKSchott)
|
||||
- [#2524](https://github.com/request/request/pull/2524) Update caseless to version 0.12.0 🚀 (@greenkeeperio-bot)
|
||||
- [#2460](https://github.com/request/request/pull/2460) Fix wrong MIME type in example (@OwnageIsMagic)
|
||||
- [#2514](https://github.com/request/request/pull/2514) Change tags to keywords in package.json (@humphd)
|
||||
- [#2492](https://github.com/request/request/pull/2492) More lenient gzip decompression (@addaleax)
|
||||
|
||||
### v2.79.0 (2016/11/18)
|
||||
- [#2368](https://github.com/request/request/pull/2368) Fix typeof check in test-pool.js (@forivall)
|
||||
- [#2394](https://github.com/request/request/pull/2394) Use `files` in package.json (@SimenB)
|
||||
- [#2463](https://github.com/request/request/pull/2463) AWS support for session tokens for temporary credentials (@simov)
|
||||
- [#2467](https://github.com/request/request/pull/2467) Migrate to uuid (@simov, @antialias)
|
||||
- [#2459](https://github.com/request/request/pull/2459) Update taper to version 0.5.0 🚀 (@greenkeeperio-bot)
|
||||
- [#2448](https://github.com/request/request/pull/2448) Make other connect timeout test more reliable too (@mscdex)
|
||||
|
||||
### v2.78.0 (2016/11/03)
|
||||
- [#2447](https://github.com/request/request/pull/2447) Always set request timeout on keep-alive connections (@mscdex)
|
||||
|
||||
### v2.77.0 (2016/11/03)
|
||||
- [#2439](https://github.com/request/request/pull/2439) Fix socket 'connect' listener handling (@mscdex)
|
||||
- [#2442](https://github.com/request/request/pull/2442) 👻😱 Node.js 0.10 is unmaintained 😱👻 (@greenkeeperio-bot)
|
||||
- [#2435](https://github.com/request/request/pull/2435) Add followOriginalHttpMethod to redirect to original HTTP method (@kirrg001)
|
||||
- [#2414](https://github.com/request/request/pull/2414) Improve test-timeout reliability (@mscdex)
|
||||
|
||||
### v2.76.0 (2016/10/25)
|
||||
- [#2424](https://github.com/request/request/pull/2424) Handle buffers directly instead of using "bl" (@zertosh)
|
||||
- [#2415](https://github.com/request/request/pull/2415) Re-enable timeout tests on Travis + other fixes (@mscdex)
|
||||
- [#2431](https://github.com/request/request/pull/2431) Improve timeouts accuracy and node v6.8.0+ compatibility (@mscdex, @greenkeeperio-bot)
|
||||
- [#2428](https://github.com/request/request/pull/2428) Update qs to version 6.3.0 🚀 (@greenkeeperio-bot)
|
||||
- [#2420](https://github.com/request/request/pull/2420) change .on to .once, remove possible memory leaks (@duereg)
|
||||
- [#2426](https://github.com/request/request/pull/2426) Remove "isFunction" helper in favor of "typeof" check (@zertosh)
|
||||
- [#2425](https://github.com/request/request/pull/2425) Simplify "defer" helper creation (@zertosh)
|
||||
- [#2402](https://github.com/request/request/pull/2402) form-data@2.1.1 breaks build 🚨 (@greenkeeperio-bot)
|
||||
- [#2393](https://github.com/request/request/pull/2393) Update form-data to version 2.1.0 🚀 (@greenkeeperio-bot)
|
||||
|
||||
### v2.75.0 (2016/09/17)
|
||||
- [#2381](https://github.com/request/request/pull/2381) Drop support for Node 0.10 (@simov)
|
||||
- [#2377](https://github.com/request/request/pull/2377) Update form-data to version 2.0.0 🚀 (@greenkeeperio-bot)
|
||||
- [#2353](https://github.com/request/request/pull/2353) Add greenkeeper ignored packages (@simov)
|
||||
- [#2351](https://github.com/request/request/pull/2351) Update karma-tap to version 3.0.1 🚀 (@greenkeeperio-bot)
|
||||
- [#2348](https://github.com/request/request/pull/2348) form-data@1.0.1 breaks build 🚨 (@greenkeeperio-bot)
|
||||
- [#2349](https://github.com/request/request/pull/2349) Check error type instead of string (@scotttrinh)
|
||||
|
||||
### v2.74.0 (2016/07/22)
|
||||
- [#2295](https://github.com/request/request/pull/2295) Update tough-cookie to 2.3.0 (@stash-sfdc)
|
||||
- [#2280](https://github.com/request/request/pull/2280) Update karma-tap to version 2.0.1 🚀 (@greenkeeperio-bot)
|
||||
|
||||
### v2.73.0 (2016/07/09)
|
||||
- [#2240](https://github.com/request/request/pull/2240) Remove connectionErrorHandler to fix #1903 (@zarenner)
|
||||
- [#2251](https://github.com/request/request/pull/2251) tape@4.6.0 breaks build 🚨 (@greenkeeperio-bot)
|
||||
- [#2225](https://github.com/request/request/pull/2225) Update docs (@ArtskydJ)
|
||||
- [#2203](https://github.com/request/request/pull/2203) Update browserify to version 13.0.1 🚀 (@greenkeeperio-bot)
|
||||
- [#2275](https://github.com/request/request/pull/2275) Update karma to version 1.1.1 🚀 (@greenkeeperio-bot)
|
||||
- [#2204](https://github.com/request/request/pull/2204) Add codecov.yml and disable PR comments (@simov)
|
||||
- [#2212](https://github.com/request/request/pull/2212) Fix link to http.IncomingMessage documentation (@nazieb)
|
||||
- [#2208](https://github.com/request/request/pull/2208) Update to form-data RC4 and pass null values to it (@simov)
|
||||
- [#2207](https://github.com/request/request/pull/2207) Move aws4 require statement to the top (@simov)
|
||||
- [#2199](https://github.com/request/request/pull/2199) Update karma-coverage to version 1.0.0 🚀 (@greenkeeperio-bot)
|
||||
- [#2206](https://github.com/request/request/pull/2206) Update qs to version 6.2.0 🚀 (@greenkeeperio-bot)
|
||||
- [#2205](https://github.com/request/request/pull/2205) Use server-destory to close hanging sockets in tests (@simov)
|
||||
- [#2200](https://github.com/request/request/pull/2200) Update karma-cli to version 1.0.0 🚀 (@greenkeeperio-bot)
|
||||
|
||||
### v2.72.0 (2016/04/17)
|
||||
- [#2176](https://github.com/request/request/pull/2176) Do not try to pipe Gzip responses with no body (@simov)
|
||||
- [#2175](https://github.com/request/request/pull/2175) Add 'delete' alias for the 'del' API method (@simov, @MuhanZou)
|
||||
- [#2172](https://github.com/request/request/pull/2172) Add support for deflate content encoding (@czardoz)
|
||||
- [#2169](https://github.com/request/request/pull/2169) Add callback option (@simov)
|
||||
- [#2165](https://github.com/request/request/pull/2165) Check for self.req existence inside the write method (@simov)
|
||||
- [#2167](https://github.com/request/request/pull/2167) Fix TravisCI badge reference master branch (@a0viedo)
|
||||
|
||||
### v2.71.0 (2016/04/12)
|
||||
- [#2164](https://github.com/request/request/pull/2164) Catch errors from the underlying http module (@simov)
|
||||
|
||||
### v2.70.0 (2016/04/05)
|
||||
- [#2147](https://github.com/request/request/pull/2147) Update eslint to version 2.5.3 🚀 (@simov, @greenkeeperio-bot)
|
||||
- [#2009](https://github.com/request/request/pull/2009) Support JSON stringify replacer argument. (@elyobo)
|
||||
- [#2142](https://github.com/request/request/pull/2142) Update eslint to version 2.5.1 🚀 (@greenkeeperio-bot)
|
||||
- [#2128](https://github.com/request/request/pull/2128) Update browserify-istanbul to version 2.0.0 🚀 (@greenkeeperio-bot)
|
||||
- [#2115](https://github.com/request/request/pull/2115) Update eslint to version 2.3.0 🚀 (@simov, @greenkeeperio-bot)
|
||||
- [#2089](https://github.com/request/request/pull/2089) Fix badges (@simov)
|
||||
- [#2092](https://github.com/request/request/pull/2092) Update browserify-istanbul to version 1.0.0 🚀 (@greenkeeperio-bot)
|
||||
- [#2079](https://github.com/request/request/pull/2079) Accept read stream as body option (@simov)
|
||||
- [#2070](https://github.com/request/request/pull/2070) Update bl to version 1.1.2 🚀 (@greenkeeperio-bot)
|
||||
- [#2063](https://github.com/request/request/pull/2063) Up bluebird and oauth-sign (@simov)
|
||||
- [#2058](https://github.com/request/request/pull/2058) Karma fixes for latest versions (@eiriksm)
|
||||
- [#2057](https://github.com/request/request/pull/2057) Update contributing guidelines (@simov)
|
||||
- [#2054](https://github.com/request/request/pull/2054) Update qs to version 6.1.0 🚀 (@greenkeeperio-bot)
|
||||
|
||||
### v2.69.0 (2016/01/27)
|
||||
- [#2041](https://github.com/request/request/pull/2041) restore aws4 as regular dependency (@rmg)
|
||||
|
||||
### v2.68.0 (2016/01/27)
|
||||
- [#2036](https://github.com/request/request/pull/2036) Add AWS Signature Version 4 (@simov, @mirkods)
|
||||
- [#2022](https://github.com/request/request/pull/2022) Convert numeric multipart bodies to string (@simov, @feross)
|
||||
- [#2024](https://github.com/request/request/pull/2024) Update har-validator dependency for nsp advisory #76 (@TylerDixon)
|
||||
- [#2016](https://github.com/request/request/pull/2016) Update qs to version 6.0.2 🚀 (@greenkeeperio-bot)
|
||||
- [#2007](https://github.com/request/request/pull/2007) Use the `extend` module instead of util._extend (@simov)
|
||||
- [#2003](https://github.com/request/request/pull/2003) Update browserify to version 13.0.0 🚀 (@greenkeeperio-bot)
|
||||
- [#1989](https://github.com/request/request/pull/1989) Update buffer-equal to version 1.0.0 🚀 (@greenkeeperio-bot)
|
||||
- [#1956](https://github.com/request/request/pull/1956) Check form-data content-length value before setting up the header (@jongyoonlee)
|
||||
- [#1958](https://github.com/request/request/pull/1958) Use IncomingMessage.destroy method (@simov)
|
||||
- [#1952](https://github.com/request/request/pull/1952) Adds example for Tor proxy (@prometheansacrifice)
|
||||
- [#1943](https://github.com/request/request/pull/1943) Update eslint to version 1.10.3 🚀 (@simov, @greenkeeperio-bot)
|
||||
- [#1924](https://github.com/request/request/pull/1924) Update eslint to version 1.10.1 🚀 (@greenkeeperio-bot)
|
||||
- [#1915](https://github.com/request/request/pull/1915) Remove content-length and transfer-encoding headers from defaultProxyHeaderWhiteList (@yaxia)
|
||||
|
||||
### v2.67.0 (2015/11/19)
|
||||
- [#1913](https://github.com/request/request/pull/1913) Update http-signature to version 1.1.0 🚀 (@greenkeeperio-bot)
|
||||
|
||||
### v2.66.0 (2015/11/18)
|
||||
- [#1906](https://github.com/request/request/pull/1906) Update README URLs based on HTTP redirects (@ReadmeCritic)
|
||||
- [#1905](https://github.com/request/request/pull/1905) Convert typed arrays into regular buffers (@simov)
|
||||
- [#1902](https://github.com/request/request/pull/1902) node-uuid@1.4.7 breaks build 🚨 (@greenkeeperio-bot)
|
||||
- [#1894](https://github.com/request/request/pull/1894) Fix tunneling after redirection from https (Original: #1881) (@simov, @falms)
|
||||
- [#1893](https://github.com/request/request/pull/1893) Update eslint to version 1.9.0 🚀 (@greenkeeperio-bot)
|
||||
- [#1852](https://github.com/request/request/pull/1852) Update eslint to version 1.7.3 🚀 (@simov, @greenkeeperio-bot, @paulomcnally, @michelsalib, @arbaaz, @nsklkn, @LoicMahieu, @JoshWillik, @jzaefferer, @ryanwholey, @djchie, @thisconnect, @mgenereu, @acroca, @Sebmaster, @KoltesDigital)
|
||||
- [#1876](https://github.com/request/request/pull/1876) Implement loose matching for har mime types (@simov)
|
||||
- [#1875](https://github.com/request/request/pull/1875) Update bluebird to version 3.0.2 🚀 (@simov, @greenkeeperio-bot)
|
||||
- [#1871](https://github.com/request/request/pull/1871) Update browserify to version 12.0.1 🚀 (@greenkeeperio-bot)
|
||||
- [#1866](https://github.com/request/request/pull/1866) Add missing quotes on x-token property in README (@miguelmota)
|
||||
- [#1874](https://github.com/request/request/pull/1874) Fix typo in README.md (@gswalden)
|
||||
- [#1860](https://github.com/request/request/pull/1860) Improve referer header tests and docs (@simov)
|
||||
- [#1861](https://github.com/request/request/pull/1861) Remove redundant call to Stream constructor (@watson)
|
||||
- [#1857](https://github.com/request/request/pull/1857) Fix Referer header to point to the original host name (@simov)
|
||||
- [#1850](https://github.com/request/request/pull/1850) Update karma-coverage to version 0.5.3 🚀 (@greenkeeperio-bot)
|
||||
- [#1847](https://github.com/request/request/pull/1847) Use node's latest version when building (@simov)
|
||||
- [#1836](https://github.com/request/request/pull/1836) Tunnel: fix wrong property name (@KoltesDigital)
|
||||
- [#1820](https://github.com/request/request/pull/1820) Set href as request.js uses it (@mgenereu)
|
||||
- [#1840](https://github.com/request/request/pull/1840) Update http-signature to version 1.0.2 🚀 (@greenkeeperio-bot)
|
||||
- [#1845](https://github.com/request/request/pull/1845) Update istanbul to version 0.4.0 🚀 (@greenkeeperio-bot)
|
||||
|
||||
### v2.65.0 (2015/10/11)
|
||||
- [#1833](https://github.com/request/request/pull/1833) Update aws-sign2 to version 0.6.0 🚀 (@greenkeeperio-bot)
|
||||
- [#1811](https://github.com/request/request/pull/1811) Enable loose cookie parsing in tough-cookie (@Sebmaster)
|
||||
- [#1830](https://github.com/request/request/pull/1830) Bring back tilde ranges for all dependencies (@simov)
|
||||
- [#1821](https://github.com/request/request/pull/1821) Implement support for RFC 2617 MD5-sess algorithm. (@BigDSK)
|
||||
- [#1828](https://github.com/request/request/pull/1828) Updated qs dependency to 5.2.0 (@acroca)
|
||||
- [#1818](https://github.com/request/request/pull/1818) Extract `readResponseBody` method out of `onRequestResponse` (@pvoisin)
|
||||
- [#1819](https://github.com/request/request/pull/1819) Run stringify once (@mgenereu)
|
||||
- [#1814](https://github.com/request/request/pull/1814) Updated har-validator to version 2.0.2 (@greenkeeperio-bot)
|
||||
- [#1807](https://github.com/request/request/pull/1807) Updated tough-cookie to version 2.1.0 (@greenkeeperio-bot)
|
||||
- [#1800](https://github.com/request/request/pull/1800) Add caret ranges for devDependencies, except eslint (@simov)
|
||||
- [#1799](https://github.com/request/request/pull/1799) Updated karma-browserify to version 4.4.0 (@greenkeeperio-bot)
|
||||
- [#1797](https://github.com/request/request/pull/1797) Updated tape to version 4.2.0 (@greenkeeperio-bot)
|
||||
- [#1788](https://github.com/request/request/pull/1788) Pinned all dependencies (@greenkeeperio-bot)
|
||||
|
||||
### v2.64.0 (2015/09/25)
|
||||
- [#1787](https://github.com/request/request/pull/1787) npm ignore examples, release.sh and disabled.appveyor.yml (@thisconnect)
|
||||
- [#1775](https://github.com/request/request/pull/1775) Fix typo in README.md (@djchie)
|
||||
- [#1776](https://github.com/request/request/pull/1776) Changed word 'conjuction' to read 'conjunction' in README.md (@ryanwholey)
|
||||
- [#1785](https://github.com/request/request/pull/1785) Revert: Set default application/json content-type when using json option #1772 (@simov)
|
||||
|
||||
### v2.63.0 (2015/09/21)
|
||||
- [#1772](https://github.com/request/request/pull/1772) Set default application/json content-type when using json option (@jzaefferer)
|
||||
|
||||
### v2.62.0 (2015/09/15)
|
||||
- [#1768](https://github.com/request/request/pull/1768) Add node 4.0 to the list of build targets (@simov)
|
||||
- [#1767](https://github.com/request/request/pull/1767) Query strings now cooperate with unix sockets (@JoshWillik)
|
||||
- [#1750](https://github.com/request/request/pull/1750) Revert doc about installation of tough-cookie added in #884 (@LoicMahieu)
|
||||
- [#1746](https://github.com/request/request/pull/1746) Missed comma in Readme (@nsklkn)
|
||||
- [#1743](https://github.com/request/request/pull/1743) Fix options not being initialized in defaults method (@simov)
|
||||
|
||||
### v2.61.0 (2015/08/19)
|
||||
- [#1721](https://github.com/request/request/pull/1721) Minor fix in README.md (@arbaaz)
|
||||
- [#1733](https://github.com/request/request/pull/1733) Avoid useless Buffer transformation (@michelsalib)
|
||||
- [#1726](https://github.com/request/request/pull/1726) Update README.md (@paulomcnally)
|
||||
- [#1715](https://github.com/request/request/pull/1715) Fix forever option in node > 0.10 #1709 (@calibr)
|
||||
- [#1716](https://github.com/request/request/pull/1716) Do not create Buffer from Object in setContentLength(iojs v3.0 issue) (@calibr)
|
||||
- [#1711](https://github.com/request/request/pull/1711) Add ability to detect connect timeouts (@kevinburke)
|
||||
- [#1712](https://github.com/request/request/pull/1712) Set certificate expiration to August 2, 2018 (@kevinburke)
|
||||
- [#1700](https://github.com/request/request/pull/1700) debug() when JSON.parse() on a response body fails (@phillipj)
|
||||
|
||||
### v2.60.0 (2015/07/21)
|
||||
- [#1687](https://github.com/request/request/pull/1687) Fix caseless bug - content-type not being set for multipart/form-data (@simov, @garymathews)
|
||||
|
||||
### v2.59.0 (2015/07/20)
|
||||
- [#1671](https://github.com/request/request/pull/1671) Add tests and docs for using the agent, agentClass, agentOptions and forever options.
|
||||
Forever option defaults to using http(s).Agent in node 0.12+ (@simov)
|
||||
- [#1679](https://github.com/request/request/pull/1679) Fix - do not remove OAuth param when using OAuth realm (@simov, @jhalickman)
|
||||
- [#1668](https://github.com/request/request/pull/1668) updated dependencies (@deamme)
|
||||
- [#1656](https://github.com/request/request/pull/1656) Fix form method (@simov)
|
||||
- [#1651](https://github.com/request/request/pull/1651) Preserve HEAD method when using followAllRedirects (@simov)
|
||||
- [#1652](https://github.com/request/request/pull/1652) Update `encoding` option documentation in README.md (@daniel347x)
|
||||
- [#1650](https://github.com/request/request/pull/1650) Allow content-type overriding when using the `form` option (@simov)
|
||||
- [#1646](https://github.com/request/request/pull/1646) Clarify the nature of setting `ca` in `agentOptions` (@jeffcharles)
|
||||
|
||||
### v2.58.0 (2015/06/16)
|
||||
- [#1638](https://github.com/request/request/pull/1638) Use the `extend` module to deep extend in the defaults method (@simov)
|
||||
- [#1631](https://github.com/request/request/pull/1631) Move tunnel logic into separate module (@simov)
|
||||
- [#1634](https://github.com/request/request/pull/1634) Fix OAuth query transport_method (@simov)
|
||||
- [#1603](https://github.com/request/request/pull/1603) Add codecov (@simov)
|
||||
|
||||
### v2.57.0 (2015/05/31)
|
||||
- [#1615](https://github.com/request/request/pull/1615) Replace '.client' with '.socket' as the former was deprecated in 2.2.0. (@ChALkeR)
|
||||
|
||||
### v2.56.0 (2015/05/28)
|
||||
- [#1610](https://github.com/request/request/pull/1610) Bump module dependencies (@simov)
|
||||
- [#1600](https://github.com/request/request/pull/1600) Extract the querystring logic into separate module (@simov)
|
||||
- [#1607](https://github.com/request/request/pull/1607) Re-generate certificates (@simov)
|
||||
- [#1599](https://github.com/request/request/pull/1599) Move getProxyFromURI logic below the check for Invaild URI (#1595) (@simov)
|
||||
- [#1598](https://github.com/request/request/pull/1598) Fix the way http verbs are defined in order to please intellisense IDEs (@simov, @flannelJesus)
|
||||
- [#1591](https://github.com/request/request/pull/1591) A few minor fixes: (@simov)
|
||||
- [#1584](https://github.com/request/request/pull/1584) Refactor test-default tests (according to comments in #1430) (@simov)
|
||||
- [#1585](https://github.com/request/request/pull/1585) Fixing documentation regarding TLS options (#1583) (@mainakae)
|
||||
- [#1574](https://github.com/request/request/pull/1574) Refresh the oauth_nonce on redirect (#1573) (@simov)
|
||||
- [#1570](https://github.com/request/request/pull/1570) Discovered tests that weren't properly running (@seanstrom)
|
||||
- [#1569](https://github.com/request/request/pull/1569) Fix pause before response arrives (@kevinoid)
|
||||
- [#1558](https://github.com/request/request/pull/1558) Emit error instead of throw (@simov)
|
||||
- [#1568](https://github.com/request/request/pull/1568) Fix stall when piping gzipped response (@kevinoid)
|
||||
- [#1560](https://github.com/request/request/pull/1560) Update combined-stream (@apechimp)
|
||||
- [#1543](https://github.com/request/request/pull/1543) Initial support for oauth_body_hash on json payloads (@simov, @aesopwolf)
|
||||
- [#1541](https://github.com/request/request/pull/1541) Fix coveralls (@simov)
|
||||
- [#1540](https://github.com/request/request/pull/1540) Fix recursive defaults for convenience methods (@simov)
|
||||
- [#1536](https://github.com/request/request/pull/1536) More eslint style rules (@froatsnook)
|
||||
- [#1533](https://github.com/request/request/pull/1533) Adding dependency status bar to README.md (@YasharF)
|
||||
- [#1539](https://github.com/request/request/pull/1539) ensure the latest version of har-validator is included (@ahmadnassri)
|
||||
- [#1516](https://github.com/request/request/pull/1516) forever+pool test (@devTristan)
|
||||
|
||||
### v2.55.0 (2015/04/05)
|
||||
- [#1520](https://github.com/request/request/pull/1520) Refactor defaults (@simov)
|
||||
- [#1525](https://github.com/request/request/pull/1525) Delete request headers with undefined value. (@froatsnook)
|
||||
- [#1521](https://github.com/request/request/pull/1521) Add promise tests (@simov)
|
||||
- [#1518](https://github.com/request/request/pull/1518) Fix defaults (@simov)
|
||||
- [#1515](https://github.com/request/request/pull/1515) Allow static invoking of convenience methods (@simov)
|
||||
- [#1505](https://github.com/request/request/pull/1505) Fix multipart boundary extraction regexp (@simov)
|
||||
- [#1510](https://github.com/request/request/pull/1510) Fix basic auth form data (@simov)
|
||||
|
||||
### v2.54.0 (2015/03/24)
|
||||
- [#1501](https://github.com/request/request/pull/1501) HTTP Archive 1.2 support (@ahmadnassri)
|
||||
- [#1486](https://github.com/request/request/pull/1486) Add a test for the forever agent (@akshayp)
|
||||
- [#1500](https://github.com/request/request/pull/1500) Adding handling for no auth method and null bearer (@philberg)
|
||||
- [#1498](https://github.com/request/request/pull/1498) Add table of contents in readme (@simov)
|
||||
- [#1477](https://github.com/request/request/pull/1477) Add support for qs options via qsOptions key (@simov)
|
||||
- [#1496](https://github.com/request/request/pull/1496) Parameters encoded to base 64 should be decoded as UTF-8, not ASCII. (@albanm)
|
||||
- [#1494](https://github.com/request/request/pull/1494) Update eslint (@froatsnook)
|
||||
- [#1474](https://github.com/request/request/pull/1474) Require Colon in Basic Auth (@erykwalder)
|
||||
- [#1481](https://github.com/request/request/pull/1481) Fix baseUrl and redirections. (@burningtree)
|
||||
- [#1469](https://github.com/request/request/pull/1469) Feature/base url (@froatsnook)
|
||||
- [#1459](https://github.com/request/request/pull/1459) Add option to time request/response cycle (including rollup of redirects) (@aaron-em)
|
||||
- [#1468](https://github.com/request/request/pull/1468) Re-enable io.js/node 0.12 build (@simov, @mikeal, @BBB)
|
||||
- [#1442](https://github.com/request/request/pull/1442) Fixed the issue with strictSSL tests on 0.12 & io.js by explicitly setting a cipher that matches the cert. (@BBB, @nickmccurdy, @demohi, @simov, @0x4139)
|
||||
- [#1460](https://github.com/request/request/pull/1460) localAddress or proxy config is lost when redirecting (@simov, @0x4139)
|
||||
- [#1453](https://github.com/request/request/pull/1453) Test on Node.js 0.12 and io.js with allowed failures (@nickmccurdy, @demohi)
|
||||
- [#1426](https://github.com/request/request/pull/1426) Fixing tests to pass on io.js and node 0.12 (only test-https.js stiff failing) (@mikeal)
|
||||
- [#1446](https://github.com/request/request/pull/1446) Missing HTTP referer header with redirects Fixes #1038 (@simov, @guimon)
|
||||
- [#1428](https://github.com/request/request/pull/1428) Deprecate Node v0.8.x (@nylen)
|
||||
- [#1436](https://github.com/request/request/pull/1436) Add ability to set a requester without setting default options (@tikotzky)
|
||||
- [#1435](https://github.com/request/request/pull/1435) dry up verb methods (@sethpollack)
|
||||
- [#1423](https://github.com/request/request/pull/1423) Allow fully qualified multipart content-type header (@simov)
|
||||
- [#1430](https://github.com/request/request/pull/1430) Fix recursive requester (@tikotzky)
|
||||
- [#1429](https://github.com/request/request/pull/1429) Throw error when making HEAD request with a body (@tikotzky)
|
||||
- [#1419](https://github.com/request/request/pull/1419) Add note that the project is broken in 0.12.x (@nylen)
|
||||
- [#1413](https://github.com/request/request/pull/1413) Fix basic auth (@simov)
|
||||
- [#1397](https://github.com/request/request/pull/1397) Improve pipe-from-file tests (@nylen)
|
||||
|
||||
### v2.53.0 (2015/02/02)
|
||||
- [#1396](https://github.com/request/request/pull/1396) Do not rfc3986 escape JSON bodies (@nylen, @simov)
|
||||
- [#1392](https://github.com/request/request/pull/1392) Improve `timeout` option description (@watson)
|
||||
|
||||
### v2.52.0 (2015/02/02)
|
||||
- [#1383](https://github.com/request/request/pull/1383) Add missing HTTPS options that were not being passed to tunnel (@brichard19) (@nylen)
|
||||
- [#1388](https://github.com/request/request/pull/1388) Upgrade mime-types package version (@roderickhsiao)
|
||||
- [#1389](https://github.com/request/request/pull/1389) Revise Setup Tunnel Function (@seanstrom)
|
||||
- [#1374](https://github.com/request/request/pull/1374) Allow explicitly disabling tunneling for proxied https destinations (@nylen)
|
||||
- [#1376](https://github.com/request/request/pull/1376) Use karma-browserify for tests. Add browser test coverage reporter. (@eiriksm)
|
||||
- [#1366](https://github.com/request/request/pull/1366) Refactor OAuth into separate module (@simov)
|
||||
- [#1373](https://github.com/request/request/pull/1373) Rewrite tunnel test to be pure Node.js (@nylen)
|
||||
- [#1371](https://github.com/request/request/pull/1371) Upgrade test reporter (@nylen)
|
||||
- [#1360](https://github.com/request/request/pull/1360) Refactor basic, bearer, digest auth logic into separate class (@simov)
|
||||
- [#1354](https://github.com/request/request/pull/1354) Remove circular dependency from debugging code (@nylen)
|
||||
- [#1351](https://github.com/request/request/pull/1351) Move digest auth into private prototype method (@simov)
|
||||
- [#1352](https://github.com/request/request/pull/1352) Update hawk dependency to ~2.3.0 (@mridgway)
|
||||
- [#1353](https://github.com/request/request/pull/1353) Correct travis-ci badge (@dogancelik)
|
||||
- [#1349](https://github.com/request/request/pull/1349) Make sure we return on errored browser requests. (@eiriksm)
|
||||
- [#1346](https://github.com/request/request/pull/1346) getProxyFromURI Extraction Refactor (@seanstrom)
|
||||
- [#1337](https://github.com/request/request/pull/1337) Standardize test ports on 6767 (@nylen)
|
||||
- [#1341](https://github.com/request/request/pull/1341) Emit FormData error events as Request error events (@nylen, @rwky)
|
||||
- [#1343](https://github.com/request/request/pull/1343) Clean up readme badges, and add Travis and Coveralls badges (@nylen)
|
||||
- [#1345](https://github.com/request/request/pull/1345) Update README.md (@Aaron-Hartwig)
|
||||
- [#1338](https://github.com/request/request/pull/1338) Always wait for server.close() callback in tests (@nylen)
|
||||
- [#1342](https://github.com/request/request/pull/1342) Add mock https server and redo start of browser tests for this purpose. (@eiriksm)
|
||||
- [#1339](https://github.com/request/request/pull/1339) Improve auth docs (@nylen)
|
||||
- [#1335](https://github.com/request/request/pull/1335) Add support for OAuth plaintext signature method (@simov)
|
||||
- [#1332](https://github.com/request/request/pull/1332) Add clean script to remove test-browser.js after the tests run (@seanstrom)
|
||||
- [#1327](https://github.com/request/request/pull/1327) Fix errors generating coverage reports. (@nylen)
|
||||
- [#1330](https://github.com/request/request/pull/1330) Return empty buffer upon empty response body and encoding is set to null (@seanstrom)
|
||||
- [#1326](https://github.com/request/request/pull/1326) Use faster container-based infrastructure on Travis (@nylen)
|
||||
- [#1315](https://github.com/request/request/pull/1315) Implement rfc3986 option (@simov, @nylen, @apoco, @DullReferenceException, @mmalecki, @oliamb, @cliffcrosland, @LewisJEllis, @eiriksm, @poislagarde)
|
||||
- [#1314](https://github.com/request/request/pull/1314) Detect urlencoded form data header via regex (@simov)
|
||||
- [#1317](https://github.com/request/request/pull/1317) Improve OAuth1.0 server side flow example (@simov)
|
||||
|
||||
### v2.51.0 (2014/12/10)
|
||||
- [#1310](https://github.com/request/request/pull/1310) Revert changes introduced in https://github.com/request/request/pull/1282 (@simov)
|
||||
|
||||
### v2.50.0 (2014/12/09)
|
||||
- [#1308](https://github.com/request/request/pull/1308) Add browser test to keep track of browserify compability. (@eiriksm)
|
||||
- [#1299](https://github.com/request/request/pull/1299) Add optional support for jsonReviver (@poislagarde)
|
||||
- [#1277](https://github.com/request/request/pull/1277) Add Coveralls configuration (@simov)
|
||||
- [#1307](https://github.com/request/request/pull/1307) Upgrade form-data, add back browserify compability. Fixes #455. (@eiriksm)
|
||||
- [#1305](https://github.com/request/request/pull/1305) Fix typo in README.md (@LewisJEllis)
|
||||
- [#1288](https://github.com/request/request/pull/1288) Update README.md to explain custom file use case (@cliffcrosland)
|
||||
|
||||
### v2.49.0 (2014/11/28)
|
||||
- [#1295](https://github.com/request/request/pull/1295) fix(proxy): no-proxy false positive (@oliamb)
|
||||
- [#1292](https://github.com/request/request/pull/1292) Upgrade `caseless` to 0.8.1 (@mmalecki)
|
||||
- [#1276](https://github.com/request/request/pull/1276) Set transfer encoding for multipart/related to chunked by default (@simov)
|
||||
- [#1275](https://github.com/request/request/pull/1275) Fix multipart content-type headers detection (@simov)
|
||||
- [#1269](https://github.com/request/request/pull/1269) adds streams example for review (@tbuchok)
|
||||
- [#1238](https://github.com/request/request/pull/1238) Add examples README.md (@simov)
|
||||
|
||||
### v2.48.0 (2014/11/12)
|
||||
- [#1263](https://github.com/request/request/pull/1263) Fixed a syntax error / typo in README.md (@xna2)
|
||||
- [#1253](https://github.com/request/request/pull/1253) Add multipart chunked flag (@simov, @nylen)
|
||||
- [#1251](https://github.com/request/request/pull/1251) Clarify that defaults() does not modify global defaults (@nylen)
|
||||
- [#1250](https://github.com/request/request/pull/1250) Improve documentation for pool and maxSockets options (@nylen)
|
||||
- [#1237](https://github.com/request/request/pull/1237) Documenting error handling when using streams (@vmattos)
|
||||
- [#1244](https://github.com/request/request/pull/1244) Finalize changelog command (@nylen)
|
||||
- [#1241](https://github.com/request/request/pull/1241) Fix typo (@alexanderGugel)
|
||||
- [#1223](https://github.com/request/request/pull/1223) Show latest version number instead of "upcoming" in changelog (@nylen)
|
||||
- [#1236](https://github.com/request/request/pull/1236) Document how to use custom CA in README (#1229) (@hypesystem)
|
||||
- [#1228](https://github.com/request/request/pull/1228) Support for oauth with RSA-SHA1 signing (@nylen)
|
||||
- [#1216](https://github.com/request/request/pull/1216) Made json and multipart options coexist (@nylen, @simov)
|
||||
- [#1225](https://github.com/request/request/pull/1225) Allow header white/exclusive lists in any case. (@RReverser)
|
||||
|
||||
### v2.47.0 (2014/10/26)
|
||||
- [#1222](https://github.com/request/request/pull/1222) Move from mikeal/request to request/request (@nylen)
|
||||
- [#1220](https://github.com/request/request/pull/1220) update qs dependency to 2.3.1 (@FredKSchott)
|
||||
- [#1212](https://github.com/request/request/pull/1212) Improve tests/test-timeout.js (@nylen)
|
||||
- [#1219](https://github.com/request/request/pull/1219) remove old globalAgent workaround for node 0.4 (@request)
|
||||
- [#1214](https://github.com/request/request/pull/1214) Remove cruft left over from optional dependencies (@nylen)
|
||||
- [#1215](https://github.com/request/request/pull/1215) Add proxyHeaderExclusiveList option for proxy-only headers. (@RReverser)
|
||||
- [#1211](https://github.com/request/request/pull/1211) Allow 'Host' header instead of 'host' and remember case across redirects (@nylen)
|
||||
- [#1208](https://github.com/request/request/pull/1208) Improve release script (@nylen)
|
||||
- [#1213](https://github.com/request/request/pull/1213) Support for custom cookie store (@nylen, @mitsuru)
|
||||
- [#1197](https://github.com/request/request/pull/1197) Clean up some code around setting the agent (@FredKSchott)
|
||||
- [#1209](https://github.com/request/request/pull/1209) Improve multipart form append test (@simov)
|
||||
- [#1207](https://github.com/request/request/pull/1207) Update changelog (@nylen)
|
||||
- [#1185](https://github.com/request/request/pull/1185) Stream multipart/related bodies (@simov)
|
||||
|
||||
### v2.46.0 (2014/10/23)
|
||||
- [#1198](https://github.com/request/request/pull/1198) doc for TLS/SSL protocol options (@shawnzhu)
|
||||
- [#1200](https://github.com/request/request/pull/1200) Add a Gitter chat badge to README.md (@gitter-badger)
|
||||
- [#1196](https://github.com/request/request/pull/1196) Upgrade taper test reporter to v0.3.0 (@nylen)
|
||||
- [#1199](https://github.com/request/request/pull/1199) Fix lint error: undeclared var i (@nylen)
|
||||
- [#1191](https://github.com/request/request/pull/1191) Move self.proxy decision logic out of init and into a helper (@FredKSchott)
|
||||
- [#1190](https://github.com/request/request/pull/1190) Move _buildRequest() logic back into init (@FredKSchott)
|
||||
- [#1186](https://github.com/request/request/pull/1186) Support Smarter Unix URL Scheme (@FredKSchott)
|
||||
- [#1178](https://github.com/request/request/pull/1178) update form documentation for new usage (@FredKSchott)
|
||||
- [#1180](https://github.com/request/request/pull/1180) Enable no-mixed-requires linting rule (@nylen)
|
||||
- [#1184](https://github.com/request/request/pull/1184) Don't forward authorization header across redirects to different hosts (@nylen)
|
||||
- [#1183](https://github.com/request/request/pull/1183) Correct README about pre and postamble CRLF using multipart and not mult... (@netpoetica)
|
||||
- [#1179](https://github.com/request/request/pull/1179) Lint tests directory (@nylen)
|
||||
- [#1169](https://github.com/request/request/pull/1169) add metadata for form-data file field (@dotcypress)
|
||||
- [#1173](https://github.com/request/request/pull/1173) remove optional dependencies (@seanstrom)
|
||||
- [#1165](https://github.com/request/request/pull/1165) Cleanup event listeners and remove function creation from init (@FredKSchott)
|
||||
- [#1174](https://github.com/request/request/pull/1174) update the request.cookie docs to have a valid cookie example (@seanstrom)
|
||||
- [#1168](https://github.com/request/request/pull/1168) create a detach helper and use detach helper in replace of nextTick (@seanstrom)
|
||||
- [#1171](https://github.com/request/request/pull/1171) in post can send form data and use callback (@MiroRadenovic)
|
||||
- [#1159](https://github.com/request/request/pull/1159) accept charset for x-www-form-urlencoded content-type (@seanstrom)
|
||||
- [#1157](https://github.com/request/request/pull/1157) Update README.md: body with json=true (@Rob--W)
|
||||
- [#1164](https://github.com/request/request/pull/1164) Disable tests/test-timeout.js on Travis (@nylen)
|
||||
- [#1153](https://github.com/request/request/pull/1153) Document how to run a single test (@nylen)
|
||||
- [#1144](https://github.com/request/request/pull/1144) adds documentation for the "response" event within the streaming section (@tbuchok)
|
||||
- [#1162](https://github.com/request/request/pull/1162) Update eslintrc file to no longer allow past errors (@FredKSchott)
|
||||
- [#1155](https://github.com/request/request/pull/1155) Support/use self everywhere (@seanstrom)
|
||||
- [#1161](https://github.com/request/request/pull/1161) fix no-use-before-define lint warnings (@emkay)
|
||||
- [#1156](https://github.com/request/request/pull/1156) adding curly brackets to get rid of lint errors (@emkay)
|
||||
- [#1151](https://github.com/request/request/pull/1151) Fix localAddress test on OS X (@nylen)
|
||||
- [#1145](https://github.com/request/request/pull/1145) documentation: fix outdated reference to setCookieSync old name in README (@FredKSchott)
|
||||
- [#1131](https://github.com/request/request/pull/1131) Update pool documentation (@FredKSchott)
|
||||
- [#1143](https://github.com/request/request/pull/1143) Rewrite all tests to use tape (@nylen)
|
||||
- [#1137](https://github.com/request/request/pull/1137) Add ability to specifiy querystring lib in options. (@jgrund)
|
||||
- [#1138](https://github.com/request/request/pull/1138) allow hostname and port in place of host on uri (@cappslock)
|
||||
- [#1134](https://github.com/request/request/pull/1134) Fix multiple redirects and `self.followRedirect` (@blakeembrey)
|
||||
- [#1130](https://github.com/request/request/pull/1130) documentation fix: add note about npm test for contributing (@FredKSchott)
|
||||
- [#1120](https://github.com/request/request/pull/1120) Support/refactor request setup tunnel (@seanstrom)
|
||||
- [#1129](https://github.com/request/request/pull/1129) linting fix: convert double quote strings to use single quotes (@FredKSchott)
|
||||
- [#1124](https://github.com/request/request/pull/1124) linting fix: remove unneccesary semi-colons (@FredKSchott)
|
||||
|
||||
### v2.45.0 (2014/10/06)
|
||||
- [#1128](https://github.com/request/request/pull/1128) Add test for setCookie regression (@nylen)
|
||||
- [#1127](https://github.com/request/request/pull/1127) added tests around using objects as values in a query string (@bcoe)
|
||||
- [#1103](https://github.com/request/request/pull/1103) Support/refactor request constructor (@nylen, @seanstrom)
|
||||
- [#1119](https://github.com/request/request/pull/1119) add basic linting to request library (@FredKSchott)
|
||||
- [#1121](https://github.com/request/request/pull/1121) Revert "Explicitly use sync versions of cookie functions" (@nylen)
|
||||
- [#1118](https://github.com/request/request/pull/1118) linting fix: Restructure bad empty if statement (@FredKSchott)
|
||||
- [#1117](https://github.com/request/request/pull/1117) Fix a bad check for valid URIs (@FredKSchott)
|
||||
- [#1113](https://github.com/request/request/pull/1113) linting fix: space out operators (@FredKSchott)
|
||||
- [#1116](https://github.com/request/request/pull/1116) Fix typo in `noProxyHost` definition (@FredKSchott)
|
||||
- [#1114](https://github.com/request/request/pull/1114) linting fix: Added a `new` operator that was missing when creating and throwing a new error (@FredKSchott)
|
||||
- [#1096](https://github.com/request/request/pull/1096) No_proxy support (@samcday)
|
||||
- [#1107](https://github.com/request/request/pull/1107) linting-fix: remove unused variables (@FredKSchott)
|
||||
- [#1112](https://github.com/request/request/pull/1112) linting fix: Make return values consistent and more straitforward (@FredKSchott)
|
||||
- [#1111](https://github.com/request/request/pull/1111) linting fix: authPieces was getting redeclared (@FredKSchott)
|
||||
- [#1105](https://github.com/request/request/pull/1105) Use strict mode in request (@FredKSchott)
|
||||
- [#1110](https://github.com/request/request/pull/1110) linting fix: replace lazy '==' with more strict '===' (@FredKSchott)
|
||||
- [#1109](https://github.com/request/request/pull/1109) linting fix: remove function call from if-else conditional statement (@FredKSchott)
|
||||
- [#1102](https://github.com/request/request/pull/1102) Fix to allow setting a `requester` on recursive calls to `request.defaults` (@tikotzky)
|
||||
- [#1095](https://github.com/request/request/pull/1095) Tweaking engines in package.json (@pdehaan)
|
||||
- [#1082](https://github.com/request/request/pull/1082) Forward the socket event from the httpModule request (@seanstrom)
|
||||
- [#972](https://github.com/request/request/pull/972) Clarify gzip handling in the README (@kevinoid)
|
||||
- [#1089](https://github.com/request/request/pull/1089) Mention that encoding defaults to utf8, not Buffer (@stuartpb)
|
||||
- [#1088](https://github.com/request/request/pull/1088) Fix cookie example in README.md and make it more clear (@pipi32167)
|
||||
- [#1027](https://github.com/request/request/pull/1027) Add support for multipart form data in request options. (@crocket)
|
||||
- [#1076](https://github.com/request/request/pull/1076) use Request.abort() to abort the request when the request has timed-out (@seanstrom)
|
||||
- [#1068](https://github.com/request/request/pull/1068) add optional postamble required by .NET multipart requests (@netpoetica)
|
||||
|
||||
### v2.43.0 (2014/09/18)
|
||||
- [#1057](https://github.com/request/request/pull/1057) Defaults should not overwrite defined options (@davidwood)
|
||||
- [#1046](https://github.com/request/request/pull/1046) Propagate datastream errors, useful in case gzip fails. (@ZJONSSON, @Janpot)
|
||||
- [#1063](https://github.com/request/request/pull/1063) copy the input headers object #1060 (@finnp)
|
||||
- [#1031](https://github.com/request/request/pull/1031) Explicitly use sync versions of cookie functions (@ZJONSSON)
|
||||
- [#1056](https://github.com/request/request/pull/1056) Fix redirects when passing url.parse(x) as URL to convenience method (@nylen)
|
||||
|
||||
### v2.42.0 (2014/09/04)
|
||||
- [#1053](https://github.com/request/request/pull/1053) Fix #1051 Parse auth properly when using non-tunneling proxy (@isaacs)
|
||||
|
||||
### v2.41.0 (2014/09/04)
|
||||
- [#1050](https://github.com/request/request/pull/1050) Pass whitelisted headers to tunneling proxy. Organize all tunneling logic. (@isaacs, @Feldhacker)
|
||||
- [#1035](https://github.com/request/request/pull/1035) souped up nodei.co badge (@rvagg)
|
||||
- [#1048](https://github.com/request/request/pull/1048) Aws is now possible over a proxy (@steven-aerts)
|
||||
- [#1039](https://github.com/request/request/pull/1039) extract out helper functions to a helper file (@seanstrom)
|
||||
- [#1021](https://github.com/request/request/pull/1021) Support/refactor indexjs (@seanstrom)
|
||||
- [#1033](https://github.com/request/request/pull/1033) Improve and document debug options (@nylen)
|
||||
- [#1034](https://github.com/request/request/pull/1034) Fix readme headings (@nylen)
|
||||
- [#1030](https://github.com/request/request/pull/1030) Allow recursive request.defaults (@tikotzky)
|
||||
- [#1029](https://github.com/request/request/pull/1029) Fix a couple of typos (@nylen)
|
||||
- [#675](https://github.com/request/request/pull/675) Checking for SSL fault on connection before reading SSL properties (@VRMink)
|
||||
- [#989](https://github.com/request/request/pull/989) Added allowRedirect function. Should return true if redirect is allowed or false otherwise (@doronin)
|
||||
- [#1025](https://github.com/request/request/pull/1025) [fixes #1023] Set self._ended to true once response has ended (@mridgway)
|
||||
- [#1020](https://github.com/request/request/pull/1020) Add back removed debug metadata (@FredKSchott)
|
||||
- [#1008](https://github.com/request/request/pull/1008) Moving to module instead of cutomer buffer concatenation. (@mikeal)
|
||||
- [#770](https://github.com/request/request/pull/770) Added dependency badge for README file; (@timgluz, @mafintosh, @lalitkapoor, @stash, @bobyrizov)
|
||||
- [#1016](https://github.com/request/request/pull/1016) toJSON no longer results in an infinite loop, returns simple objects (@FredKSchott)
|
||||
- [#1018](https://github.com/request/request/pull/1018) Remove pre-0.4.4 HTTPS fix (@mmalecki)
|
||||
- [#1006](https://github.com/request/request/pull/1006) Migrate to caseless, fixes #1001 (@mikeal)
|
||||
- [#995](https://github.com/request/request/pull/995) Fix parsing array of objects (@sjonnet19)
|
||||
- [#999](https://github.com/request/request/pull/999) Fix fallback for browserify for optional modules. (@eiriksm)
|
||||
- [#996](https://github.com/request/request/pull/996) Wrong oauth signature when multiple same param keys exist [updated] (@bengl)
|
||||
|
||||
### v2.40.0 (2014/08/06)
|
||||
- [#992](https://github.com/request/request/pull/992) Fix security vulnerability. Update qs (@poeticninja)
|
||||
- [#988](https://github.com/request/request/pull/988) “--” -> “—” (@upisfree)
|
||||
- [#987](https://github.com/request/request/pull/987) Show optional modules as being loaded by the module that reqeusted them (@iarna)
|
||||
|
||||
### v2.39.0 (2014/07/24)
|
||||
- [#976](https://github.com/request/request/pull/976) Update README.md (@pvoznenko)
|
||||
|
||||
### v2.38.0 (2014/07/22)
|
||||
- [#952](https://github.com/request/request/pull/952) Adding support to client certificate with proxy use case (@ofirshaked)
|
||||
- [#884](https://github.com/request/request/pull/884) Documented tough-cookie installation. (@wbyoung)
|
||||
- [#935](https://github.com/request/request/pull/935) Correct repository url (@fritx)
|
||||
- [#963](https://github.com/request/request/pull/963) Update changelog (@nylen)
|
||||
- [#960](https://github.com/request/request/pull/960) Support gzip with encoding on node pre-v0.9.4 (@kevinoid)
|
||||
- [#953](https://github.com/request/request/pull/953) Add async Content-Length computation when using form-data (@LoicMahieu)
|
||||
- [#844](https://github.com/request/request/pull/844) Add support for HTTP[S]_PROXY environment variables. Fixes #595. (@jvmccarthy)
|
||||
- [#946](https://github.com/request/request/pull/946) defaults: merge headers (@aj0strow)
|
||||
|
||||
### v2.37.0 (2014/07/07)
|
||||
- [#957](https://github.com/request/request/pull/957) Silence EventEmitter memory leak warning #311 (@watson)
|
||||
- [#955](https://github.com/request/request/pull/955) check for content-length header before setting it in nextTick (@camilleanne)
|
||||
- [#951](https://github.com/request/request/pull/951) Add support for gzip content decoding (@kevinoid)
|
||||
- [#949](https://github.com/request/request/pull/949) Manually enter querystring in form option (@charlespwd)
|
||||
- [#944](https://github.com/request/request/pull/944) Make request work with browserify (@eiriksm)
|
||||
- [#943](https://github.com/request/request/pull/943) New mime module (@eiriksm)
|
||||
- [#927](https://github.com/request/request/pull/927) Bump version of hawk dep. (@samccone)
|
||||
- [#907](https://github.com/request/request/pull/907) append secureOptions to poolKey (@medovob)
|
||||
|
||||
### v2.35.0 (2014/05/17)
|
||||
- [#901](https://github.com/request/request/pull/901) Fixes #555 (@pigulla)
|
||||
- [#897](https://github.com/request/request/pull/897) merge with default options (@vohof)
|
||||
- [#891](https://github.com/request/request/pull/891) fixes 857 - options object is mutated by calling request (@lalitkapoor)
|
||||
- [#869](https://github.com/request/request/pull/869) Pipefilter test (@tgohn)
|
||||
- [#866](https://github.com/request/request/pull/866) Fix typo (@dandv)
|
||||
- [#861](https://github.com/request/request/pull/861) Add support for RFC 6750 Bearer Tokens (@phedny)
|
||||
- [#809](https://github.com/request/request/pull/809) upgrade tunnel-proxy to 0.4.0 (@ksato9700)
|
||||
- [#850](https://github.com/request/request/pull/850) Fix word consistency in readme (@0xNobody)
|
||||
- [#810](https://github.com/request/request/pull/810) add some exposition to mpu example in README.md (@mikermcneil)
|
||||
- [#840](https://github.com/request/request/pull/840) improve error reporting for invalid protocols (@FND)
|
||||
- [#821](https://github.com/request/request/pull/821) added secureOptions back (@nw)
|
||||
- [#815](https://github.com/request/request/pull/815) Create changelog based on pull requests (@lalitkapoor)
|
||||
|
||||
### v2.34.0 (2014/02/18)
|
||||
- [#516](https://github.com/request/request/pull/516) UNIX Socket URL Support (@lyuzashi)
|
||||
- [#801](https://github.com/request/request/pull/801) 794 ignore cookie parsing and domain errors (@lalitkapoor)
|
||||
- [#802](https://github.com/request/request/pull/802) Added the Apache license to the package.json. (@keskival)
|
||||
- [#793](https://github.com/request/request/pull/793) Adds content-length calculation when submitting forms using form-data li... (@Juul)
|
||||
- [#785](https://github.com/request/request/pull/785) Provide ability to override content-type when `json` option used (@vvo)
|
||||
- [#781](https://github.com/request/request/pull/781) simpler isReadStream function (@joaojeronimo)
|
||||
|
||||
### v2.32.0 (2014/01/16)
|
||||
- [#767](https://github.com/request/request/pull/767) Use tough-cookie CookieJar sync API (@stash)
|
||||
- [#764](https://github.com/request/request/pull/764) Case-insensitive authentication scheme (@bobyrizov)
|
||||
- [#763](https://github.com/request/request/pull/763) Upgrade tough-cookie to 0.10.0 (@stash)
|
||||
- [#744](https://github.com/request/request/pull/744) Use Cookie.parse (@lalitkapoor)
|
||||
- [#757](https://github.com/request/request/pull/757) require aws-sign2 (@mafintosh)
|
||||
|
||||
### v2.31.0 (2014/01/08)
|
||||
- [#645](https://github.com/request/request/pull/645) update twitter api url to v1.1 (@mick)
|
||||
- [#746](https://github.com/request/request/pull/746) README: Markdown code highlight (@weakish)
|
||||
- [#745](https://github.com/request/request/pull/745) updating setCookie example to make it clear that the callback is required (@emkay)
|
||||
- [#742](https://github.com/request/request/pull/742) Add note about JSON output body type (@iansltx)
|
||||
- [#741](https://github.com/request/request/pull/741) README example is using old cookie jar api (@emkay)
|
||||
- [#736](https://github.com/request/request/pull/736) Fix callback arguments documentation (@mmalecki)
|
||||
- [#732](https://github.com/request/request/pull/732) JSHINT: Creating global 'for' variable. Should be 'for (var ...'. (@Fritz-Lium)
|
||||
- [#730](https://github.com/request/request/pull/730) better HTTP DIGEST support (@dai-shi)
|
||||
- [#728](https://github.com/request/request/pull/728) Fix TypeError when calling request.cookie (@scarletmeow)
|
||||
- [#727](https://github.com/request/request/pull/727) fix requester bug (@jchris)
|
||||
- [#724](https://github.com/request/request/pull/724) README.md: add custom HTTP Headers example. (@tcort)
|
||||
- [#719](https://github.com/request/request/pull/719) Made a comment gender neutral. (@unsetbit)
|
||||
- [#715](https://github.com/request/request/pull/715) Request.multipart no longer crashes when header 'Content-type' present (@pastaclub)
|
||||
- [#710](https://github.com/request/request/pull/710) Fixing listing in callback part of docs. (@lukasz-zak)
|
||||
- [#696](https://github.com/request/request/pull/696) Edited README.md for formatting and clarity of phrasing (@Zearin)
|
||||
- [#694](https://github.com/request/request/pull/694) Typo in README (@VRMink)
|
||||
- [#690](https://github.com/request/request/pull/690) Handle blank password in basic auth. (@diversario)
|
||||
- [#682](https://github.com/request/request/pull/682) Optional dependencies (@Turbo87)
|
||||
- [#683](https://github.com/request/request/pull/683) Travis CI support (@Turbo87)
|
||||
- [#674](https://github.com/request/request/pull/674) change cookie module,to tough-cookie.please check it . (@sxyizhiren)
|
||||
- [#666](https://github.com/request/request/pull/666) make `ciphers` and `secureProtocol` to work in https request (@richarddong)
|
||||
- [#656](https://github.com/request/request/pull/656) Test case for #304. (@diversario)
|
||||
- [#662](https://github.com/request/request/pull/662) option.tunnel to explicitly disable tunneling (@seanmonstar)
|
||||
- [#659](https://github.com/request/request/pull/659) fix failure when running with NODE_DEBUG=request, and a test for that (@jrgm)
|
||||
- [#630](https://github.com/request/request/pull/630) Send random cnonce for HTTP Digest requests (@wprl)
|
||||
- [#619](https://github.com/request/request/pull/619) decouple things a bit (@joaojeronimo)
|
||||
- [#613](https://github.com/request/request/pull/613) Fixes #583, moved initialization of self.uri.pathname (@lexander)
|
||||
- [#605](https://github.com/request/request/pull/605) Only include ":" + pass in Basic Auth if it's defined (fixes #602) (@bendrucker)
|
||||
- [#596](https://github.com/request/request/pull/596) Global agent is being used when pool is specified (@Cauldrath)
|
||||
- [#594](https://github.com/request/request/pull/594) Emit complete event when there is no callback (@RomainLK)
|
||||
- [#601](https://github.com/request/request/pull/601) Fixed a small typo (@michalstanko)
|
||||
- [#589](https://github.com/request/request/pull/589) Prevent setting headers after they are sent (@geek)
|
||||
- [#587](https://github.com/request/request/pull/587) Global cookie jar disabled by default (@threepointone)
|
||||
- [#544](https://github.com/request/request/pull/544) Update http-signature version. (@davidlehn)
|
||||
- [#581](https://github.com/request/request/pull/581) Fix spelling of "ignoring." (@bigeasy)
|
||||
- [#568](https://github.com/request/request/pull/568) use agentOptions to create agent when specified in request (@SamPlacette)
|
||||
- [#564](https://github.com/request/request/pull/564) Fix redirections (@criloz)
|
||||
- [#541](https://github.com/request/request/pull/541) The exported request function doesn't have an auth method (@tschaub)
|
||||
- [#542](https://github.com/request/request/pull/542) Expose Request class (@regality)
|
||||
- [#536](https://github.com/request/request/pull/536) Allow explicitly empty user field for basic authentication. (@mikeando)
|
||||
- [#532](https://github.com/request/request/pull/532) fix typo (@fredericosilva)
|
||||
- [#497](https://github.com/request/request/pull/497) Added redirect event (@Cauldrath)
|
||||
- [#503](https://github.com/request/request/pull/503) Fix basic auth for passwords that contain colons (@tonistiigi)
|
||||
- [#521](https://github.com/request/request/pull/521) Improving test-localAddress.js (@noway)
|
||||
- [#529](https://github.com/request/request/pull/529) dependencies versions bump (@jodaka)
|
||||
- [#523](https://github.com/request/request/pull/523) Updating dependencies (@noway)
|
||||
- [#520](https://github.com/request/request/pull/520) Fixing test-tunnel.js (@noway)
|
||||
- [#519](https://github.com/request/request/pull/519) Update internal path state on post-creation QS changes (@jblebrun)
|
||||
- [#510](https://github.com/request/request/pull/510) Add HTTP Signature support. (@davidlehn)
|
||||
- [#502](https://github.com/request/request/pull/502) Fix POST (and probably other) requests that are retried after 401 Unauthorized (@nylen)
|
||||
- [#508](https://github.com/request/request/pull/508) Honor the .strictSSL option when using proxies (tunnel-agent) (@jhs)
|
||||
- [#512](https://github.com/request/request/pull/512) Make password optional to support the format: http://username@hostname/ (@pajato1)
|
||||
- [#513](https://github.com/request/request/pull/513) add 'localAddress' support (@yyfrankyy)
|
||||
- [#498](https://github.com/request/request/pull/498) Moving response emit above setHeaders on destination streams (@kenperkins)
|
||||
- [#490](https://github.com/request/request/pull/490) Empty response body (3-rd argument) must be passed to callback as an empty string (@Olegas)
|
||||
- [#479](https://github.com/request/request/pull/479) Changing so if Accept header is explicitly set, sending json does not ov... (@RoryH)
|
||||
- [#475](https://github.com/request/request/pull/475) Use `unescape` from `querystring` (@shimaore)
|
||||
- [#473](https://github.com/request/request/pull/473) V0.10 compat (@isaacs)
|
||||
- [#471](https://github.com/request/request/pull/471) Using querystring library from visionmedia (@kbackowski)
|
||||
- [#461](https://github.com/request/request/pull/461) Strip the UTF8 BOM from a UTF encoded response (@kppullin)
|
||||
- [#460](https://github.com/request/request/pull/460) hawk 0.10.0 (@hueniverse)
|
||||
- [#462](https://github.com/request/request/pull/462) if query params are empty, then request path shouldn't end with a '?' (merges cleanly now) (@jaipandya)
|
||||
- [#456](https://github.com/request/request/pull/456) hawk 0.9.0 (@hueniverse)
|
||||
- [#429](https://github.com/request/request/pull/429) Copy options before adding callback. (@nrn, @nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki)
|
||||
- [#454](https://github.com/request/request/pull/454) Destroy the response if present when destroying the request (clean merge) (@mafintosh)
|
||||
- [#310](https://github.com/request/request/pull/310) Twitter Oauth Stuff Out of Date; Now Updated (@joemccann, @isaacs, @mscdex)
|
||||
- [#413](https://github.com/request/request/pull/413) rename googledoodle.png to .jpg (@nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki)
|
||||
- [#448](https://github.com/request/request/pull/448) Convenience method for PATCH (@mloar)
|
||||
- [#444](https://github.com/request/request/pull/444) protect against double callbacks on error path (@spollack)
|
||||
- [#433](https://github.com/request/request/pull/433) Added support for HTTPS cert & key (@mmalecki)
|
||||
- [#430](https://github.com/request/request/pull/430) Respect specified {Host,host} headers, not just {host} (@andrewschaaf)
|
||||
- [#415](https://github.com/request/request/pull/415) Fixed a typo. (@jerem)
|
||||
- [#338](https://github.com/request/request/pull/338) Add more auth options, including digest support (@nylen)
|
||||
- [#403](https://github.com/request/request/pull/403) Optimize environment lookup to happen once only (@mmalecki)
|
||||
- [#398](https://github.com/request/request/pull/398) Add more reporting to tests (@mmalecki)
|
||||
- [#388](https://github.com/request/request/pull/388) Ensure "safe" toJSON doesn't break EventEmitters (@othiym23)
|
||||
- [#381](https://github.com/request/request/pull/381) Resolving "Invalid signature. Expected signature base string: " (@landeiro)
|
||||
- [#380](https://github.com/request/request/pull/380) Fixes missing host header on retried request when using forever agent (@mac-)
|
||||
- [#376](https://github.com/request/request/pull/376) Headers lost on redirect (@kapetan)
|
||||
- [#375](https://github.com/request/request/pull/375) Fix for missing oauth_timestamp parameter (@jplock)
|
||||
- [#374](https://github.com/request/request/pull/374) Correct Host header for proxy tunnel CONNECT (@youurayy)
|
||||
- [#370](https://github.com/request/request/pull/370) Twitter reverse auth uses x_auth_mode not x_auth_type (@drudge)
|
||||
- [#369](https://github.com/request/request/pull/369) Don't remove x_auth_mode for Twitter reverse auth (@drudge)
|
||||
- [#344](https://github.com/request/request/pull/344) Make AWS auth signing find headers correctly (@nlf)
|
||||
- [#363](https://github.com/request/request/pull/363) rfc3986 on base_uri, now passes tests (@jeffmarshall)
|
||||
- [#362](https://github.com/request/request/pull/362) Running `rfc3986` on `base_uri` in `oauth.hmacsign` instead of just `encodeURIComponent` (@jeffmarshall)
|
||||
- [#361](https://github.com/request/request/pull/361) Don't create a Content-Length header if we already have it set (@danjenkins)
|
||||
- [#360](https://github.com/request/request/pull/360) Delete self._form along with everything else on redirect (@jgautier)
|
||||
- [#355](https://github.com/request/request/pull/355) stop sending erroneous headers on redirected requests (@azylman)
|
||||
- [#332](https://github.com/request/request/pull/332) Fix #296 - Only set Content-Type if body exists (@Marsup)
|
||||
- [#343](https://github.com/request/request/pull/343) Allow AWS to work in more situations, added a note in the README on its usage (@nlf)
|
||||
- [#320](https://github.com/request/request/pull/320) request.defaults() doesn't need to wrap jar() (@StuartHarris)
|
||||
- [#322](https://github.com/request/request/pull/322) Fix + test for piped into request bumped into redirect. #321 (@alexindigo)
|
||||
- [#326](https://github.com/request/request/pull/326) Do not try to remove listener from an undefined connection (@CartoDB)
|
||||
- [#318](https://github.com/request/request/pull/318) Pass servername to tunneling secure socket creation (@isaacs)
|
||||
- [#317](https://github.com/request/request/pull/317) Workaround for #313 (@isaacs)
|
||||
- [#293](https://github.com/request/request/pull/293) Allow parser errors to bubble up to request (@mscdex)
|
||||
- [#290](https://github.com/request/request/pull/290) A test for #289 (@isaacs)
|
||||
- [#280](https://github.com/request/request/pull/280) Like in node.js print options if NODE_DEBUG contains the word request (@Filirom1)
|
||||
- [#207](https://github.com/request/request/pull/207) Fix #206 Change HTTP/HTTPS agent when redirecting between protocols (@isaacs)
|
||||
- [#214](https://github.com/request/request/pull/214) documenting additional behavior of json option (@jphaas, @vpulim)
|
||||
- [#272](https://github.com/request/request/pull/272) Boundary begins with CRLF? (@elspoono, @timshadel, @naholyr, @nanodocumet, @TehShrike)
|
||||
- [#284](https://github.com/request/request/pull/284) Remove stray `console.log()` call in multipart generator. (@bcherry)
|
||||
- [#241](https://github.com/request/request/pull/241) Composability updates suggested by issue #239 (@polotek)
|
||||
- [#282](https://github.com/request/request/pull/282) OAuth Authorization header contains non-"oauth_" parameters (@jplock)
|
||||
- [#279](https://github.com/request/request/pull/279) fix tests with boundary by injecting boundry from header (@benatkin)
|
||||
- [#273](https://github.com/request/request/pull/273) Pipe back pressure issue (@mafintosh)
|
||||
- [#268](https://github.com/request/request/pull/268) I'm not OCD seriously (@TehShrike)
|
||||
- [#263](https://github.com/request/request/pull/263) Bug in OAuth key generation for sha1 (@nanodocumet)
|
||||
- [#265](https://github.com/request/request/pull/265) uncaughtException when redirected to invalid URI (@naholyr)
|
||||
- [#262](https://github.com/request/request/pull/262) JSON test should check for equality (@timshadel)
|
||||
- [#261](https://github.com/request/request/pull/261) Setting 'pool' to 'false' does NOT disable Agent pooling (@timshadel)
|
||||
- [#249](https://github.com/request/request/pull/249) Fix for the fix of your (closed) issue #89 where self.headers[content-length] is set to 0 for all methods (@sethbridges, @polotek, @zephrax, @jeromegn)
|
||||
- [#255](https://github.com/request/request/pull/255) multipart allow body === '' ( the empty string ) (@Filirom1)
|
||||
- [#260](https://github.com/request/request/pull/260) fixed just another leak of 'i' (@sreuter)
|
||||
- [#246](https://github.com/request/request/pull/246) Fixing the set-cookie header (@jeromegn)
|
||||
- [#243](https://github.com/request/request/pull/243) Dynamic boundary (@zephrax)
|
||||
- [#240](https://github.com/request/request/pull/240) don't error when null is passed for options (@polotek)
|
||||
- [#211](https://github.com/request/request/pull/211) Replace all occurrences of special chars in RFC3986 (@chriso, @vpulim)
|
||||
- [#224](https://github.com/request/request/pull/224) Multipart content-type change (@janjongboom)
|
||||
- [#217](https://github.com/request/request/pull/217) need to use Authorization (titlecase) header with Tumblr OAuth (@visnup)
|
||||
- [#203](https://github.com/request/request/pull/203) Fix cookie and redirect bugs and add auth support for HTTPS tunnel (@vpulim)
|
||||
- [#199](https://github.com/request/request/pull/199) Tunnel (@isaacs)
|
||||
- [#198](https://github.com/request/request/pull/198) Bugfix on forever usage of util.inherits (@isaacs)
|
||||
- [#197](https://github.com/request/request/pull/197) Make ForeverAgent work with HTTPS (@isaacs)
|
||||
- [#193](https://github.com/request/request/pull/193) Fixes GH-119 (@goatslacker)
|
||||
- [#188](https://github.com/request/request/pull/188) Add abort support to the returned request (@itay)
|
||||
- [#176](https://github.com/request/request/pull/176) Querystring option (@csainty)
|
||||
- [#182](https://github.com/request/request/pull/182) Fix request.defaults to support (uri, options, callback) api (@twilson63)
|
||||
- [#180](https://github.com/request/request/pull/180) Modified the post, put, head and del shortcuts to support uri optional param (@twilson63)
|
||||
- [#179](https://github.com/request/request/pull/179) fix to add opts in .pipe(stream, opts) (@substack)
|
||||
- [#177](https://github.com/request/request/pull/177) Issue #173 Support uri as first and optional config as second argument (@twilson63)
|
||||
- [#170](https://github.com/request/request/pull/170) can't create a cookie in a wrapped request (defaults) (@fabianonunes)
|
||||
- [#168](https://github.com/request/request/pull/168) Picking off an EasyFix by adding some missing mimetypes. (@serby)
|
||||
- [#161](https://github.com/request/request/pull/161) Fix cookie jar/headers.cookie collision (#125) (@papandreou)
|
||||
- [#162](https://github.com/request/request/pull/162) Fix issue #159 (@dpetukhov)
|
||||
- [#90](https://github.com/request/request/pull/90) add option followAllRedirects to follow post/put redirects (@jroes)
|
||||
- [#148](https://github.com/request/request/pull/148) Retry Agent (@thejh)
|
||||
- [#146](https://github.com/request/request/pull/146) Multipart should respect content-type if previously set (@apeace)
|
||||
- [#144](https://github.com/request/request/pull/144) added "form" option to readme (@petejkim)
|
||||
- [#133](https://github.com/request/request/pull/133) Fixed cookies parsing (@afanasy)
|
||||
- [#135](https://github.com/request/request/pull/135) host vs hostname (@iangreenleaf)
|
||||
- [#132](https://github.com/request/request/pull/132) return the body as a Buffer when encoding is set to null (@jahewson)
|
||||
- [#112](https://github.com/request/request/pull/112) Support using a custom http-like module (@jhs)
|
||||
- [#104](https://github.com/request/request/pull/104) Cookie handling contains bugs (@janjongboom)
|
||||
- [#121](https://github.com/request/request/pull/121) Another patch for cookie handling regression (@jhurliman)
|
||||
- [#117](https://github.com/request/request/pull/117) Remove the global `i` (@3rd-Eden)
|
||||
- [#110](https://github.com/request/request/pull/110) Update to Iris Couch URL (@jhs)
|
||||
- [#86](https://github.com/request/request/pull/86) Can't post binary to multipart requests (@kkaefer)
|
||||
- [#105](https://github.com/request/request/pull/105) added test for proxy option. (@dominictarr)
|
||||
- [#102](https://github.com/request/request/pull/102) Implemented cookies - closes issue 82: https://github.com/mikeal/request/issues/82 (@alessioalex)
|
||||
- [#97](https://github.com/request/request/pull/97) Typo in previous pull causes TypeError in non-0.5.11 versions (@isaacs)
|
||||
- [#96](https://github.com/request/request/pull/96) Authless parsed url host support (@isaacs)
|
||||
- [#81](https://github.com/request/request/pull/81) Enhance redirect handling (@danmactough)
|
||||
- [#78](https://github.com/request/request/pull/78) Don't try to do strictSSL for non-ssl connections (@isaacs)
|
||||
- [#76](https://github.com/request/request/pull/76) Bug when a request fails and a timeout is set (@Marsup)
|
||||
- [#70](https://github.com/request/request/pull/70) add test script to package.json (@isaacs, @aheckmann)
|
||||
- [#73](https://github.com/request/request/pull/73) Fix #71 Respect the strictSSL flag (@isaacs)
|
||||
- [#69](https://github.com/request/request/pull/69) Flatten chunked requests properly (@isaacs)
|
||||
- [#67](https://github.com/request/request/pull/67) fixed global variable leaks (@aheckmann)
|
||||
- [#66](https://github.com/request/request/pull/66) Do not overwrite established content-type headers for read stream deliver (@voodootikigod)
|
||||
- [#53](https://github.com/request/request/pull/53) Parse json: Issue #51 (@benatkin)
|
||||
- [#45](https://github.com/request/request/pull/45) Added timeout option (@mbrevoort)
|
||||
- [#35](https://github.com/request/request/pull/35) The "end" event isn't emitted for some responses (@voxpelli)
|
||||
- [#31](https://github.com/request/request/pull/31) Error on piping a request to a destination (@tobowers)
|
@ -0,0 +1,55 @@
|
||||
Apache License
|
||||
|
||||
Version 2.0, January 2004
|
||||
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
|
||||
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
|
||||
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,155 @@
|
||||
// Copyright 2010-2012 Mikeal Rogers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
'use strict'
|
||||
|
||||
var extend = require('extend')
|
||||
var cookies = require('./lib/cookies')
|
||||
var helpers = require('./lib/helpers')
|
||||
|
||||
var paramsHaveRequestBody = helpers.paramsHaveRequestBody
|
||||
|
||||
// organize params for patch, post, put, head, del
|
||||
function initParams (uri, options, callback) {
|
||||
if (typeof options === 'function') {
|
||||
callback = options
|
||||
}
|
||||
|
||||
var params = {}
|
||||
if (options !== null && typeof options === 'object') {
|
||||
extend(params, options, {uri: uri})
|
||||
} else if (typeof uri === 'string') {
|
||||
extend(params, {uri: uri})
|
||||
} else {
|
||||
extend(params, uri)
|
||||
}
|
||||
|
||||
params.callback = callback || params.callback
|
||||
return params
|
||||
}
|
||||
|
||||
function request (uri, options, callback) {
|
||||
if (typeof uri === 'undefined') {
|
||||
throw new Error('undefined is not a valid uri or options object.')
|
||||
}
|
||||
|
||||
var params = initParams(uri, options, callback)
|
||||
|
||||
if (params.method === 'HEAD' && paramsHaveRequestBody(params)) {
|
||||
throw new Error('HTTP HEAD requests MUST NOT include a request body.')
|
||||
}
|
||||
|
||||
return new request.Request(params)
|
||||
}
|
||||
|
||||
function verbFunc (verb) {
|
||||
var method = verb.toUpperCase()
|
||||
return function (uri, options, callback) {
|
||||
var params = initParams(uri, options, callback)
|
||||
params.method = method
|
||||
return request(params, params.callback)
|
||||
}
|
||||
}
|
||||
|
||||
// define like this to please codeintel/intellisense IDEs
|
||||
request.get = verbFunc('get')
|
||||
request.head = verbFunc('head')
|
||||
request.options = verbFunc('options')
|
||||
request.post = verbFunc('post')
|
||||
request.put = verbFunc('put')
|
||||
request.patch = verbFunc('patch')
|
||||
request.del = verbFunc('delete')
|
||||
request['delete'] = verbFunc('delete')
|
||||
|
||||
request.jar = function (store) {
|
||||
return cookies.jar(store)
|
||||
}
|
||||
|
||||
request.cookie = function (str) {
|
||||
return cookies.parse(str)
|
||||
}
|
||||
|
||||
function wrapRequestMethod (method, options, requester, verb) {
|
||||
return function (uri, opts, callback) {
|
||||
var params = initParams(uri, opts, callback)
|
||||
|
||||
var target = {}
|
||||
extend(true, target, options, params)
|
||||
|
||||
target.pool = params.pool || options.pool
|
||||
|
||||
if (verb) {
|
||||
target.method = verb.toUpperCase()
|
||||
}
|
||||
|
||||
if (typeof requester === 'function') {
|
||||
method = requester
|
||||
}
|
||||
|
||||
return method(target, target.callback)
|
||||
}
|
||||
}
|
||||
|
||||
request.defaults = function (options, requester) {
|
||||
var self = this
|
||||
|
||||
options = options || {}
|
||||
|
||||
if (typeof options === 'function') {
|
||||
requester = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
var defaults = wrapRequestMethod(self, options, requester)
|
||||
|
||||
var verbs = ['get', 'head', 'post', 'put', 'patch', 'del', 'delete']
|
||||
verbs.forEach(function (verb) {
|
||||
defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb)
|
||||
})
|
||||
|
||||
defaults.cookie = wrapRequestMethod(self.cookie, options, requester)
|
||||
defaults.jar = self.jar
|
||||
defaults.defaults = self.defaults
|
||||
return defaults
|
||||
}
|
||||
|
||||
request.forever = function (agentOptions, optionsArg) {
|
||||
var options = {}
|
||||
if (optionsArg) {
|
||||
extend(options, optionsArg)
|
||||
}
|
||||
if (agentOptions) {
|
||||
options.agentOptions = agentOptions
|
||||
}
|
||||
|
||||
options.forever = true
|
||||
return request.defaults(options)
|
||||
}
|
||||
|
||||
// Exports
|
||||
|
||||
module.exports = request
|
||||
request.Request = require('./request')
|
||||
request.initParams = initParams
|
||||
|
||||
// Backwards compatibility for request.debug
|
||||
Object.defineProperty(request, 'debug', {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return request.Request.debug
|
||||
},
|
||||
set: function (debug) {
|
||||
request.Request.debug = debug
|
||||
}
|
||||
})
|
@ -0,0 +1,167 @@
|
||||
'use strict'
|
||||
|
||||
var caseless = require('caseless')
|
||||
var uuid = require('uuid/v4')
|
||||
var helpers = require('./helpers')
|
||||
|
||||
var md5 = helpers.md5
|
||||
var toBase64 = helpers.toBase64
|
||||
|
||||
function Auth (request) {
|
||||
// define all public properties here
|
||||
this.request = request
|
||||
this.hasAuth = false
|
||||
this.sentAuth = false
|
||||
this.bearerToken = null
|
||||
this.user = null
|
||||
this.pass = null
|
||||
}
|
||||
|
||||
Auth.prototype.basic = function (user, pass, sendImmediately) {
|
||||
var self = this
|
||||
if (typeof user !== 'string' || (pass !== undefined && typeof pass !== 'string')) {
|
||||
self.request.emit('error', new Error('auth() received invalid user or password'))
|
||||
}
|
||||
self.user = user
|
||||
self.pass = pass
|
||||
self.hasAuth = true
|
||||
var header = user + ':' + (pass || '')
|
||||
if (sendImmediately || typeof sendImmediately === 'undefined') {
|
||||
var authHeader = 'Basic ' + toBase64(header)
|
||||
self.sentAuth = true
|
||||
return authHeader
|
||||
}
|
||||
}
|
||||
|
||||
Auth.prototype.bearer = function (bearer, sendImmediately) {
|
||||
var self = this
|
||||
self.bearerToken = bearer
|
||||
self.hasAuth = true
|
||||
if (sendImmediately || typeof sendImmediately === 'undefined') {
|
||||
if (typeof bearer === 'function') {
|
||||
bearer = bearer()
|
||||
}
|
||||
var authHeader = 'Bearer ' + (bearer || '')
|
||||
self.sentAuth = true
|
||||
return authHeader
|
||||
}
|
||||
}
|
||||
|
||||
Auth.prototype.digest = function (method, path, authHeader) {
|
||||
// TODO: More complete implementation of RFC 2617.
|
||||
// - handle challenge.domain
|
||||
// - support qop="auth-int" only
|
||||
// - handle Authentication-Info (not necessarily?)
|
||||
// - check challenge.stale (not necessarily?)
|
||||
// - increase nc (not necessarily?)
|
||||
// For reference:
|
||||
// http://tools.ietf.org/html/rfc2617#section-3
|
||||
// https://github.com/bagder/curl/blob/master/lib/http_digest.c
|
||||
|
||||
var self = this
|
||||
|
||||
var challenge = {}
|
||||
var re = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi
|
||||
while (true) {
|
||||
var match = re.exec(authHeader)
|
||||
if (!match) {
|
||||
break
|
||||
}
|
||||
challenge[match[1]] = match[2] || match[3]
|
||||
}
|
||||
|
||||
/**
|
||||
* RFC 2617: handle both MD5 and MD5-sess algorithms.
|
||||
*
|
||||
* If the algorithm directive's value is "MD5" or unspecified, then HA1 is
|
||||
* HA1=MD5(username:realm:password)
|
||||
* If the algorithm directive's value is "MD5-sess", then HA1 is
|
||||
* HA1=MD5(MD5(username:realm:password):nonce:cnonce)
|
||||
*/
|
||||
var ha1Compute = function (algorithm, user, realm, pass, nonce, cnonce) {
|
||||
var ha1 = md5(user + ':' + realm + ':' + pass)
|
||||
if (algorithm && algorithm.toLowerCase() === 'md5-sess') {
|
||||
return md5(ha1 + ':' + nonce + ':' + cnonce)
|
||||
} else {
|
||||
return ha1
|
||||
}
|
||||
}
|
||||
|
||||
var qop = /(^|,)\s*auth\s*($|,)/.test(challenge.qop) && 'auth'
|
||||
var nc = qop && '00000001'
|
||||
var cnonce = qop && uuid().replace(/-/g, '')
|
||||
var ha1 = ha1Compute(challenge.algorithm, self.user, challenge.realm, self.pass, challenge.nonce, cnonce)
|
||||
var ha2 = md5(method + ':' + path)
|
||||
var digestResponse = qop
|
||||
? md5(ha1 + ':' + challenge.nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2)
|
||||
: md5(ha1 + ':' + challenge.nonce + ':' + ha2)
|
||||
var authValues = {
|
||||
username: self.user,
|
||||
realm: challenge.realm,
|
||||
nonce: challenge.nonce,
|
||||
uri: path,
|
||||
qop: qop,
|
||||
response: digestResponse,
|
||||
nc: nc,
|
||||
cnonce: cnonce,
|
||||
algorithm: challenge.algorithm,
|
||||
opaque: challenge.opaque
|
||||
}
|
||||
|
||||
authHeader = []
|
||||
for (var k in authValues) {
|
||||
if (authValues[k]) {
|
||||
if (k === 'qop' || k === 'nc' || k === 'algorithm') {
|
||||
authHeader.push(k + '=' + authValues[k])
|
||||
} else {
|
||||
authHeader.push(k + '="' + authValues[k] + '"')
|
||||
}
|
||||
}
|
||||
}
|
||||
authHeader = 'Digest ' + authHeader.join(', ')
|
||||
self.sentAuth = true
|
||||
return authHeader
|
||||
}
|
||||
|
||||
Auth.prototype.onRequest = function (user, pass, sendImmediately, bearer) {
|
||||
var self = this
|
||||
var request = self.request
|
||||
|
||||
var authHeader
|
||||
if (bearer === undefined && user === undefined) {
|
||||
self.request.emit('error', new Error('no auth mechanism defined'))
|
||||
} else if (bearer !== undefined) {
|
||||
authHeader = self.bearer(bearer, sendImmediately)
|
||||
} else {
|
||||
authHeader = self.basic(user, pass, sendImmediately)
|
||||
}
|
||||
if (authHeader) {
|
||||
request.setHeader('authorization', authHeader)
|
||||
}
|
||||
}
|
||||
|
||||
Auth.prototype.onResponse = function (response) {
|
||||
var self = this
|
||||
var request = self.request
|
||||
|
||||
if (!self.hasAuth || self.sentAuth) { return null }
|
||||
|
||||
var c = caseless(response.headers)
|
||||
|
||||
var authHeader = c.get('www-authenticate')
|
||||
var authVerb = authHeader && authHeader.split(' ')[0].toLowerCase()
|
||||
request.debug('reauth', authVerb)
|
||||
|
||||
switch (authVerb) {
|
||||
case 'basic':
|
||||
return self.basic(self.user, self.pass, true)
|
||||
|
||||
case 'bearer':
|
||||
return self.bearer(self.bearerToken, true)
|
||||
|
||||
case 'digest':
|
||||
return self.digest(request.method, request.path, authHeader)
|
||||
}
|
||||
}
|
||||
|
||||
exports.Auth = Auth
|
@ -0,0 +1,38 @@
|
||||
'use strict'
|
||||
|
||||
var tough = require('tough-cookie')
|
||||
|
||||
var Cookie = tough.Cookie
|
||||
var CookieJar = tough.CookieJar
|
||||
|
||||
exports.parse = function (str) {
|
||||
if (str && str.uri) {
|
||||
str = str.uri
|
||||
}
|
||||
if (typeof str !== 'string') {
|
||||
throw new Error('The cookie function only accepts STRING as param')
|
||||
}
|
||||
return Cookie.parse(str, {loose: true})
|
||||
}
|
||||
|
||||
// Adapt the sometimes-Async api of tough.CookieJar to our requirements
|
||||
function RequestJar (store) {
|
||||
var self = this
|
||||
self._jar = new CookieJar(store, {looseMode: true})
|
||||
}
|
||||
RequestJar.prototype.setCookie = function (cookieOrStr, uri, options) {
|
||||
var self = this
|
||||
return self._jar.setCookieSync(cookieOrStr, uri, options || {})
|
||||
}
|
||||
RequestJar.prototype.getCookieString = function (uri) {
|
||||
var self = this
|
||||
return self._jar.getCookieStringSync(uri)
|
||||
}
|
||||
RequestJar.prototype.getCookies = function (uri) {
|
||||
var self = this
|
||||
return self._jar.getCookiesSync(uri)
|
||||
}
|
||||
|
||||
exports.jar = function (store) {
|
||||
return new RequestJar(store)
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
'use strict'
|
||||
|
||||
function formatHostname (hostname) {
|
||||
// canonicalize the hostname, so that 'oogle.com' won't match 'google.com'
|
||||
return hostname.replace(/^\.*/, '.').toLowerCase()
|
||||
}
|
||||
|
||||
function parseNoProxyZone (zone) {
|
||||
zone = zone.trim().toLowerCase()
|
||||
|
||||
var zoneParts = zone.split(':', 2)
|
||||
var zoneHost = formatHostname(zoneParts[0])
|
||||
var zonePort = zoneParts[1]
|
||||
var hasPort = zone.indexOf(':') > -1
|
||||
|
||||
return {hostname: zoneHost, port: zonePort, hasPort: hasPort}
|
||||
}
|
||||
|
||||
function uriInNoProxy (uri, noProxy) {
|
||||
var port = uri.port || (uri.protocol === 'https:' ? '443' : '80')
|
||||
var hostname = formatHostname(uri.hostname)
|
||||
var noProxyList = noProxy.split(',')
|
||||
|
||||
// iterate through the noProxyList until it finds a match.
|
||||
return noProxyList.map(parseNoProxyZone).some(function (noProxyZone) {
|
||||
var isMatchedAt = hostname.indexOf(noProxyZone.hostname)
|
||||
var hostnameMatched = (
|
||||
isMatchedAt > -1 &&
|
||||
(isMatchedAt === hostname.length - noProxyZone.hostname.length)
|
||||
)
|
||||
|
||||
if (noProxyZone.hasPort) {
|
||||
return (port === noProxyZone.port) && hostnameMatched
|
||||
}
|
||||
|
||||
return hostnameMatched
|
||||
})
|
||||
}
|
||||
|
||||
function getProxyFromURI (uri) {
|
||||
// Decide the proper request proxy to use based on the request URI object and the
|
||||
// environmental variables (NO_PROXY, HTTP_PROXY, etc.)
|
||||
// respect NO_PROXY environment variables (see: https://lynx.invisible-island.net/lynx2.8.7/breakout/lynx_help/keystrokes/environments.html)
|
||||
|
||||
var noProxy = process.env.NO_PROXY || process.env.no_proxy || ''
|
||||
|
||||
// if the noProxy is a wildcard then return null
|
||||
|
||||
if (noProxy === '*') {
|
||||
return null
|
||||
}
|
||||
|
||||
// if the noProxy is not empty and the uri is found return null
|
||||
|
||||
if (noProxy !== '' && uriInNoProxy(uri, noProxy)) {
|
||||
return null
|
||||
}
|
||||
|
||||
// Check for HTTP or HTTPS Proxy in environment Else default to null
|
||||
|
||||
if (uri.protocol === 'http:') {
|
||||
return process.env.HTTP_PROXY ||
|
||||
process.env.http_proxy || null
|
||||
}
|
||||
|
||||
if (uri.protocol === 'https:') {
|
||||
return process.env.HTTPS_PROXY ||
|
||||
process.env.https_proxy ||
|
||||
process.env.HTTP_PROXY ||
|
||||
process.env.http_proxy || null
|
||||
}
|
||||
|
||||
// if none of that works, return null
|
||||
// (What uri protocol are you using then?)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
module.exports = getProxyFromURI
|
@ -0,0 +1,205 @@
|
||||
'use strict'
|
||||
|
||||
var fs = require('fs')
|
||||
var qs = require('querystring')
|
||||
var validate = require('har-validator')
|
||||
var extend = require('extend')
|
||||
|
||||
function Har (request) {
|
||||
this.request = request
|
||||
}
|
||||
|
||||
Har.prototype.reducer = function (obj, pair) {
|
||||
// new property ?
|
||||
if (obj[pair.name] === undefined) {
|
||||
obj[pair.name] = pair.value
|
||||
return obj
|
||||
}
|
||||
|
||||
// existing? convert to array
|
||||
var arr = [
|
||||
obj[pair.name],
|
||||
pair.value
|
||||
]
|
||||
|
||||
obj[pair.name] = arr
|
||||
|
||||
return obj
|
||||
}
|
||||
|
||||
Har.prototype.prep = function (data) {
|
||||
// construct utility properties
|
||||
data.queryObj = {}
|
||||
data.headersObj = {}
|
||||
data.postData.jsonObj = false
|
||||
data.postData.paramsObj = false
|
||||
|
||||
// construct query objects
|
||||
if (data.queryString && data.queryString.length) {
|
||||
data.queryObj = data.queryString.reduce(this.reducer, {})
|
||||
}
|
||||
|
||||
// construct headers objects
|
||||
if (data.headers && data.headers.length) {
|
||||
// loweCase header keys
|
||||
data.headersObj = data.headers.reduceRight(function (headers, header) {
|
||||
headers[header.name] = header.value
|
||||
return headers
|
||||
}, {})
|
||||
}
|
||||
|
||||
// construct Cookie header
|
||||
if (data.cookies && data.cookies.length) {
|
||||
var cookies = data.cookies.map(function (cookie) {
|
||||
return cookie.name + '=' + cookie.value
|
||||
})
|
||||
|
||||
if (cookies.length) {
|
||||
data.headersObj.cookie = cookies.join('; ')
|
||||
}
|
||||
}
|
||||
|
||||
// prep body
|
||||
function some (arr) {
|
||||
return arr.some(function (type) {
|
||||
return data.postData.mimeType.indexOf(type) === 0
|
||||
})
|
||||
}
|
||||
|
||||
if (some([
|
||||
'multipart/mixed',
|
||||
'multipart/related',
|
||||
'multipart/form-data',
|
||||
'multipart/alternative'])) {
|
||||
// reset values
|
||||
data.postData.mimeType = 'multipart/form-data'
|
||||
} else if (some([
|
||||
'application/x-www-form-urlencoded'])) {
|
||||
if (!data.postData.params) {
|
||||
data.postData.text = ''
|
||||
} else {
|
||||
data.postData.paramsObj = data.postData.params.reduce(this.reducer, {})
|
||||
|
||||
// always overwrite
|
||||
data.postData.text = qs.stringify(data.postData.paramsObj)
|
||||
}
|
||||
} else if (some([
|
||||
'text/json',
|
||||
'text/x-json',
|
||||
'application/json',
|
||||
'application/x-json'])) {
|
||||
data.postData.mimeType = 'application/json'
|
||||
|
||||
if (data.postData.text) {
|
||||
try {
|
||||
data.postData.jsonObj = JSON.parse(data.postData.text)
|
||||
} catch (e) {
|
||||
this.request.debug(e)
|
||||
|
||||
// force back to text/plain
|
||||
data.postData.mimeType = 'text/plain'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
Har.prototype.options = function (options) {
|
||||
// skip if no har property defined
|
||||
if (!options.har) {
|
||||
return options
|
||||
}
|
||||
|
||||
var har = {}
|
||||
extend(har, options.har)
|
||||
|
||||
// only process the first entry
|
||||
if (har.log && har.log.entries) {
|
||||
har = har.log.entries[0]
|
||||
}
|
||||
|
||||
// add optional properties to make validation successful
|
||||
har.url = har.url || options.url || options.uri || options.baseUrl || '/'
|
||||
har.httpVersion = har.httpVersion || 'HTTP/1.1'
|
||||
har.queryString = har.queryString || []
|
||||
har.headers = har.headers || []
|
||||
har.cookies = har.cookies || []
|
||||
har.postData = har.postData || {}
|
||||
har.postData.mimeType = har.postData.mimeType || 'application/octet-stream'
|
||||
|
||||
har.bodySize = 0
|
||||
har.headersSize = 0
|
||||
har.postData.size = 0
|
||||
|
||||
if (!validate.request(har)) {
|
||||
return options
|
||||
}
|
||||
|
||||
// clean up and get some utility properties
|
||||
var req = this.prep(har)
|
||||
|
||||
// construct new options
|
||||
if (req.url) {
|
||||
options.url = req.url
|
||||
}
|
||||
|
||||
if (req.method) {
|
||||
options.method = req.method
|
||||
}
|
||||
|
||||
if (Object.keys(req.queryObj).length) {
|
||||
options.qs = req.queryObj
|
||||
}
|
||||
|
||||
if (Object.keys(req.headersObj).length) {
|
||||
options.headers = req.headersObj
|
||||
}
|
||||
|
||||
function test (type) {
|
||||
return req.postData.mimeType.indexOf(type) === 0
|
||||
}
|
||||
if (test('application/x-www-form-urlencoded')) {
|
||||
options.form = req.postData.paramsObj
|
||||
} else if (test('application/json')) {
|
||||
if (req.postData.jsonObj) {
|
||||
options.body = req.postData.jsonObj
|
||||
options.json = true
|
||||
}
|
||||
} else if (test('multipart/form-data')) {
|
||||
options.formData = {}
|
||||
|
||||
req.postData.params.forEach(function (param) {
|
||||
var attachment = {}
|
||||
|
||||
if (!param.fileName && !param.contentType) {
|
||||
options.formData[param.name] = param.value
|
||||
return
|
||||
}
|
||||
|
||||
// attempt to read from disk!
|
||||
if (param.fileName && !param.value) {
|
||||
attachment.value = fs.createReadStream(param.fileName)
|
||||
} else if (param.value) {
|
||||
attachment.value = param.value
|
||||
}
|
||||
|
||||
if (param.fileName) {
|
||||
attachment.options = {
|
||||
filename: param.fileName,
|
||||
contentType: param.contentType ? param.contentType : null
|
||||
}
|
||||
}
|
||||
|
||||
options.formData[param.name] = attachment
|
||||
})
|
||||
} else {
|
||||
if (req.postData.text) {
|
||||
options.body = req.postData.text
|
||||
}
|
||||
}
|
||||
|
||||
return options
|
||||
}
|
||||
|
||||
exports.Har = Har
|
@ -0,0 +1,89 @@
|
||||
'use strict'
|
||||
|
||||
var crypto = require('crypto')
|
||||
|
||||
function randomString (size) {
|
||||
var bits = (size + 1) * 6
|
||||
var buffer = crypto.randomBytes(Math.ceil(bits / 8))
|
||||
var string = buffer.toString('base64').replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '')
|
||||
return string.slice(0, size)
|
||||
}
|
||||
|
||||
function calculatePayloadHash (payload, algorithm, contentType) {
|
||||
var hash = crypto.createHash(algorithm)
|
||||
hash.update('hawk.1.payload\n')
|
||||
hash.update((contentType ? contentType.split(';')[0].trim().toLowerCase() : '') + '\n')
|
||||
hash.update(payload || '')
|
||||
hash.update('\n')
|
||||
return hash.digest('base64')
|
||||
}
|
||||
|
||||
exports.calculateMac = function (credentials, opts) {
|
||||
var normalized = 'hawk.1.header\n' +
|
||||
opts.ts + '\n' +
|
||||
opts.nonce + '\n' +
|
||||
(opts.method || '').toUpperCase() + '\n' +
|
||||
opts.resource + '\n' +
|
||||
opts.host.toLowerCase() + '\n' +
|
||||
opts.port + '\n' +
|
||||
(opts.hash || '') + '\n'
|
||||
|
||||
if (opts.ext) {
|
||||
normalized = normalized + opts.ext.replace('\\', '\\\\').replace('\n', '\\n')
|
||||
}
|
||||
|
||||
normalized = normalized + '\n'
|
||||
|
||||
if (opts.app) {
|
||||
normalized = normalized + opts.app + '\n' + (opts.dlg || '') + '\n'
|
||||
}
|
||||
|
||||
var hmac = crypto.createHmac(credentials.algorithm, credentials.key).update(normalized)
|
||||
var digest = hmac.digest('base64')
|
||||
return digest
|
||||
}
|
||||
|
||||
exports.header = function (uri, method, opts) {
|
||||
var timestamp = opts.timestamp || Math.floor((Date.now() + (opts.localtimeOffsetMsec || 0)) / 1000)
|
||||
var credentials = opts.credentials
|
||||
if (!credentials || !credentials.id || !credentials.key || !credentials.algorithm) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (['sha1', 'sha256'].indexOf(credentials.algorithm) === -1) {
|
||||
return ''
|
||||
}
|
||||
|
||||
var artifacts = {
|
||||
ts: timestamp,
|
||||
nonce: opts.nonce || randomString(6),
|
||||
method: method,
|
||||
resource: uri.pathname + (uri.search || ''),
|
||||
host: uri.hostname,
|
||||
port: uri.port || (uri.protocol === 'http:' ? 80 : 443),
|
||||
hash: opts.hash,
|
||||
ext: opts.ext,
|
||||
app: opts.app,
|
||||
dlg: opts.dlg
|
||||
}
|
||||
|
||||
if (!artifacts.hash && (opts.payload || opts.payload === '')) {
|
||||
artifacts.hash = calculatePayloadHash(opts.payload, credentials.algorithm, opts.contentType)
|
||||
}
|
||||
|
||||
var mac = exports.calculateMac(credentials, artifacts)
|
||||
|
||||
var hasExt = artifacts.ext !== null && artifacts.ext !== undefined && artifacts.ext !== ''
|
||||
var header = 'Hawk id="' + credentials.id +
|
||||
'", ts="' + artifacts.ts +
|
||||
'", nonce="' + artifacts.nonce +
|
||||
(artifacts.hash ? '", hash="' + artifacts.hash : '') +
|
||||
(hasExt ? '", ext="' + artifacts.ext.replace(/\\/g, '\\\\').replace(/"/g, '\\"') : '') +
|
||||
'", mac="' + mac + '"'
|
||||
|
||||
if (artifacts.app) {
|
||||
header = header + ', app="' + artifacts.app + (artifacts.dlg ? '", dlg="' + artifacts.dlg : '') + '"'
|
||||
}
|
||||
|
||||
return header
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
'use strict'
|
||||
|
||||
var jsonSafeStringify = require('json-stringify-safe')
|
||||
var crypto = require('crypto')
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
|
||||
var defer = typeof setImmediate === 'undefined'
|
||||
? process.nextTick
|
||||
: setImmediate
|
||||
|
||||
function paramsHaveRequestBody (params) {
|
||||
return (
|
||||
params.body ||
|
||||
params.requestBodyStream ||
|
||||
(params.json && typeof params.json !== 'boolean') ||
|
||||
params.multipart
|
||||
)
|
||||
}
|
||||
|
||||
function safeStringify (obj, replacer) {
|
||||
var ret
|
||||
try {
|
||||
ret = JSON.stringify(obj, replacer)
|
||||
} catch (e) {
|
||||
ret = jsonSafeStringify(obj, replacer)
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
function md5 (str) {
|
||||
return crypto.createHash('md5').update(str).digest('hex')
|
||||
}
|
||||
|
||||
function isReadStream (rs) {
|
||||
return rs.readable && rs.path && rs.mode
|
||||
}
|
||||
|
||||
function toBase64 (str) {
|
||||
return Buffer.from(str || '', 'utf8').toString('base64')
|
||||
}
|
||||
|
||||
function copy (obj) {
|
||||
var o = {}
|
||||
Object.keys(obj).forEach(function (i) {
|
||||
o[i] = obj[i]
|
||||
})
|
||||
return o
|
||||
}
|
||||
|
||||
function version () {
|
||||
var numbers = process.version.replace('v', '').split('.')
|
||||
return {
|
||||
major: parseInt(numbers[0], 10),
|
||||
minor: parseInt(numbers[1], 10),
|
||||
patch: parseInt(numbers[2], 10)
|
||||
}
|
||||
}
|
||||
|
||||
exports.paramsHaveRequestBody = paramsHaveRequestBody
|
||||
exports.safeStringify = safeStringify
|
||||
exports.md5 = md5
|
||||
exports.isReadStream = isReadStream
|
||||
exports.toBase64 = toBase64
|
||||
exports.copy = copy
|
||||
exports.version = version
|
||||
exports.defer = defer
|
@ -0,0 +1,112 @@
|
||||
'use strict'
|
||||
|
||||
var uuid = require('uuid/v4')
|
||||
var CombinedStream = require('combined-stream')
|
||||
var isstream = require('isstream')
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
|
||||
function Multipart (request) {
|
||||
this.request = request
|
||||
this.boundary = uuid()
|
||||
this.chunked = false
|
||||
this.body = null
|
||||
}
|
||||
|
||||
Multipart.prototype.isChunked = function (options) {
|
||||
var self = this
|
||||
var chunked = false
|
||||
var parts = options.data || options
|
||||
|
||||
if (!parts.forEach) {
|
||||
self.request.emit('error', new Error('Argument error, options.multipart.'))
|
||||
}
|
||||
|
||||
if (options.chunked !== undefined) {
|
||||
chunked = options.chunked
|
||||
}
|
||||
|
||||
if (self.request.getHeader('transfer-encoding') === 'chunked') {
|
||||
chunked = true
|
||||
}
|
||||
|
||||
if (!chunked) {
|
||||
parts.forEach(function (part) {
|
||||
if (typeof part.body === 'undefined') {
|
||||
self.request.emit('error', new Error('Body attribute missing in multipart.'))
|
||||
}
|
||||
if (isstream(part.body)) {
|
||||
chunked = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return chunked
|
||||
}
|
||||
|
||||
Multipart.prototype.setHeaders = function (chunked) {
|
||||
var self = this
|
||||
|
||||
if (chunked && !self.request.hasHeader('transfer-encoding')) {
|
||||
self.request.setHeader('transfer-encoding', 'chunked')
|
||||
}
|
||||
|
||||
var header = self.request.getHeader('content-type')
|
||||
|
||||
if (!header || header.indexOf('multipart') === -1) {
|
||||
self.request.setHeader('content-type', 'multipart/related; boundary=' + self.boundary)
|
||||
} else {
|
||||
if (header.indexOf('boundary') !== -1) {
|
||||
self.boundary = header.replace(/.*boundary=([^\s;]+).*/, '$1')
|
||||
} else {
|
||||
self.request.setHeader('content-type', header + '; boundary=' + self.boundary)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Multipart.prototype.build = function (parts, chunked) {
|
||||
var self = this
|
||||
var body = chunked ? new CombinedStream() : []
|
||||
|
||||
function add (part) {
|
||||
if (typeof part === 'number') {
|
||||
part = part.toString()
|
||||
}
|
||||
return chunked ? body.append(part) : body.push(Buffer.from(part))
|
||||
}
|
||||
|
||||
if (self.request.preambleCRLF) {
|
||||
add('\r\n')
|
||||
}
|
||||
|
||||
parts.forEach(function (part) {
|
||||
var preamble = '--' + self.boundary + '\r\n'
|
||||
Object.keys(part).forEach(function (key) {
|
||||
if (key === 'body') { return }
|
||||
preamble += key + ': ' + part[key] + '\r\n'
|
||||
})
|
||||
preamble += '\r\n'
|
||||
add(preamble)
|
||||
add(part.body)
|
||||
add('\r\n')
|
||||
})
|
||||
add('--' + self.boundary + '--')
|
||||
|
||||
if (self.request.postambleCRLF) {
|
||||
add('\r\n')
|
||||
}
|
||||
|
||||
return body
|
||||
}
|
||||
|
||||
Multipart.prototype.onRequest = function (options) {
|
||||
var self = this
|
||||
|
||||
var chunked = self.isChunked(options)
|
||||
var parts = options.data || options
|
||||
|
||||
self.setHeaders(chunked)
|
||||
self.chunked = chunked
|
||||
self.body = self.build(parts, chunked)
|
||||
}
|
||||
|
||||
exports.Multipart = Multipart
|
@ -0,0 +1,148 @@
|
||||
'use strict'
|
||||
|
||||
var url = require('url')
|
||||
var qs = require('qs')
|
||||
var caseless = require('caseless')
|
||||
var uuid = require('uuid/v4')
|
||||
var oauth = require('oauth-sign')
|
||||
var crypto = require('crypto')
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
|
||||
function OAuth (request) {
|
||||
this.request = request
|
||||
this.params = null
|
||||
}
|
||||
|
||||
OAuth.prototype.buildParams = function (_oauth, uri, method, query, form, qsLib) {
|
||||
var oa = {}
|
||||
for (var i in _oauth) {
|
||||
oa['oauth_' + i] = _oauth[i]
|
||||
}
|
||||
if (!oa.oauth_version) {
|
||||
oa.oauth_version = '1.0'
|
||||
}
|
||||
if (!oa.oauth_timestamp) {
|
||||
oa.oauth_timestamp = Math.floor(Date.now() / 1000).toString()
|
||||
}
|
||||
if (!oa.oauth_nonce) {
|
||||
oa.oauth_nonce = uuid().replace(/-/g, '')
|
||||
}
|
||||
if (!oa.oauth_signature_method) {
|
||||
oa.oauth_signature_method = 'HMAC-SHA1'
|
||||
}
|
||||
|
||||
var consumer_secret_or_private_key = oa.oauth_consumer_secret || oa.oauth_private_key // eslint-disable-line camelcase
|
||||
delete oa.oauth_consumer_secret
|
||||
delete oa.oauth_private_key
|
||||
|
||||
var token_secret = oa.oauth_token_secret // eslint-disable-line camelcase
|
||||
delete oa.oauth_token_secret
|
||||
|
||||
var realm = oa.oauth_realm
|
||||
delete oa.oauth_realm
|
||||
delete oa.oauth_transport_method
|
||||
|
||||
var baseurl = uri.protocol + '//' + uri.host + uri.pathname
|
||||
var params = qsLib.parse([].concat(query, form, qsLib.stringify(oa)).join('&'))
|
||||
|
||||
oa.oauth_signature = oauth.sign(
|
||||
oa.oauth_signature_method,
|
||||
method,
|
||||
baseurl,
|
||||
params,
|
||||
consumer_secret_or_private_key, // eslint-disable-line camelcase
|
||||
token_secret // eslint-disable-line camelcase
|
||||
)
|
||||
|
||||
if (realm) {
|
||||
oa.realm = realm
|
||||
}
|
||||
|
||||
return oa
|
||||
}
|
||||
|
||||
OAuth.prototype.buildBodyHash = function (_oauth, body) {
|
||||
if (['HMAC-SHA1', 'RSA-SHA1'].indexOf(_oauth.signature_method || 'HMAC-SHA1') < 0) {
|
||||
this.request.emit('error', new Error('oauth: ' + _oauth.signature_method +
|
||||
' signature_method not supported with body_hash signing.'))
|
||||
}
|
||||
|
||||
var shasum = crypto.createHash('sha1')
|
||||
shasum.update(body || '')
|
||||
var sha1 = shasum.digest('hex')
|
||||
|
||||
return Buffer.from(sha1, 'hex').toString('base64')
|
||||
}
|
||||
|
||||
OAuth.prototype.concatParams = function (oa, sep, wrap) {
|
||||
wrap = wrap || ''
|
||||
|
||||
var params = Object.keys(oa).filter(function (i) {
|
||||
return i !== 'realm' && i !== 'oauth_signature'
|
||||
}).sort()
|
||||
|
||||
if (oa.realm) {
|
||||
params.splice(0, 0, 'realm')
|
||||
}
|
||||
params.push('oauth_signature')
|
||||
|
||||
return params.map(function (i) {
|
||||
return i + '=' + wrap + oauth.rfc3986(oa[i]) + wrap
|
||||
}).join(sep)
|
||||
}
|
||||
|
||||
OAuth.prototype.onRequest = function (_oauth) {
|
||||
var self = this
|
||||
self.params = _oauth
|
||||
|
||||
var uri = self.request.uri || {}
|
||||
var method = self.request.method || ''
|
||||
var headers = caseless(self.request.headers)
|
||||
var body = self.request.body || ''
|
||||
var qsLib = self.request.qsLib || qs
|
||||
|
||||
var form
|
||||
var query
|
||||
var contentType = headers.get('content-type') || ''
|
||||
var formContentType = 'application/x-www-form-urlencoded'
|
||||
var transport = _oauth.transport_method || 'header'
|
||||
|
||||
if (contentType.slice(0, formContentType.length) === formContentType) {
|
||||
contentType = formContentType
|
||||
form = body
|
||||
}
|
||||
if (uri.query) {
|
||||
query = uri.query
|
||||
}
|
||||
if (transport === 'body' && (method !== 'POST' || contentType !== formContentType)) {
|
||||
self.request.emit('error', new Error('oauth: transport_method of body requires POST ' +
|
||||
'and content-type ' + formContentType))
|
||||
}
|
||||
|
||||
if (!form && typeof _oauth.body_hash === 'boolean') {
|
||||
_oauth.body_hash = self.buildBodyHash(_oauth, self.request.body.toString())
|
||||
}
|
||||
|
||||
var oa = self.buildParams(_oauth, uri, method, query, form, qsLib)
|
||||
|
||||
switch (transport) {
|
||||
case 'header':
|
||||
self.request.setHeader('Authorization', 'OAuth ' + self.concatParams(oa, ',', '"'))
|
||||
break
|
||||
|
||||
case 'query':
|
||||
var href = self.request.uri.href += (query ? '&' : '?') + self.concatParams(oa, '&')
|
||||
self.request.uri = url.parse(href)
|
||||
self.request.path = self.request.uri.path
|
||||
break
|
||||
|
||||
case 'body':
|
||||
self.request.body = (form ? form + '&' : '') + self.concatParams(oa, '&')
|
||||
break
|
||||
|
||||
default:
|
||||
self.request.emit('error', new Error('oauth: transport_method invalid'))
|
||||
}
|
||||
}
|
||||
|
||||
exports.OAuth = OAuth
|
@ -0,0 +1,50 @@
|
||||
'use strict'
|
||||
|
||||
var qs = require('qs')
|
||||
var querystring = require('querystring')
|
||||
|
||||
function Querystring (request) {
|
||||
this.request = request
|
||||
this.lib = null
|
||||
this.useQuerystring = null
|
||||
this.parseOptions = null
|
||||
this.stringifyOptions = null
|
||||
}
|
||||
|
||||
Querystring.prototype.init = function (options) {
|
||||
if (this.lib) { return }
|
||||
|
||||
this.useQuerystring = options.useQuerystring
|
||||
this.lib = (this.useQuerystring ? querystring : qs)
|
||||
|
||||
this.parseOptions = options.qsParseOptions || {}
|
||||
this.stringifyOptions = options.qsStringifyOptions || {}
|
||||
}
|
||||
|
||||
Querystring.prototype.stringify = function (obj) {
|
||||
return (this.useQuerystring)
|
||||
? this.rfc3986(this.lib.stringify(obj,
|
||||
this.stringifyOptions.sep || null,
|
||||
this.stringifyOptions.eq || null,
|
||||
this.stringifyOptions))
|
||||
: this.lib.stringify(obj, this.stringifyOptions)
|
||||
}
|
||||
|
||||
Querystring.prototype.parse = function (str) {
|
||||
return (this.useQuerystring)
|
||||
? this.lib.parse(str,
|
||||
this.parseOptions.sep || null,
|
||||
this.parseOptions.eq || null,
|
||||
this.parseOptions)
|
||||
: this.lib.parse(str, this.parseOptions)
|
||||
}
|
||||
|
||||
Querystring.prototype.rfc3986 = function (str) {
|
||||
return str.replace(/[!'()*]/g, function (c) {
|
||||
return '%' + c.charCodeAt(0).toString(16).toUpperCase()
|
||||
})
|
||||
}
|
||||
|
||||
Querystring.prototype.unescape = querystring.unescape
|
||||
|
||||
exports.Querystring = Querystring
|
@ -0,0 +1,154 @@
|
||||
'use strict'
|
||||
|
||||
var url = require('url')
|
||||
var isUrl = /^https?:/
|
||||
|
||||
function Redirect (request) {
|
||||
this.request = request
|
||||
this.followRedirect = true
|
||||
this.followRedirects = true
|
||||
this.followAllRedirects = false
|
||||
this.followOriginalHttpMethod = false
|
||||
this.allowRedirect = function () { return true }
|
||||
this.maxRedirects = 10
|
||||
this.redirects = []
|
||||
this.redirectsFollowed = 0
|
||||
this.removeRefererHeader = false
|
||||
}
|
||||
|
||||
Redirect.prototype.onRequest = function (options) {
|
||||
var self = this
|
||||
|
||||
if (options.maxRedirects !== undefined) {
|
||||
self.maxRedirects = options.maxRedirects
|
||||
}
|
||||
if (typeof options.followRedirect === 'function') {
|
||||
self.allowRedirect = options.followRedirect
|
||||
}
|
||||
if (options.followRedirect !== undefined) {
|
||||
self.followRedirects = !!options.followRedirect
|
||||
}
|
||||
if (options.followAllRedirects !== undefined) {
|
||||
self.followAllRedirects = options.followAllRedirects
|
||||
}
|
||||
if (self.followRedirects || self.followAllRedirects) {
|
||||
self.redirects = self.redirects || []
|
||||
}
|
||||
if (options.removeRefererHeader !== undefined) {
|
||||
self.removeRefererHeader = options.removeRefererHeader
|
||||
}
|
||||
if (options.followOriginalHttpMethod !== undefined) {
|
||||
self.followOriginalHttpMethod = options.followOriginalHttpMethod
|
||||
}
|
||||
}
|
||||
|
||||
Redirect.prototype.redirectTo = function (response) {
|
||||
var self = this
|
||||
var request = self.request
|
||||
|
||||
var redirectTo = null
|
||||
if (response.statusCode >= 300 && response.statusCode < 400 && response.caseless.has('location')) {
|
||||
var location = response.caseless.get('location')
|
||||
request.debug('redirect', location)
|
||||
|
||||
if (self.followAllRedirects) {
|
||||
redirectTo = location
|
||||
} else if (self.followRedirects) {
|
||||
switch (request.method) {
|
||||
case 'PATCH':
|
||||
case 'PUT':
|
||||
case 'POST':
|
||||
case 'DELETE':
|
||||
// Do not follow redirects
|
||||
break
|
||||
default:
|
||||
redirectTo = location
|
||||
break
|
||||
}
|
||||
}
|
||||
} else if (response.statusCode === 401) {
|
||||
var authHeader = request._auth.onResponse(response)
|
||||
if (authHeader) {
|
||||
request.setHeader('authorization', authHeader)
|
||||
redirectTo = request.uri
|
||||
}
|
||||
}
|
||||
return redirectTo
|
||||
}
|
||||
|
||||
Redirect.prototype.onResponse = function (response) {
|
||||
var self = this
|
||||
var request = self.request
|
||||
|
||||
var redirectTo = self.redirectTo(response)
|
||||
if (!redirectTo || !self.allowRedirect.call(request, response)) {
|
||||
return false
|
||||
}
|
||||
|
||||
request.debug('redirect to', redirectTo)
|
||||
|
||||
// ignore any potential response body. it cannot possibly be useful
|
||||
// to us at this point.
|
||||
// response.resume should be defined, but check anyway before calling. Workaround for browserify.
|
||||
if (response.resume) {
|
||||
response.resume()
|
||||
}
|
||||
|
||||
if (self.redirectsFollowed >= self.maxRedirects) {
|
||||
request.emit('error', new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + request.uri.href))
|
||||
return false
|
||||
}
|
||||
self.redirectsFollowed += 1
|
||||
|
||||
if (!isUrl.test(redirectTo)) {
|
||||
redirectTo = url.resolve(request.uri.href, redirectTo)
|
||||
}
|
||||
|
||||
var uriPrev = request.uri
|
||||
request.uri = url.parse(redirectTo)
|
||||
|
||||
// handle the case where we change protocol from https to http or vice versa
|
||||
if (request.uri.protocol !== uriPrev.protocol) {
|
||||
delete request.agent
|
||||
}
|
||||
|
||||
self.redirects.push({ statusCode: response.statusCode, redirectUri: redirectTo })
|
||||
|
||||
if (self.followAllRedirects && request.method !== 'HEAD' &&
|
||||
response.statusCode !== 401 && response.statusCode !== 307) {
|
||||
request.method = self.followOriginalHttpMethod ? request.method : 'GET'
|
||||
}
|
||||
// request.method = 'GET' // Force all redirects to use GET || commented out fixes #215
|
||||
delete request.src
|
||||
delete request.req
|
||||
delete request._started
|
||||
if (response.statusCode !== 401 && response.statusCode !== 307) {
|
||||
// Remove parameters from the previous response, unless this is the second request
|
||||
// for a server that requires digest authentication.
|
||||
delete request.body
|
||||
delete request._form
|
||||
if (request.headers) {
|
||||
request.removeHeader('host')
|
||||
request.removeHeader('content-type')
|
||||
request.removeHeader('content-length')
|
||||
if (request.uri.hostname !== request.originalHost.split(':')[0]) {
|
||||
// Remove authorization if changing hostnames (but not if just
|
||||
// changing ports or protocols). This matches the behavior of curl:
|
||||
// https://github.com/bagder/curl/blob/6beb0eee/lib/http.c#L710
|
||||
request.removeHeader('authorization')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!self.removeRefererHeader) {
|
||||
request.setHeader('referer', uriPrev.href)
|
||||
}
|
||||
|
||||
request.emit('redirect')
|
||||
|
||||
request.init()
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
exports.Redirect = Redirect
|
@ -0,0 +1,175 @@
|
||||
'use strict'
|
||||
|
||||
var url = require('url')
|
||||
var tunnel = require('tunnel-agent')
|
||||
|
||||
var defaultProxyHeaderWhiteList = [
|
||||
'accept',
|
||||
'accept-charset',
|
||||
'accept-encoding',
|
||||
'accept-language',
|
||||
'accept-ranges',
|
||||
'cache-control',
|
||||
'content-encoding',
|
||||
'content-language',
|
||||
'content-location',
|
||||
'content-md5',
|
||||
'content-range',
|
||||
'content-type',
|
||||
'connection',
|
||||
'date',
|
||||
'expect',
|
||||
'max-forwards',
|
||||
'pragma',
|
||||
'referer',
|
||||
'te',
|
||||
'user-agent',
|
||||
'via'
|
||||
]
|
||||
|
||||
var defaultProxyHeaderExclusiveList = [
|
||||
'proxy-authorization'
|
||||
]
|
||||
|
||||
function constructProxyHost (uriObject) {
|
||||
var port = uriObject.port
|
||||
var protocol = uriObject.protocol
|
||||
var proxyHost = uriObject.hostname + ':'
|
||||
|
||||
if (port) {
|
||||
proxyHost += port
|
||||
} else if (protocol === 'https:') {
|
||||
proxyHost += '443'
|
||||
} else {
|
||||
proxyHost += '80'
|
||||
}
|
||||
|
||||
return proxyHost
|
||||
}
|
||||
|
||||
function constructProxyHeaderWhiteList (headers, proxyHeaderWhiteList) {
|
||||
var whiteList = proxyHeaderWhiteList
|
||||
.reduce(function (set, header) {
|
||||
set[header.toLowerCase()] = true
|
||||
return set
|
||||
}, {})
|
||||
|
||||
return Object.keys(headers)
|
||||
.filter(function (header) {
|
||||
return whiteList[header.toLowerCase()]
|
||||
})
|
||||
.reduce(function (set, header) {
|
||||
set[header] = headers[header]
|
||||
return set
|
||||
}, {})
|
||||
}
|
||||
|
||||
function constructTunnelOptions (request, proxyHeaders) {
|
||||
var proxy = request.proxy
|
||||
|
||||
var tunnelOptions = {
|
||||
proxy: {
|
||||
host: proxy.hostname,
|
||||
port: +proxy.port,
|
||||
proxyAuth: proxy.auth,
|
||||
headers: proxyHeaders
|
||||
},
|
||||
headers: request.headers,
|
||||
ca: request.ca,
|
||||
cert: request.cert,
|
||||
key: request.key,
|
||||
passphrase: request.passphrase,
|
||||
pfx: request.pfx,
|
||||
ciphers: request.ciphers,
|
||||
rejectUnauthorized: request.rejectUnauthorized,
|
||||
secureOptions: request.secureOptions,
|
||||
secureProtocol: request.secureProtocol
|
||||
}
|
||||
|
||||
return tunnelOptions
|
||||
}
|
||||
|
||||
function constructTunnelFnName (uri, proxy) {
|
||||
var uriProtocol = (uri.protocol === 'https:' ? 'https' : 'http')
|
||||
var proxyProtocol = (proxy.protocol === 'https:' ? 'Https' : 'Http')
|
||||
return [uriProtocol, proxyProtocol].join('Over')
|
||||
}
|
||||
|
||||
function getTunnelFn (request) {
|
||||
var uri = request.uri
|
||||
var proxy = request.proxy
|
||||
var tunnelFnName = constructTunnelFnName(uri, proxy)
|
||||
return tunnel[tunnelFnName]
|
||||
}
|
||||
|
||||
function Tunnel (request) {
|
||||
this.request = request
|
||||
this.proxyHeaderWhiteList = defaultProxyHeaderWhiteList
|
||||
this.proxyHeaderExclusiveList = []
|
||||
if (typeof request.tunnel !== 'undefined') {
|
||||
this.tunnelOverride = request.tunnel
|
||||
}
|
||||
}
|
||||
|
||||
Tunnel.prototype.isEnabled = function () {
|
||||
var self = this
|
||||
var request = self.request
|
||||
// Tunnel HTTPS by default. Allow the user to override this setting.
|
||||
|
||||
// If self.tunnelOverride is set (the user specified a value), use it.
|
||||
if (typeof self.tunnelOverride !== 'undefined') {
|
||||
return self.tunnelOverride
|
||||
}
|
||||
|
||||
// If the destination is HTTPS, tunnel.
|
||||
if (request.uri.protocol === 'https:') {
|
||||
return true
|
||||
}
|
||||
|
||||
// Otherwise, do not use tunnel.
|
||||
return false
|
||||
}
|
||||
|
||||
Tunnel.prototype.setup = function (options) {
|
||||
var self = this
|
||||
var request = self.request
|
||||
|
||||
options = options || {}
|
||||
|
||||
if (typeof request.proxy === 'string') {
|
||||
request.proxy = url.parse(request.proxy)
|
||||
}
|
||||
|
||||
if (!request.proxy || !request.tunnel) {
|
||||
return false
|
||||
}
|
||||
|
||||
// Setup Proxy Header Exclusive List and White List
|
||||
if (options.proxyHeaderWhiteList) {
|
||||
self.proxyHeaderWhiteList = options.proxyHeaderWhiteList
|
||||
}
|
||||
if (options.proxyHeaderExclusiveList) {
|
||||
self.proxyHeaderExclusiveList = options.proxyHeaderExclusiveList
|
||||
}
|
||||
|
||||
var proxyHeaderExclusiveList = self.proxyHeaderExclusiveList.concat(defaultProxyHeaderExclusiveList)
|
||||
var proxyHeaderWhiteList = self.proxyHeaderWhiteList.concat(proxyHeaderExclusiveList)
|
||||
|
||||
// Setup Proxy Headers and Proxy Headers Host
|
||||
// Only send the Proxy White Listed Header names
|
||||
var proxyHeaders = constructProxyHeaderWhiteList(request.headers, proxyHeaderWhiteList)
|
||||
proxyHeaders.host = constructProxyHost(request.uri)
|
||||
|
||||
proxyHeaderExclusiveList.forEach(request.removeHeader, request)
|
||||
|
||||
// Set Agent from Tunnel Data
|
||||
var tunnelFn = getTunnelFn(request)
|
||||
var tunnelOptions = constructTunnelOptions(request, proxyHeaders)
|
||||
request.agent = tunnelFn(tunnelOptions)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
Tunnel.defaultProxyHeaderWhiteList = defaultProxyHeaderWhiteList
|
||||
Tunnel.defaultProxyHeaderExclusiveList = defaultProxyHeaderExclusiveList
|
||||
exports.Tunnel = Tunnel
|
243
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/.bin/sshpk-conv
generated
vendored
Executable file
243
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/.bin/sshpk-conv
generated
vendored
Executable file
@ -0,0 +1,243 @@
|
||||
#!/usr/bin/env node
|
||||
// -*- mode: js -*-
|
||||
// vim: set filetype=javascript :
|
||||
// Copyright 2018 Joyent, Inc. All rights reserved.
|
||||
|
||||
var dashdash = require('dashdash');
|
||||
var sshpk = require('../lib/index');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var tty = require('tty');
|
||||
var readline = require('readline');
|
||||
var getPassword = require('getpass').getPass;
|
||||
|
||||
var options = [
|
||||
{
|
||||
names: ['outformat', 't'],
|
||||
type: 'string',
|
||||
help: 'Output format'
|
||||
},
|
||||
{
|
||||
names: ['informat', 'T'],
|
||||
type: 'string',
|
||||
help: 'Input format'
|
||||
},
|
||||
{
|
||||
names: ['file', 'f'],
|
||||
type: 'string',
|
||||
help: 'Input file name (default stdin)'
|
||||
},
|
||||
{
|
||||
names: ['out', 'o'],
|
||||
type: 'string',
|
||||
help: 'Output file name (default stdout)'
|
||||
},
|
||||
{
|
||||
names: ['private', 'p'],
|
||||
type: 'bool',
|
||||
help: 'Produce a private key as output'
|
||||
},
|
||||
{
|
||||
names: ['derive', 'd'],
|
||||
type: 'string',
|
||||
help: 'Output a new key derived from this one, with given algo'
|
||||
},
|
||||
{
|
||||
names: ['identify', 'i'],
|
||||
type: 'bool',
|
||||
help: 'Print key metadata instead of converting'
|
||||
},
|
||||
{
|
||||
names: ['fingerprint', 'F'],
|
||||
type: 'bool',
|
||||
help: 'Output key fingerprint'
|
||||
},
|
||||
{
|
||||
names: ['hash', 'H'],
|
||||
type: 'string',
|
||||
help: 'Hash function to use for key fingeprint with -F'
|
||||
},
|
||||
{
|
||||
names: ['spki', 's'],
|
||||
type: 'bool',
|
||||
help: 'With -F, generates an SPKI fingerprint instead of SSH'
|
||||
},
|
||||
{
|
||||
names: ['comment', 'c'],
|
||||
type: 'string',
|
||||
help: 'Set key comment, if output format supports'
|
||||
},
|
||||
{
|
||||
names: ['help', 'h'],
|
||||
type: 'bool',
|
||||
help: 'Shows this help text'
|
||||
}
|
||||
];
|
||||
|
||||
if (require.main === module) {
|
||||
var parser = dashdash.createParser({
|
||||
options: options
|
||||
});
|
||||
|
||||
try {
|
||||
var opts = parser.parse(process.argv);
|
||||
} catch (e) {
|
||||
console.error('sshpk-conv: error: %s', e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (opts.help || opts._args.length > 1) {
|
||||
var help = parser.help({}).trimRight();
|
||||
console.error('sshpk-conv: converts between SSH key formats\n');
|
||||
console.error(help);
|
||||
console.error('\navailable key formats:');
|
||||
console.error(' - pem, pkcs1 eg id_rsa');
|
||||
console.error(' - ssh eg id_rsa.pub');
|
||||
console.error(' - pkcs8 format you want for openssl');
|
||||
console.error(' - openssh like output of ssh-keygen -o');
|
||||
console.error(' - rfc4253 raw OpenSSH wire format');
|
||||
console.error(' - dnssec dnssec-keygen format');
|
||||
console.error(' - putty PuTTY ppk format');
|
||||
console.error('\navailable fingerprint formats:');
|
||||
console.error(' - hex colon-separated hex for SSH');
|
||||
console.error(' straight hex for SPKI');
|
||||
console.error(' - base64 SHA256:* format from OpenSSH');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* Key derivation can only be done on private keys, so use of the -d
|
||||
* option necessarily implies -p.
|
||||
*/
|
||||
if (opts.derive)
|
||||
opts.private = true;
|
||||
|
||||
var inFile = process.stdin;
|
||||
var inFileName = 'stdin';
|
||||
|
||||
var inFilePath;
|
||||
if (opts.file) {
|
||||
inFilePath = opts.file;
|
||||
} else if (opts._args.length === 1) {
|
||||
inFilePath = opts._args[0];
|
||||
}
|
||||
|
||||
if (inFilePath)
|
||||
inFileName = path.basename(inFilePath);
|
||||
|
||||
try {
|
||||
if (inFilePath) {
|
||||
fs.accessSync(inFilePath, fs.R_OK);
|
||||
inFile = fs.createReadStream(inFilePath);
|
||||
}
|
||||
} catch (e) {
|
||||
ifError(e, 'error opening input file');
|
||||
}
|
||||
|
||||
var outFile = process.stdout;
|
||||
|
||||
try {
|
||||
if (opts.out && !opts.identify) {
|
||||
fs.accessSync(path.dirname(opts.out), fs.W_OK);
|
||||
outFile = fs.createWriteStream(opts.out);
|
||||
}
|
||||
} catch (e) {
|
||||
ifError(e, 'error opening output file');
|
||||
}
|
||||
|
||||
var bufs = [];
|
||||
inFile.on('readable', function () {
|
||||
var data;
|
||||
while ((data = inFile.read()))
|
||||
bufs.push(data);
|
||||
});
|
||||
var parseOpts = {};
|
||||
parseOpts.filename = inFileName;
|
||||
inFile.on('end', function processKey() {
|
||||
var buf = Buffer.concat(bufs);
|
||||
var fmt = 'auto';
|
||||
if (opts.informat)
|
||||
fmt = opts.informat;
|
||||
var f = sshpk.parseKey;
|
||||
if (opts.private)
|
||||
f = sshpk.parsePrivateKey;
|
||||
try {
|
||||
var key = f(buf, fmt, parseOpts);
|
||||
} catch (e) {
|
||||
if (e.name === 'KeyEncryptedError') {
|
||||
getPassword(function (err, pw) {
|
||||
if (err)
|
||||
ifError(err);
|
||||
parseOpts.passphrase = pw;
|
||||
processKey();
|
||||
});
|
||||
return;
|
||||
}
|
||||
ifError(e);
|
||||
}
|
||||
|
||||
if (opts.derive)
|
||||
key = key.derive(opts.derive);
|
||||
|
||||
if (opts.comment)
|
||||
key.comment = opts.comment;
|
||||
|
||||
if (opts.identify) {
|
||||
var kind = 'public';
|
||||
if (sshpk.PrivateKey.isPrivateKey(key))
|
||||
kind = 'private';
|
||||
console.log('%s: a %d bit %s %s key', inFileName,
|
||||
key.size, key.type.toUpperCase(), kind);
|
||||
if (key.type === 'ecdsa')
|
||||
console.log('ECDSA curve: %s', key.curve);
|
||||
if (key.comment)
|
||||
console.log('Comment: %s', key.comment);
|
||||
console.log('SHA256 fingerprint: ' +
|
||||
key.fingerprint('sha256').toString());
|
||||
console.log('MD5 fingerprint: ' +
|
||||
key.fingerprint('md5').toString());
|
||||
console.log('SPKI-SHA256 fingerprint: ' +
|
||||
key.fingerprint('sha256', 'spki').toString());
|
||||
process.exit(0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (opts.fingerprint) {
|
||||
var hash = opts.hash;
|
||||
var type = opts.spki ? 'spki' : 'ssh';
|
||||
var format = opts.outformat;
|
||||
var fp = key.fingerprint(hash, type).toString(format);
|
||||
outFile.write(fp);
|
||||
outFile.write('\n');
|
||||
outFile.once('drain', function () {
|
||||
process.exit(0);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
fmt = undefined;
|
||||
if (opts.outformat)
|
||||
fmt = opts.outformat;
|
||||
outFile.write(key.toBuffer(fmt));
|
||||
if (fmt === 'ssh' ||
|
||||
(!opts.private && fmt === undefined))
|
||||
outFile.write('\n');
|
||||
outFile.once('drain', function () {
|
||||
process.exit(0);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function ifError(e, txt) {
|
||||
if (txt)
|
||||
txt = txt + ': ';
|
||||
else
|
||||
txt = '';
|
||||
console.error('sshpk-conv: ' + txt + e.name + ': ' + e.message);
|
||||
if (process.env['DEBUG'] || process.env['V']) {
|
||||
console.error(e.stack);
|
||||
if (e.innerErr)
|
||||
console.error(e.innerErr.stack);
|
||||
}
|
||||
process.exit(1);
|
||||
}
|
191
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/.bin/sshpk-sign
generated
vendored
Executable file
191
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/.bin/sshpk-sign
generated
vendored
Executable file
@ -0,0 +1,191 @@
|
||||
#!/usr/bin/env node
|
||||
// -*- mode: js -*-
|
||||
// vim: set filetype=javascript :
|
||||
// Copyright 2015 Joyent, Inc. All rights reserved.
|
||||
|
||||
var dashdash = require('dashdash');
|
||||
var sshpk = require('../lib/index');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var getPassword = require('getpass').getPass;
|
||||
|
||||
var options = [
|
||||
{
|
||||
names: ['hash', 'H'],
|
||||
type: 'string',
|
||||
help: 'Hash algorithm (sha1, sha256, sha384, sha512)'
|
||||
},
|
||||
{
|
||||
names: ['verbose', 'v'],
|
||||
type: 'bool',
|
||||
help: 'Display verbose info about key and hash used'
|
||||
},
|
||||
{
|
||||
names: ['identity', 'i'],
|
||||
type: 'string',
|
||||
help: 'Path to key to use'
|
||||
},
|
||||
{
|
||||
names: ['file', 'f'],
|
||||
type: 'string',
|
||||
help: 'Input filename'
|
||||
},
|
||||
{
|
||||
names: ['out', 'o'],
|
||||
type: 'string',
|
||||
help: 'Output filename'
|
||||
},
|
||||
{
|
||||
names: ['format', 't'],
|
||||
type: 'string',
|
||||
help: 'Signature format (asn1, ssh, raw)'
|
||||
},
|
||||
{
|
||||
names: ['binary', 'b'],
|
||||
type: 'bool',
|
||||
help: 'Output raw binary instead of base64'
|
||||
},
|
||||
{
|
||||
names: ['help', 'h'],
|
||||
type: 'bool',
|
||||
help: 'Shows this help text'
|
||||
}
|
||||
];
|
||||
|
||||
var parseOpts = {};
|
||||
|
||||
if (require.main === module) {
|
||||
var parser = dashdash.createParser({
|
||||
options: options
|
||||
});
|
||||
|
||||
try {
|
||||
var opts = parser.parse(process.argv);
|
||||
} catch (e) {
|
||||
console.error('sshpk-sign: error: %s', e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (opts.help || opts._args.length > 1) {
|
||||
var help = parser.help({}).trimRight();
|
||||
console.error('sshpk-sign: sign data using an SSH key\n');
|
||||
console.error(help);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!opts.identity) {
|
||||
var help = parser.help({}).trimRight();
|
||||
console.error('sshpk-sign: the -i or --identity option ' +
|
||||
'is required\n');
|
||||
console.error(help);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var keyData = fs.readFileSync(opts.identity);
|
||||
parseOpts.filename = opts.identity;
|
||||
|
||||
run();
|
||||
}
|
||||
|
||||
function run() {
|
||||
var key;
|
||||
try {
|
||||
key = sshpk.parsePrivateKey(keyData, 'auto', parseOpts);
|
||||
} catch (e) {
|
||||
if (e.name === 'KeyEncryptedError') {
|
||||
getPassword(function (err, pw) {
|
||||
parseOpts.passphrase = pw;
|
||||
run();
|
||||
});
|
||||
return;
|
||||
}
|
||||
console.error('sshpk-sign: error loading private key "' +
|
||||
opts.identity + '": ' + e.name + ': ' + e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var hash = opts.hash || key.defaultHashAlgorithm();
|
||||
|
||||
var signer;
|
||||
try {
|
||||
signer = key.createSign(hash);
|
||||
} catch (e) {
|
||||
console.error('sshpk-sign: error creating signer: ' +
|
||||
e.name + ': ' + e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (opts.verbose) {
|
||||
console.error('sshpk-sign: using %s-%s with a %d bit key',
|
||||
key.type, hash, key.size);
|
||||
}
|
||||
|
||||
var inFile = process.stdin;
|
||||
var inFileName = 'stdin';
|
||||
|
||||
var inFilePath;
|
||||
if (opts.file) {
|
||||
inFilePath = opts.file;
|
||||
} else if (opts._args.length === 1) {
|
||||
inFilePath = opts._args[0];
|
||||
}
|
||||
|
||||
if (inFilePath)
|
||||
inFileName = path.basename(inFilePath);
|
||||
|
||||
try {
|
||||
if (inFilePath) {
|
||||
fs.accessSync(inFilePath, fs.R_OK);
|
||||
inFile = fs.createReadStream(inFilePath);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('sshpk-sign: error opening input file' +
|
||||
': ' + e.name + ': ' + e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var outFile = process.stdout;
|
||||
|
||||
try {
|
||||
if (opts.out && !opts.identify) {
|
||||
fs.accessSync(path.dirname(opts.out), fs.W_OK);
|
||||
outFile = fs.createWriteStream(opts.out);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('sshpk-sign: error opening output file' +
|
||||
': ' + e.name + ': ' + e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
inFile.pipe(signer);
|
||||
inFile.on('end', function () {
|
||||
var sig;
|
||||
try {
|
||||
sig = signer.sign();
|
||||
} catch (e) {
|
||||
console.error('sshpk-sign: error signing data: ' +
|
||||
e.name + ': ' + e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
var fmt = opts.format || 'asn1';
|
||||
var output;
|
||||
try {
|
||||
output = sig.toBuffer(fmt);
|
||||
if (!opts.binary)
|
||||
output = output.toString('base64');
|
||||
} catch (e) {
|
||||
console.error('sshpk-sign: error converting signature' +
|
||||
' to ' + fmt + ' format: ' + e.name + ': ' +
|
||||
e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
outFile.write(output);
|
||||
if (!opts.binary)
|
||||
outFile.write('\n');
|
||||
outFile.once('drain', function () {
|
||||
process.exit(0);
|
||||
});
|
||||
});
|
||||
}
|
167
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/.bin/sshpk-verify
generated
vendored
Executable file
167
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/.bin/sshpk-verify
generated
vendored
Executable file
@ -0,0 +1,167 @@
|
||||
#!/usr/bin/env node
|
||||
// -*- mode: js -*-
|
||||
// vim: set filetype=javascript :
|
||||
// Copyright 2015 Joyent, Inc. All rights reserved.
|
||||
|
||||
var dashdash = require('dashdash');
|
||||
var sshpk = require('../lib/index');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var Buffer = require('safer-buffer').Buffer;
|
||||
|
||||
var options = [
|
||||
{
|
||||
names: ['hash', 'H'],
|
||||
type: 'string',
|
||||
help: 'Hash algorithm (sha1, sha256, sha384, sha512)'
|
||||
},
|
||||
{
|
||||
names: ['verbose', 'v'],
|
||||
type: 'bool',
|
||||
help: 'Display verbose info about key and hash used'
|
||||
},
|
||||
{
|
||||
names: ['identity', 'i'],
|
||||
type: 'string',
|
||||
help: 'Path to (public) key to use'
|
||||
},
|
||||
{
|
||||
names: ['file', 'f'],
|
||||
type: 'string',
|
||||
help: 'Input filename'
|
||||
},
|
||||
{
|
||||
names: ['format', 't'],
|
||||
type: 'string',
|
||||
help: 'Signature format (asn1, ssh, raw)'
|
||||
},
|
||||
{
|
||||
names: ['signature', 's'],
|
||||
type: 'string',
|
||||
help: 'base64-encoded signature data'
|
||||
},
|
||||
{
|
||||
names: ['help', 'h'],
|
||||
type: 'bool',
|
||||
help: 'Shows this help text'
|
||||
}
|
||||
];
|
||||
|
||||
if (require.main === module) {
|
||||
var parser = dashdash.createParser({
|
||||
options: options
|
||||
});
|
||||
|
||||
try {
|
||||
var opts = parser.parse(process.argv);
|
||||
} catch (e) {
|
||||
console.error('sshpk-verify: error: %s', e.message);
|
||||
process.exit(3);
|
||||
}
|
||||
|
||||
if (opts.help || opts._args.length > 1) {
|
||||
var help = parser.help({}).trimRight();
|
||||
console.error('sshpk-verify: sign data using an SSH key\n');
|
||||
console.error(help);
|
||||
process.exit(3);
|
||||
}
|
||||
|
||||
if (!opts.identity) {
|
||||
var help = parser.help({}).trimRight();
|
||||
console.error('sshpk-verify: the -i or --identity option ' +
|
||||
'is required\n');
|
||||
console.error(help);
|
||||
process.exit(3);
|
||||
}
|
||||
|
||||
if (!opts.signature) {
|
||||
var help = parser.help({}).trimRight();
|
||||
console.error('sshpk-verify: the -s or --signature option ' +
|
||||
'is required\n');
|
||||
console.error(help);
|
||||
process.exit(3);
|
||||
}
|
||||
|
||||
var keyData = fs.readFileSync(opts.identity);
|
||||
|
||||
var key;
|
||||
try {
|
||||
key = sshpk.parseKey(keyData);
|
||||
} catch (e) {
|
||||
console.error('sshpk-verify: error loading key "' +
|
||||
opts.identity + '": ' + e.name + ': ' + e.message);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
var fmt = opts.format || 'asn1';
|
||||
var sigData = Buffer.from(opts.signature, 'base64');
|
||||
|
||||
var sig;
|
||||
try {
|
||||
sig = sshpk.parseSignature(sigData, key.type, fmt);
|
||||
} catch (e) {
|
||||
console.error('sshpk-verify: error parsing signature: ' +
|
||||
e.name + ': ' + e.message);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
var hash = opts.hash || key.defaultHashAlgorithm();
|
||||
|
||||
var verifier;
|
||||
try {
|
||||
verifier = key.createVerify(hash);
|
||||
} catch (e) {
|
||||
console.error('sshpk-verify: error creating verifier: ' +
|
||||
e.name + ': ' + e.message);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
if (opts.verbose) {
|
||||
console.error('sshpk-verify: using %s-%s with a %d bit key',
|
||||
key.type, hash, key.size);
|
||||
}
|
||||
|
||||
var inFile = process.stdin;
|
||||
var inFileName = 'stdin';
|
||||
|
||||
var inFilePath;
|
||||
if (opts.file) {
|
||||
inFilePath = opts.file;
|
||||
} else if (opts._args.length === 1) {
|
||||
inFilePath = opts._args[0];
|
||||
}
|
||||
|
||||
if (inFilePath)
|
||||
inFileName = path.basename(inFilePath);
|
||||
|
||||
try {
|
||||
if (inFilePath) {
|
||||
fs.accessSync(inFilePath, fs.R_OK);
|
||||
inFile = fs.createReadStream(inFilePath);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('sshpk-verify: error opening input file' +
|
||||
': ' + e.name + ': ' + e.message);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
inFile.pipe(verifier);
|
||||
inFile.on('end', function () {
|
||||
var ret;
|
||||
try {
|
||||
ret = verifier.verify(sig);
|
||||
} catch (e) {
|
||||
console.error('sshpk-verify: error verifying data: ' +
|
||||
e.name + ': ' + e.message);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
console.error('OK');
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
console.error('NOT OK');
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
65
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/.bin/uuid
generated
vendored
Executable file
65
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/.bin/uuid
generated
vendored
Executable file
@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env node
|
||||
var assert = require('assert');
|
||||
|
||||
function usage() {
|
||||
console.log('Usage:');
|
||||
console.log(' uuid');
|
||||
console.log(' uuid v1');
|
||||
console.log(' uuid v3 <name> <namespace uuid>');
|
||||
console.log(' uuid v4');
|
||||
console.log(' uuid v5 <name> <namespace uuid>');
|
||||
console.log(' uuid --help');
|
||||
console.log('\nNote: <namespace uuid> may be "URL" or "DNS" to use the corresponding UUIDs defined by RFC4122');
|
||||
}
|
||||
|
||||
var args = process.argv.slice(2);
|
||||
|
||||
if (args.indexOf('--help') >= 0) {
|
||||
usage();
|
||||
process.exit(0);
|
||||
}
|
||||
var version = args.shift() || 'v4';
|
||||
|
||||
switch (version) {
|
||||
case 'v1':
|
||||
var uuidV1 = require('../v1');
|
||||
console.log(uuidV1());
|
||||
break;
|
||||
|
||||
case 'v3':
|
||||
var uuidV3 = require('../v3');
|
||||
|
||||
var name = args.shift();
|
||||
var namespace = args.shift();
|
||||
assert(name != null, 'v3 name not specified');
|
||||
assert(namespace != null, 'v3 namespace not specified');
|
||||
|
||||
if (namespace == 'URL') namespace = uuidV3.URL;
|
||||
if (namespace == 'DNS') namespace = uuidV3.DNS;
|
||||
|
||||
console.log(uuidV3(name, namespace));
|
||||
break;
|
||||
|
||||
case 'v4':
|
||||
var uuidV4 = require('../v4');
|
||||
console.log(uuidV4());
|
||||
break;
|
||||
|
||||
case 'v5':
|
||||
var uuidV5 = require('../v5');
|
||||
|
||||
var name = args.shift();
|
||||
var namespace = args.shift();
|
||||
assert(name != null, 'v5 name not specified');
|
||||
assert(namespace != null, 'v5 namespace not specified');
|
||||
|
||||
if (namespace == 'URL') namespace = uuidV5.URL;
|
||||
if (namespace == 'DNS') namespace = uuidV5.DNS;
|
||||
|
||||
console.log(uuidV5(name, namespace));
|
||||
break;
|
||||
|
||||
default:
|
||||
usage();
|
||||
process.exit(1);
|
||||
}
|
20
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/.tonic_example.js
generated
vendored
Normal file
20
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/.tonic_example.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
var Ajv = require('ajv');
|
||||
var ajv = new Ajv({allErrors: true});
|
||||
|
||||
var schema = {
|
||||
"properties": {
|
||||
"foo": { "type": "string" },
|
||||
"bar": { "type": "number", "maximum": 3 }
|
||||
}
|
||||
};
|
||||
|
||||
var validate = ajv.compile(schema);
|
||||
|
||||
test({"foo": "abc", "bar": 2});
|
||||
test({"foo": 2, "bar": 4});
|
||||
|
||||
function test(data) {
|
||||
var valid = validate(data);
|
||||
if (valid) console.log('Valid!');
|
||||
else console.log('Invalid: ' + ajv.errorsText(validate.errors));
|
||||
}
|
22
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/LICENSE
generated
vendored
Normal file
22
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2017 Evgeny Poberezkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
1452
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/README.md
generated
vendored
Normal file
1452
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/README.md
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
7165
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/dist/ajv.bundle.js
generated
vendored
Normal file
7165
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/dist/ajv.bundle.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/dist/ajv.min.js
generated
vendored
Normal file
3
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/dist/ajv.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/dist/ajv.min.js.map
generated
vendored
Normal file
1
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/dist/ajv.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
395
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/ajv.d.ts
generated
vendored
Normal file
395
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/ajv.d.ts
generated
vendored
Normal file
@ -0,0 +1,395 @@
|
||||
declare var ajv: {
|
||||
(options?: ajv.Options): ajv.Ajv;
|
||||
new(options?: ajv.Options): ajv.Ajv;
|
||||
ValidationError: typeof AjvErrors.ValidationError;
|
||||
MissingRefError: typeof AjvErrors.MissingRefError;
|
||||
$dataMetaSchema: object;
|
||||
}
|
||||
|
||||
declare namespace AjvErrors {
|
||||
class ValidationError extends Error {
|
||||
constructor(errors: Array<ajv.ErrorObject>);
|
||||
|
||||
message: string;
|
||||
errors: Array<ajv.ErrorObject>;
|
||||
ajv: true;
|
||||
validation: true;
|
||||
}
|
||||
|
||||
class MissingRefError extends Error {
|
||||
constructor(baseId: string, ref: string, message?: string);
|
||||
static message: (baseId: string, ref: string) => string;
|
||||
|
||||
message: string;
|
||||
missingRef: string;
|
||||
missingSchema: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare namespace ajv {
|
||||
type ValidationError = AjvErrors.ValidationError;
|
||||
|
||||
type MissingRefError = AjvErrors.MissingRefError;
|
||||
|
||||
interface Ajv {
|
||||
/**
|
||||
* Validate data using schema
|
||||
* Schema will be compiled and cached (using serialized JSON as key, [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize by default).
|
||||
* @param {string|object|Boolean} schemaKeyRef key, ref or schema object
|
||||
* @param {Any} data to be validated
|
||||
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
|
||||
*/
|
||||
validate(schemaKeyRef: object | string | boolean, data: any): boolean | PromiseLike<any>;
|
||||
/**
|
||||
* Create validating function for passed schema.
|
||||
* @param {object|Boolean} schema schema object
|
||||
* @return {Function} validating function
|
||||
*/
|
||||
compile(schema: object | boolean): ValidateFunction;
|
||||
/**
|
||||
* Creates validating function for passed schema with asynchronous loading of missing schemas.
|
||||
* `loadSchema` option should be a function that accepts schema uri and node-style callback.
|
||||
* @this Ajv
|
||||
* @param {object|Boolean} schema schema object
|
||||
* @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
|
||||
* @param {Function} callback optional node-style callback, it is always called with 2 parameters: error (or null) and validating function.
|
||||
* @return {PromiseLike<ValidateFunction>} validating function
|
||||
*/
|
||||
compileAsync(schema: object | boolean, meta?: Boolean, callback?: (err: Error, validate: ValidateFunction) => any): PromiseLike<ValidateFunction>;
|
||||
/**
|
||||
* Adds schema to the instance.
|
||||
* @param {object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
|
||||
* @param {string} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addSchema(schema: Array<object> | object, key?: string): Ajv;
|
||||
/**
|
||||
* Add schema that will be used to validate other schemas
|
||||
* options in META_IGNORE_OPTIONS are alway set to false
|
||||
* @param {object} schema schema object
|
||||
* @param {string} key optional schema key
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addMetaSchema(schema: object, key?: string): Ajv;
|
||||
/**
|
||||
* Validate schema
|
||||
* @param {object|Boolean} schema schema to validate
|
||||
* @return {Boolean} true if schema is valid
|
||||
*/
|
||||
validateSchema(schema: object | boolean): boolean;
|
||||
/**
|
||||
* Get compiled schema from the instance by `key` or `ref`.
|
||||
* @param {string} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
|
||||
* @return {Function} schema validating function (with property `schema`). Returns undefined if keyRef can't be resolved to an existing schema.
|
||||
*/
|
||||
getSchema(keyRef: string): ValidateFunction | undefined;
|
||||
/**
|
||||
* Remove cached schema(s).
|
||||
* If no parameter is passed all schemas but meta-schemas are removed.
|
||||
* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
||||
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
||||
* @param {string|object|RegExp|Boolean} schemaKeyRef key, ref, pattern to match key/ref or schema object
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
removeSchema(schemaKeyRef?: object | string | RegExp | boolean): Ajv;
|
||||
/**
|
||||
* Add custom format
|
||||
* @param {string} name format name
|
||||
* @param {string|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addFormat(name: string, format: FormatValidator | FormatDefinition): Ajv;
|
||||
/**
|
||||
* Define custom keyword
|
||||
* @this Ajv
|
||||
* @param {string} keyword custom keyword, should be a valid identifier, should be different from all standard, custom and macro keywords.
|
||||
* @param {object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
addKeyword(keyword: string, definition: KeywordDefinition): Ajv;
|
||||
/**
|
||||
* Get keyword definition
|
||||
* @this Ajv
|
||||
* @param {string} keyword pre-defined or custom keyword.
|
||||
* @return {object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise.
|
||||
*/
|
||||
getKeyword(keyword: string): object | boolean;
|
||||
/**
|
||||
* Remove keyword
|
||||
* @this Ajv
|
||||
* @param {string} keyword pre-defined or custom keyword.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
removeKeyword(keyword: string): Ajv;
|
||||
/**
|
||||
* Validate keyword
|
||||
* @this Ajv
|
||||
* @param {object} definition keyword definition object
|
||||
* @param {boolean} throwError true to throw exception if definition is invalid
|
||||
* @return {boolean} validation result
|
||||
*/
|
||||
validateKeyword(definition: KeywordDefinition, throwError: boolean): boolean;
|
||||
/**
|
||||
* Convert array of error message objects to string
|
||||
* @param {Array<object>} errors optional array of validation errors, if not passed errors from the instance are used.
|
||||
* @param {object} options optional options with properties `separator` and `dataVar`.
|
||||
* @return {string} human readable string with all errors descriptions
|
||||
*/
|
||||
errorsText(errors?: Array<ErrorObject> | null, options?: ErrorsTextOptions): string;
|
||||
errors?: Array<ErrorObject> | null;
|
||||
}
|
||||
|
||||
interface CustomLogger {
|
||||
log(...args: any[]): any;
|
||||
warn(...args: any[]): any;
|
||||
error(...args: any[]): any;
|
||||
}
|
||||
|
||||
interface ValidateFunction {
|
||||
(
|
||||
data: any,
|
||||
dataPath?: string,
|
||||
parentData?: object | Array<any>,
|
||||
parentDataProperty?: string | number,
|
||||
rootData?: object | Array<any>
|
||||
): boolean | PromiseLike<any>;
|
||||
schema?: object | boolean;
|
||||
errors?: null | Array<ErrorObject>;
|
||||
refs?: object;
|
||||
refVal?: Array<any>;
|
||||
root?: ValidateFunction | object;
|
||||
$async?: true;
|
||||
source?: object;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
$data?: boolean;
|
||||
allErrors?: boolean;
|
||||
verbose?: boolean;
|
||||
jsonPointers?: boolean;
|
||||
uniqueItems?: boolean;
|
||||
unicode?: boolean;
|
||||
format?: false | string;
|
||||
formats?: object;
|
||||
keywords?: object;
|
||||
unknownFormats?: true | string[] | 'ignore';
|
||||
schemas?: Array<object> | object;
|
||||
schemaId?: '$id' | 'id' | 'auto';
|
||||
missingRefs?: true | 'ignore' | 'fail';
|
||||
extendRefs?: true | 'ignore' | 'fail';
|
||||
loadSchema?: (uri: string, cb?: (err: Error, schema: object) => void) => PromiseLike<object | boolean>;
|
||||
removeAdditional?: boolean | 'all' | 'failing';
|
||||
useDefaults?: boolean | 'empty' | 'shared';
|
||||
coerceTypes?: boolean | 'array';
|
||||
strictDefaults?: boolean | 'log';
|
||||
strictKeywords?: boolean | 'log';
|
||||
async?: boolean | string;
|
||||
transpile?: string | ((code: string) => string);
|
||||
meta?: boolean | object;
|
||||
validateSchema?: boolean | 'log';
|
||||
addUsedSchema?: boolean;
|
||||
inlineRefs?: boolean | number;
|
||||
passContext?: boolean;
|
||||
loopRequired?: number;
|
||||
ownProperties?: boolean;
|
||||
multipleOfPrecision?: boolean | number;
|
||||
errorDataPath?: string,
|
||||
messages?: boolean;
|
||||
sourceCode?: boolean;
|
||||
processCode?: (code: string) => string;
|
||||
cache?: object;
|
||||
logger?: CustomLogger | false;
|
||||
nullable?: boolean;
|
||||
serialize?: ((schema: object | boolean) => any) | false;
|
||||
}
|
||||
|
||||
type FormatValidator = string | RegExp | ((data: string) => boolean | PromiseLike<any>);
|
||||
type NumberFormatValidator = ((data: number) => boolean | PromiseLike<any>);
|
||||
|
||||
interface NumberFormatDefinition {
|
||||
type: "number",
|
||||
validate: NumberFormatValidator;
|
||||
compare?: (data1: number, data2: number) => number;
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
interface StringFormatDefinition {
|
||||
type?: "string",
|
||||
validate: FormatValidator;
|
||||
compare?: (data1: string, data2: string) => number;
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
type FormatDefinition = NumberFormatDefinition | StringFormatDefinition;
|
||||
|
||||
interface KeywordDefinition {
|
||||
type?: string | Array<string>;
|
||||
async?: boolean;
|
||||
$data?: boolean;
|
||||
errors?: boolean | string;
|
||||
metaSchema?: object;
|
||||
// schema: false makes validate not to expect schema (ValidateFunction)
|
||||
schema?: boolean;
|
||||
statements?: boolean;
|
||||
dependencies?: Array<string>;
|
||||
modifying?: boolean;
|
||||
valid?: boolean;
|
||||
// one and only one of the following properties should be present
|
||||
validate?: SchemaValidateFunction | ValidateFunction;
|
||||
compile?: (schema: any, parentSchema: object, it: CompilationContext) => ValidateFunction;
|
||||
macro?: (schema: any, parentSchema: object, it: CompilationContext) => object | boolean;
|
||||
inline?: (it: CompilationContext, keyword: string, schema: any, parentSchema: object) => string;
|
||||
}
|
||||
|
||||
interface CompilationContext {
|
||||
level: number;
|
||||
dataLevel: number;
|
||||
dataPathArr: string[];
|
||||
schema: any;
|
||||
schemaPath: string;
|
||||
baseId: string;
|
||||
async: boolean;
|
||||
opts: Options;
|
||||
formats: {
|
||||
[index: string]: FormatDefinition | undefined;
|
||||
};
|
||||
keywords: {
|
||||
[index: string]: KeywordDefinition | undefined;
|
||||
};
|
||||
compositeRule: boolean;
|
||||
validate: (schema: object) => boolean;
|
||||
util: {
|
||||
copy(obj: any, target?: any): any;
|
||||
toHash(source: string[]): { [index: string]: true | undefined };
|
||||
equal(obj: any, target: any): boolean;
|
||||
getProperty(str: string): string;
|
||||
schemaHasRules(schema: object, rules: any): string;
|
||||
escapeQuotes(str: string): string;
|
||||
toQuotedString(str: string): string;
|
||||
getData(jsonPointer: string, dataLevel: number, paths: string[]): string;
|
||||
escapeJsonPointer(str: string): string;
|
||||
unescapeJsonPointer(str: string): string;
|
||||
escapeFragment(str: string): string;
|
||||
unescapeFragment(str: string): string;
|
||||
};
|
||||
self: Ajv;
|
||||
}
|
||||
|
||||
interface SchemaValidateFunction {
|
||||
(
|
||||
schema: any,
|
||||
data: any,
|
||||
parentSchema?: object,
|
||||
dataPath?: string,
|
||||
parentData?: object | Array<any>,
|
||||
parentDataProperty?: string | number,
|
||||
rootData?: object | Array<any>
|
||||
): boolean | PromiseLike<any>;
|
||||
errors?: Array<ErrorObject>;
|
||||
}
|
||||
|
||||
interface ErrorsTextOptions {
|
||||
separator?: string;
|
||||
dataVar?: string;
|
||||
}
|
||||
|
||||
interface ErrorObject {
|
||||
keyword: string;
|
||||
dataPath: string;
|
||||
schemaPath: string;
|
||||
params: ErrorParameters;
|
||||
// Added to validation errors of propertyNames keyword schema
|
||||
propertyName?: string;
|
||||
// Excluded if messages set to false.
|
||||
message?: string;
|
||||
// These are added with the `verbose` option.
|
||||
schema?: any;
|
||||
parentSchema?: object;
|
||||
data?: any;
|
||||
}
|
||||
|
||||
type ErrorParameters = RefParams | LimitParams | AdditionalPropertiesParams |
|
||||
DependenciesParams | FormatParams | ComparisonParams |
|
||||
MultipleOfParams | PatternParams | RequiredParams |
|
||||
TypeParams | UniqueItemsParams | CustomParams |
|
||||
PatternRequiredParams | PropertyNamesParams |
|
||||
IfParams | SwitchParams | NoParams | EnumParams;
|
||||
|
||||
interface RefParams {
|
||||
ref: string;
|
||||
}
|
||||
|
||||
interface LimitParams {
|
||||
limit: number;
|
||||
}
|
||||
|
||||
interface AdditionalPropertiesParams {
|
||||
additionalProperty: string;
|
||||
}
|
||||
|
||||
interface DependenciesParams {
|
||||
property: string;
|
||||
missingProperty: string;
|
||||
depsCount: number;
|
||||
deps: string;
|
||||
}
|
||||
|
||||
interface FormatParams {
|
||||
format: string
|
||||
}
|
||||
|
||||
interface ComparisonParams {
|
||||
comparison: string;
|
||||
limit: number | string;
|
||||
exclusive: boolean;
|
||||
}
|
||||
|
||||
interface MultipleOfParams {
|
||||
multipleOf: number;
|
||||
}
|
||||
|
||||
interface PatternParams {
|
||||
pattern: string;
|
||||
}
|
||||
|
||||
interface RequiredParams {
|
||||
missingProperty: string;
|
||||
}
|
||||
|
||||
interface TypeParams {
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface UniqueItemsParams {
|
||||
i: number;
|
||||
j: number;
|
||||
}
|
||||
|
||||
interface CustomParams {
|
||||
keyword: string;
|
||||
}
|
||||
|
||||
interface PatternRequiredParams {
|
||||
missingPattern: string;
|
||||
}
|
||||
|
||||
interface PropertyNamesParams {
|
||||
propertyName: string;
|
||||
}
|
||||
|
||||
interface IfParams {
|
||||
failingKeyword: string;
|
||||
}
|
||||
|
||||
interface SwitchParams {
|
||||
caseIndex: number;
|
||||
}
|
||||
|
||||
interface NoParams { }
|
||||
|
||||
interface EnumParams {
|
||||
allowedValues: Array<any>;
|
||||
}
|
||||
}
|
||||
|
||||
export = ajv;
|
506
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/ajv.js
generated
vendored
Normal file
506
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/ajv.js
generated
vendored
Normal file
@ -0,0 +1,506 @@
|
||||
'use strict';
|
||||
|
||||
var compileSchema = require('./compile')
|
||||
, resolve = require('./compile/resolve')
|
||||
, Cache = require('./cache')
|
||||
, SchemaObject = require('./compile/schema_obj')
|
||||
, stableStringify = require('fast-json-stable-stringify')
|
||||
, formats = require('./compile/formats')
|
||||
, rules = require('./compile/rules')
|
||||
, $dataMetaSchema = require('./data')
|
||||
, util = require('./compile/util');
|
||||
|
||||
module.exports = Ajv;
|
||||
|
||||
Ajv.prototype.validate = validate;
|
||||
Ajv.prototype.compile = compile;
|
||||
Ajv.prototype.addSchema = addSchema;
|
||||
Ajv.prototype.addMetaSchema = addMetaSchema;
|
||||
Ajv.prototype.validateSchema = validateSchema;
|
||||
Ajv.prototype.getSchema = getSchema;
|
||||
Ajv.prototype.removeSchema = removeSchema;
|
||||
Ajv.prototype.addFormat = addFormat;
|
||||
Ajv.prototype.errorsText = errorsText;
|
||||
|
||||
Ajv.prototype._addSchema = _addSchema;
|
||||
Ajv.prototype._compile = _compile;
|
||||
|
||||
Ajv.prototype.compileAsync = require('./compile/async');
|
||||
var customKeyword = require('./keyword');
|
||||
Ajv.prototype.addKeyword = customKeyword.add;
|
||||
Ajv.prototype.getKeyword = customKeyword.get;
|
||||
Ajv.prototype.removeKeyword = customKeyword.remove;
|
||||
Ajv.prototype.validateKeyword = customKeyword.validate;
|
||||
|
||||
var errorClasses = require('./compile/error_classes');
|
||||
Ajv.ValidationError = errorClasses.Validation;
|
||||
Ajv.MissingRefError = errorClasses.MissingRef;
|
||||
Ajv.$dataMetaSchema = $dataMetaSchema;
|
||||
|
||||
var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
|
||||
|
||||
var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes', 'strictDefaults' ];
|
||||
var META_SUPPORT_DATA = ['/properties'];
|
||||
|
||||
/**
|
||||
* Creates validator instance.
|
||||
* Usage: `Ajv(opts)`
|
||||
* @param {Object} opts optional options
|
||||
* @return {Object} ajv instance
|
||||
*/
|
||||
function Ajv(opts) {
|
||||
if (!(this instanceof Ajv)) return new Ajv(opts);
|
||||
opts = this._opts = util.copy(opts) || {};
|
||||
setLogger(this);
|
||||
this._schemas = {};
|
||||
this._refs = {};
|
||||
this._fragments = {};
|
||||
this._formats = formats(opts.format);
|
||||
|
||||
this._cache = opts.cache || new Cache;
|
||||
this._loadingSchemas = {};
|
||||
this._compilations = [];
|
||||
this.RULES = rules();
|
||||
this._getId = chooseGetId(opts);
|
||||
|
||||
opts.loopRequired = opts.loopRequired || Infinity;
|
||||
if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true;
|
||||
if (opts.serialize === undefined) opts.serialize = stableStringify;
|
||||
this._metaOpts = getMetaSchemaOptions(this);
|
||||
|
||||
if (opts.formats) addInitialFormats(this);
|
||||
if (opts.keywords) addInitialKeywords(this);
|
||||
addDefaultMetaSchema(this);
|
||||
if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta);
|
||||
if (opts.nullable) this.addKeyword('nullable', {metaSchema: {type: 'boolean'}});
|
||||
addInitialSchemas(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Validate data using schema
|
||||
* Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize.
|
||||
* @this Ajv
|
||||
* @param {String|Object} schemaKeyRef key, ref or schema object
|
||||
* @param {Any} data to be validated
|
||||
* @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`).
|
||||
*/
|
||||
function validate(schemaKeyRef, data) {
|
||||
var v;
|
||||
if (typeof schemaKeyRef == 'string') {
|
||||
v = this.getSchema(schemaKeyRef);
|
||||
if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"');
|
||||
} else {
|
||||
var schemaObj = this._addSchema(schemaKeyRef);
|
||||
v = schemaObj.validate || this._compile(schemaObj);
|
||||
}
|
||||
|
||||
var valid = v(data);
|
||||
if (v.$async !== true) this.errors = v.errors;
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create validating function for passed schema.
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords.
|
||||
* @return {Function} validating function
|
||||
*/
|
||||
function compile(schema, _meta) {
|
||||
var schemaObj = this._addSchema(schema, undefined, _meta);
|
||||
return schemaObj.validate || this._compile(schemaObj);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds schema to the instance.
|
||||
* @this Ajv
|
||||
* @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored.
|
||||
* @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`.
|
||||
* @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead.
|
||||
* @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead.
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function addSchema(schema, key, _skipValidation, _meta) {
|
||||
if (Array.isArray(schema)){
|
||||
for (var i=0; i<schema.length; i++) this.addSchema(schema[i], undefined, _skipValidation, _meta);
|
||||
return this;
|
||||
}
|
||||
var id = this._getId(schema);
|
||||
if (id !== undefined && typeof id != 'string')
|
||||
throw new Error('schema id must be string');
|
||||
key = resolve.normalizeId(key || id);
|
||||
checkUnique(this, key);
|
||||
this._schemas[key] = this._addSchema(schema, _skipValidation, _meta, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add schema that will be used to validate other schemas
|
||||
* options in META_IGNORE_OPTIONS are alway set to false
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {String} key optional schema key
|
||||
* @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function addMetaSchema(schema, key, skipValidation) {
|
||||
this.addSchema(schema, key, skipValidation, true);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Validate schema
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to validate
|
||||
* @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid
|
||||
* @return {Boolean} true if schema is valid
|
||||
*/
|
||||
function validateSchema(schema, throwOrLogError) {
|
||||
var $schema = schema.$schema;
|
||||
if ($schema !== undefined && typeof $schema != 'string')
|
||||
throw new Error('$schema must be a string');
|
||||
$schema = $schema || this._opts.defaultMeta || defaultMeta(this);
|
||||
if (!$schema) {
|
||||
this.logger.warn('meta-schema not available');
|
||||
this.errors = null;
|
||||
return true;
|
||||
}
|
||||
var valid = this.validate($schema, schema);
|
||||
if (!valid && throwOrLogError) {
|
||||
var message = 'schema is invalid: ' + this.errorsText();
|
||||
if (this._opts.validateSchema == 'log') this.logger.error(message);
|
||||
else throw new Error(message);
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
function defaultMeta(self) {
|
||||
var meta = self._opts.meta;
|
||||
self._opts.defaultMeta = typeof meta == 'object'
|
||||
? self._getId(meta) || meta
|
||||
: self.getSchema(META_SCHEMA_ID)
|
||||
? META_SCHEMA_ID
|
||||
: undefined;
|
||||
return self._opts.defaultMeta;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get compiled schema from the instance by `key` or `ref`.
|
||||
* @this Ajv
|
||||
* @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id).
|
||||
* @return {Function} schema validating function (with property `schema`).
|
||||
*/
|
||||
function getSchema(keyRef) {
|
||||
var schemaObj = _getSchemaObj(this, keyRef);
|
||||
switch (typeof schemaObj) {
|
||||
case 'object': return schemaObj.validate || this._compile(schemaObj);
|
||||
case 'string': return this.getSchema(schemaObj);
|
||||
case 'undefined': return _getSchemaFragment(this, keyRef);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _getSchemaFragment(self, ref) {
|
||||
var res = resolve.schema.call(self, { schema: {} }, ref);
|
||||
if (res) {
|
||||
var schema = res.schema
|
||||
, root = res.root
|
||||
, baseId = res.baseId;
|
||||
var v = compileSchema.call(self, schema, root, undefined, baseId);
|
||||
self._fragments[ref] = new SchemaObject({
|
||||
ref: ref,
|
||||
fragment: true,
|
||||
schema: schema,
|
||||
root: root,
|
||||
baseId: baseId,
|
||||
validate: v
|
||||
});
|
||||
return v;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function _getSchemaObj(self, keyRef) {
|
||||
keyRef = resolve.normalizeId(keyRef);
|
||||
return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove cached schema(s).
|
||||
* If no parameter is passed all schemas but meta-schemas are removed.
|
||||
* If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
||||
* Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
||||
* @this Ajv
|
||||
* @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function removeSchema(schemaKeyRef) {
|
||||
if (schemaKeyRef instanceof RegExp) {
|
||||
_removeAllSchemas(this, this._schemas, schemaKeyRef);
|
||||
_removeAllSchemas(this, this._refs, schemaKeyRef);
|
||||
return this;
|
||||
}
|
||||
switch (typeof schemaKeyRef) {
|
||||
case 'undefined':
|
||||
_removeAllSchemas(this, this._schemas);
|
||||
_removeAllSchemas(this, this._refs);
|
||||
this._cache.clear();
|
||||
return this;
|
||||
case 'string':
|
||||
var schemaObj = _getSchemaObj(this, schemaKeyRef);
|
||||
if (schemaObj) this._cache.del(schemaObj.cacheKey);
|
||||
delete this._schemas[schemaKeyRef];
|
||||
delete this._refs[schemaKeyRef];
|
||||
return this;
|
||||
case 'object':
|
||||
var serialize = this._opts.serialize;
|
||||
var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef;
|
||||
this._cache.del(cacheKey);
|
||||
var id = this._getId(schemaKeyRef);
|
||||
if (id) {
|
||||
id = resolve.normalizeId(id);
|
||||
delete this._schemas[id];
|
||||
delete this._refs[id];
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
function _removeAllSchemas(self, schemas, regex) {
|
||||
for (var keyRef in schemas) {
|
||||
var schemaObj = schemas[keyRef];
|
||||
if (!schemaObj.meta && (!regex || regex.test(keyRef))) {
|
||||
self._cache.del(schemaObj.cacheKey);
|
||||
delete schemas[keyRef];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function _addSchema(schema, skipValidation, meta, shouldAddSchema) {
|
||||
if (typeof schema != 'object' && typeof schema != 'boolean')
|
||||
throw new Error('schema should be object or boolean');
|
||||
var serialize = this._opts.serialize;
|
||||
var cacheKey = serialize ? serialize(schema) : schema;
|
||||
var cached = this._cache.get(cacheKey);
|
||||
if (cached) return cached;
|
||||
|
||||
shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false;
|
||||
|
||||
var id = resolve.normalizeId(this._getId(schema));
|
||||
if (id && shouldAddSchema) checkUnique(this, id);
|
||||
|
||||
var willValidate = this._opts.validateSchema !== false && !skipValidation;
|
||||
var recursiveMeta;
|
||||
if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema)))
|
||||
this.validateSchema(schema, true);
|
||||
|
||||
var localRefs = resolve.ids.call(this, schema);
|
||||
|
||||
var schemaObj = new SchemaObject({
|
||||
id: id,
|
||||
schema: schema,
|
||||
localRefs: localRefs,
|
||||
cacheKey: cacheKey,
|
||||
meta: meta
|
||||
});
|
||||
|
||||
if (id[0] != '#' && shouldAddSchema) this._refs[id] = schemaObj;
|
||||
this._cache.put(cacheKey, schemaObj);
|
||||
|
||||
if (willValidate && recursiveMeta) this.validateSchema(schema, true);
|
||||
|
||||
return schemaObj;
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function _compile(schemaObj, root) {
|
||||
if (schemaObj.compiling) {
|
||||
schemaObj.validate = callValidate;
|
||||
callValidate.schema = schemaObj.schema;
|
||||
callValidate.errors = null;
|
||||
callValidate.root = root ? root : callValidate;
|
||||
if (schemaObj.schema.$async === true)
|
||||
callValidate.$async = true;
|
||||
return callValidate;
|
||||
}
|
||||
schemaObj.compiling = true;
|
||||
|
||||
var currentOpts;
|
||||
if (schemaObj.meta) {
|
||||
currentOpts = this._opts;
|
||||
this._opts = this._metaOpts;
|
||||
}
|
||||
|
||||
var v;
|
||||
try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); }
|
||||
catch(e) {
|
||||
delete schemaObj.validate;
|
||||
throw e;
|
||||
}
|
||||
finally {
|
||||
schemaObj.compiling = false;
|
||||
if (schemaObj.meta) this._opts = currentOpts;
|
||||
}
|
||||
|
||||
schemaObj.validate = v;
|
||||
schemaObj.refs = v.refs;
|
||||
schemaObj.refVal = v.refVal;
|
||||
schemaObj.root = v.root;
|
||||
return v;
|
||||
|
||||
|
||||
/* @this {*} - custom context, see passContext option */
|
||||
function callValidate() {
|
||||
/* jshint validthis: true */
|
||||
var _validate = schemaObj.validate;
|
||||
var result = _validate.apply(this, arguments);
|
||||
callValidate.errors = _validate.errors;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function chooseGetId(opts) {
|
||||
switch (opts.schemaId) {
|
||||
case 'auto': return _get$IdOrId;
|
||||
case 'id': return _getId;
|
||||
default: return _get$Id;
|
||||
}
|
||||
}
|
||||
|
||||
/* @this Ajv */
|
||||
function _getId(schema) {
|
||||
if (schema.$id) this.logger.warn('schema $id ignored', schema.$id);
|
||||
return schema.id;
|
||||
}
|
||||
|
||||
/* @this Ajv */
|
||||
function _get$Id(schema) {
|
||||
if (schema.id) this.logger.warn('schema id ignored', schema.id);
|
||||
return schema.$id;
|
||||
}
|
||||
|
||||
|
||||
function _get$IdOrId(schema) {
|
||||
if (schema.$id && schema.id && schema.$id != schema.id)
|
||||
throw new Error('schema $id is different from id');
|
||||
return schema.$id || schema.id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert array of error message objects to string
|
||||
* @this Ajv
|
||||
* @param {Array<Object>} errors optional array of validation errors, if not passed errors from the instance are used.
|
||||
* @param {Object} options optional options with properties `separator` and `dataVar`.
|
||||
* @return {String} human readable string with all errors descriptions
|
||||
*/
|
||||
function errorsText(errors, options) {
|
||||
errors = errors || this.errors;
|
||||
if (!errors) return 'No errors';
|
||||
options = options || {};
|
||||
var separator = options.separator === undefined ? ', ' : options.separator;
|
||||
var dataVar = options.dataVar === undefined ? 'data' : options.dataVar;
|
||||
|
||||
var text = '';
|
||||
for (var i=0; i<errors.length; i++) {
|
||||
var e = errors[i];
|
||||
if (e) text += dataVar + e.dataPath + ' ' + e.message + separator;
|
||||
}
|
||||
return text.slice(0, -separator.length);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add custom format
|
||||
* @this Ajv
|
||||
* @param {String} name format name
|
||||
* @param {String|RegExp|Function} format string is converted to RegExp; function should return boolean (true when valid)
|
||||
* @return {Ajv} this for method chaining
|
||||
*/
|
||||
function addFormat(name, format) {
|
||||
if (typeof format == 'string') format = new RegExp(format);
|
||||
this._formats[name] = format;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
function addDefaultMetaSchema(self) {
|
||||
var $dataSchema;
|
||||
if (self._opts.$data) {
|
||||
$dataSchema = require('./refs/data.json');
|
||||
self.addMetaSchema($dataSchema, $dataSchema.$id, true);
|
||||
}
|
||||
if (self._opts.meta === false) return;
|
||||
var metaSchema = require('./refs/json-schema-draft-07.json');
|
||||
if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA);
|
||||
self.addMetaSchema(metaSchema, META_SCHEMA_ID, true);
|
||||
self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID;
|
||||
}
|
||||
|
||||
|
||||
function addInitialSchemas(self) {
|
||||
var optsSchemas = self._opts.schemas;
|
||||
if (!optsSchemas) return;
|
||||
if (Array.isArray(optsSchemas)) self.addSchema(optsSchemas);
|
||||
else for (var key in optsSchemas) self.addSchema(optsSchemas[key], key);
|
||||
}
|
||||
|
||||
|
||||
function addInitialFormats(self) {
|
||||
for (var name in self._opts.formats) {
|
||||
var format = self._opts.formats[name];
|
||||
self.addFormat(name, format);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function addInitialKeywords(self) {
|
||||
for (var name in self._opts.keywords) {
|
||||
var keyword = self._opts.keywords[name];
|
||||
self.addKeyword(name, keyword);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkUnique(self, id) {
|
||||
if (self._schemas[id] || self._refs[id])
|
||||
throw new Error('schema with key or id "' + id + '" already exists');
|
||||
}
|
||||
|
||||
|
||||
function getMetaSchemaOptions(self) {
|
||||
var metaOpts = util.copy(self._opts);
|
||||
for (var i=0; i<META_IGNORE_OPTIONS.length; i++)
|
||||
delete metaOpts[META_IGNORE_OPTIONS[i]];
|
||||
return metaOpts;
|
||||
}
|
||||
|
||||
|
||||
function setLogger(self) {
|
||||
var logger = self._opts.logger;
|
||||
if (logger === false) {
|
||||
self.logger = {log: noop, warn: noop, error: noop};
|
||||
} else {
|
||||
if (logger === undefined) logger = console;
|
||||
if (!(typeof logger == 'object' && logger.log && logger.warn && logger.error))
|
||||
throw new Error('logger must implement log, warn and error methods');
|
||||
self.logger = logger;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function noop() {}
|
26
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/cache.js
generated
vendored
Normal file
26
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/cache.js
generated
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
var Cache = module.exports = function Cache() {
|
||||
this._cache = {};
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.put = function Cache_put(key, value) {
|
||||
this._cache[key] = value;
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.get = function Cache_get(key) {
|
||||
return this._cache[key];
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.del = function Cache_del(key) {
|
||||
delete this._cache[key];
|
||||
};
|
||||
|
||||
|
||||
Cache.prototype.clear = function Cache_clear() {
|
||||
this._cache = {};
|
||||
};
|
90
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/async.js
generated
vendored
Normal file
90
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/async.js
generated
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
'use strict';
|
||||
|
||||
var MissingRefError = require('./error_classes').MissingRef;
|
||||
|
||||
module.exports = compileAsync;
|
||||
|
||||
|
||||
/**
|
||||
* Creates validating function for passed schema with asynchronous loading of missing schemas.
|
||||
* `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema.
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped
|
||||
* @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function.
|
||||
* @return {Promise} promise that resolves with a validating function.
|
||||
*/
|
||||
function compileAsync(schema, meta, callback) {
|
||||
/* eslint no-shadow: 0 */
|
||||
/* global Promise */
|
||||
/* jshint validthis: true */
|
||||
var self = this;
|
||||
if (typeof this._opts.loadSchema != 'function')
|
||||
throw new Error('options.loadSchema should be a function');
|
||||
|
||||
if (typeof meta == 'function') {
|
||||
callback = meta;
|
||||
meta = undefined;
|
||||
}
|
||||
|
||||
var p = loadMetaSchemaOf(schema).then(function () {
|
||||
var schemaObj = self._addSchema(schema, undefined, meta);
|
||||
return schemaObj.validate || _compileAsync(schemaObj);
|
||||
});
|
||||
|
||||
if (callback) {
|
||||
p.then(
|
||||
function(v) { callback(null, v); },
|
||||
callback
|
||||
);
|
||||
}
|
||||
|
||||
return p;
|
||||
|
||||
|
||||
function loadMetaSchemaOf(sch) {
|
||||
var $schema = sch.$schema;
|
||||
return $schema && !self.getSchema($schema)
|
||||
? compileAsync.call(self, { $ref: $schema }, true)
|
||||
: Promise.resolve();
|
||||
}
|
||||
|
||||
|
||||
function _compileAsync(schemaObj) {
|
||||
try { return self._compile(schemaObj); }
|
||||
catch(e) {
|
||||
if (e instanceof MissingRefError) return loadMissingSchema(e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
function loadMissingSchema(e) {
|
||||
var ref = e.missingSchema;
|
||||
if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved');
|
||||
|
||||
var schemaPromise = self._loadingSchemas[ref];
|
||||
if (!schemaPromise) {
|
||||
schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref);
|
||||
schemaPromise.then(removePromise, removePromise);
|
||||
}
|
||||
|
||||
return schemaPromise.then(function (sch) {
|
||||
if (!added(ref)) {
|
||||
return loadMetaSchemaOf(sch).then(function () {
|
||||
if (!added(ref)) self.addSchema(sch, ref, undefined, meta);
|
||||
});
|
||||
}
|
||||
}).then(function() {
|
||||
return _compileAsync(schemaObj);
|
||||
});
|
||||
|
||||
function removePromise() {
|
||||
delete self._loadingSchemas[ref];
|
||||
}
|
||||
|
||||
function added(ref) {
|
||||
return self._refs[ref] || self._schemas[ref];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
5
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/equal.js
generated
vendored
Normal file
5
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/equal.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
// do NOT remove this file - it would break pre-compiled schemas
|
||||
// https://github.com/epoberezkin/ajv/issues/889
|
||||
module.exports = require('fast-deep-equal');
|
34
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/error_classes.js
generated
vendored
Normal file
34
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/error_classes.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
'use strict';
|
||||
|
||||
var resolve = require('./resolve');
|
||||
|
||||
module.exports = {
|
||||
Validation: errorSubclass(ValidationError),
|
||||
MissingRef: errorSubclass(MissingRefError)
|
||||
};
|
||||
|
||||
|
||||
function ValidationError(errors) {
|
||||
this.message = 'validation failed';
|
||||
this.errors = errors;
|
||||
this.ajv = this.validation = true;
|
||||
}
|
||||
|
||||
|
||||
MissingRefError.message = function (baseId, ref) {
|
||||
return 'can\'t resolve reference ' + ref + ' from id ' + baseId;
|
||||
};
|
||||
|
||||
|
||||
function MissingRefError(baseId, ref, message) {
|
||||
this.message = message || MissingRefError.message(baseId, ref);
|
||||
this.missingRef = resolve.url(baseId, ref);
|
||||
this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef));
|
||||
}
|
||||
|
||||
|
||||
function errorSubclass(Subclass) {
|
||||
Subclass.prototype = Object.create(Error.prototype);
|
||||
Subclass.prototype.constructor = Subclass;
|
||||
return Subclass;
|
||||
}
|
142
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/formats.js
generated
vendored
Normal file
142
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/formats.js
generated
vendored
Normal file
@ -0,0 +1,142 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./util');
|
||||
|
||||
var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/;
|
||||
var DAYS = [0,31,28,31,30,31,30,31,31,30,31,30,31];
|
||||
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i;
|
||||
var HOSTNAME = /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i;
|
||||
var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
||||
var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i;
|
||||
// uri-template: https://tools.ietf.org/html/rfc6570
|
||||
var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i;
|
||||
// For the source: https://gist.github.com/dperini/729294
|
||||
// For test cases: https://mathiasbynens.be/demo/url-regex
|
||||
// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983.
|
||||
// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu;
|
||||
var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i;
|
||||
var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;
|
||||
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
||||
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
||||
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
||||
|
||||
|
||||
module.exports = formats;
|
||||
|
||||
function formats(mode) {
|
||||
mode = mode == 'full' ? 'full' : 'fast';
|
||||
return util.copy(formats[mode]);
|
||||
}
|
||||
|
||||
|
||||
formats.fast = {
|
||||
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
|
||||
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
time: /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i,
|
||||
'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i,
|
||||
// uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js
|
||||
uri: /^(?:[a-z][a-z0-9+-.]*:)(?:\/?\/)?[^\s]*$/i,
|
||||
'uri-reference': /^(?:(?:[a-z][a-z0-9+-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i,
|
||||
'uri-template': URITEMPLATE,
|
||||
url: URL,
|
||||
// email (sources from jsen validator):
|
||||
// http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363
|
||||
// http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation')
|
||||
email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i,
|
||||
hostname: HOSTNAME,
|
||||
// optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html
|
||||
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
||||
// optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
|
||||
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
|
||||
regex: regex,
|
||||
// uuid: http://tools.ietf.org/html/rfc4122
|
||||
uuid: UUID,
|
||||
// JSON-pointer: https://tools.ietf.org/html/rfc6901
|
||||
// uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A
|
||||
'json-pointer': JSON_POINTER,
|
||||
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
|
||||
// relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
|
||||
'relative-json-pointer': RELATIVE_JSON_POINTER
|
||||
};
|
||||
|
||||
|
||||
formats.full = {
|
||||
date: date,
|
||||
time: time,
|
||||
'date-time': date_time,
|
||||
uri: uri,
|
||||
'uri-reference': URIREF,
|
||||
'uri-template': URITEMPLATE,
|
||||
url: URL,
|
||||
email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
|
||||
hostname: HOSTNAME,
|
||||
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
||||
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
|
||||
regex: regex,
|
||||
uuid: UUID,
|
||||
'json-pointer': JSON_POINTER,
|
||||
'json-pointer-uri-fragment': JSON_POINTER_URI_FRAGMENT,
|
||||
'relative-json-pointer': RELATIVE_JSON_POINTER
|
||||
};
|
||||
|
||||
|
||||
function isLeapYear(year) {
|
||||
// https://tools.ietf.org/html/rfc3339#appendix-C
|
||||
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
||||
}
|
||||
|
||||
|
||||
function date(str) {
|
||||
// full-date from http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
var matches = str.match(DATE);
|
||||
if (!matches) return false;
|
||||
|
||||
var year = +matches[1];
|
||||
var month = +matches[2];
|
||||
var day = +matches[3];
|
||||
|
||||
return month >= 1 && month <= 12 && day >= 1 &&
|
||||
day <= (month == 2 && isLeapYear(year) ? 29 : DAYS[month]);
|
||||
}
|
||||
|
||||
|
||||
function time(str, full) {
|
||||
var matches = str.match(TIME);
|
||||
if (!matches) return false;
|
||||
|
||||
var hour = matches[1];
|
||||
var minute = matches[2];
|
||||
var second = matches[3];
|
||||
var timeZone = matches[5];
|
||||
return ((hour <= 23 && minute <= 59 && second <= 59) ||
|
||||
(hour == 23 && minute == 59 && second == 60)) &&
|
||||
(!full || timeZone);
|
||||
}
|
||||
|
||||
|
||||
var DATE_TIME_SEPARATOR = /t|\s/i;
|
||||
function date_time(str) {
|
||||
// http://tools.ietf.org/html/rfc3339#section-5.6
|
||||
var dateTime = str.split(DATE_TIME_SEPARATOR);
|
||||
return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true);
|
||||
}
|
||||
|
||||
|
||||
var NOT_URI_FRAGMENT = /\/|:/;
|
||||
function uri(str) {
|
||||
// http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "."
|
||||
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
|
||||
}
|
||||
|
||||
|
||||
var Z_ANCHOR = /[^\\]\\Z/;
|
||||
function regex(str) {
|
||||
if (Z_ANCHOR.test(str)) return false;
|
||||
try {
|
||||
new RegExp(str);
|
||||
return true;
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
387
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/index.js
generated
vendored
Normal file
387
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/index.js
generated
vendored
Normal file
@ -0,0 +1,387 @@
|
||||
'use strict';
|
||||
|
||||
var resolve = require('./resolve')
|
||||
, util = require('./util')
|
||||
, errorClasses = require('./error_classes')
|
||||
, stableStringify = require('fast-json-stable-stringify');
|
||||
|
||||
var validateGenerator = require('../dotjs/validate');
|
||||
|
||||
/**
|
||||
* Functions below are used inside compiled validations function
|
||||
*/
|
||||
|
||||
var ucs2length = util.ucs2length;
|
||||
var equal = require('fast-deep-equal');
|
||||
|
||||
// this error is thrown by async schemas to return validation errors via exception
|
||||
var ValidationError = errorClasses.Validation;
|
||||
|
||||
module.exports = compile;
|
||||
|
||||
|
||||
/**
|
||||
* Compiles schema to validation function
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema object
|
||||
* @param {Object} root object with information about the root schema for this schema
|
||||
* @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution
|
||||
* @param {String} baseId base ID for IDs in the schema
|
||||
* @return {Function} validation function
|
||||
*/
|
||||
function compile(schema, root, localRefs, baseId) {
|
||||
/* jshint validthis: true, evil: true */
|
||||
/* eslint no-shadow: 0 */
|
||||
var self = this
|
||||
, opts = this._opts
|
||||
, refVal = [ undefined ]
|
||||
, refs = {}
|
||||
, patterns = []
|
||||
, patternsHash = {}
|
||||
, defaults = []
|
||||
, defaultsHash = {}
|
||||
, customRules = [];
|
||||
|
||||
root = root || { schema: schema, refVal: refVal, refs: refs };
|
||||
|
||||
var c = checkCompiling.call(this, schema, root, baseId);
|
||||
var compilation = this._compilations[c.index];
|
||||
if (c.compiling) return (compilation.callValidate = callValidate);
|
||||
|
||||
var formats = this._formats;
|
||||
var RULES = this.RULES;
|
||||
|
||||
try {
|
||||
var v = localCompile(schema, root, localRefs, baseId);
|
||||
compilation.validate = v;
|
||||
var cv = compilation.callValidate;
|
||||
if (cv) {
|
||||
cv.schema = v.schema;
|
||||
cv.errors = null;
|
||||
cv.refs = v.refs;
|
||||
cv.refVal = v.refVal;
|
||||
cv.root = v.root;
|
||||
cv.$async = v.$async;
|
||||
if (opts.sourceCode) cv.source = v.source;
|
||||
}
|
||||
return v;
|
||||
} finally {
|
||||
endCompiling.call(this, schema, root, baseId);
|
||||
}
|
||||
|
||||
/* @this {*} - custom context, see passContext option */
|
||||
function callValidate() {
|
||||
/* jshint validthis: true */
|
||||
var validate = compilation.validate;
|
||||
var result = validate.apply(this, arguments);
|
||||
callValidate.errors = validate.errors;
|
||||
return result;
|
||||
}
|
||||
|
||||
function localCompile(_schema, _root, localRefs, baseId) {
|
||||
var isRoot = !_root || (_root && _root.schema == _schema);
|
||||
if (_root.schema != root.schema)
|
||||
return compile.call(self, _schema, _root, localRefs, baseId);
|
||||
|
||||
var $async = _schema.$async === true;
|
||||
|
||||
var sourceCode = validateGenerator({
|
||||
isTop: true,
|
||||
schema: _schema,
|
||||
isRoot: isRoot,
|
||||
baseId: baseId,
|
||||
root: _root,
|
||||
schemaPath: '',
|
||||
errSchemaPath: '#',
|
||||
errorPath: '""',
|
||||
MissingRefError: errorClasses.MissingRef,
|
||||
RULES: RULES,
|
||||
validate: validateGenerator,
|
||||
util: util,
|
||||
resolve: resolve,
|
||||
resolveRef: resolveRef,
|
||||
usePattern: usePattern,
|
||||
useDefault: useDefault,
|
||||
useCustomRule: useCustomRule,
|
||||
opts: opts,
|
||||
formats: formats,
|
||||
logger: self.logger,
|
||||
self: self
|
||||
});
|
||||
|
||||
sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode)
|
||||
+ vars(defaults, defaultCode) + vars(customRules, customRuleCode)
|
||||
+ sourceCode;
|
||||
|
||||
if (opts.processCode) sourceCode = opts.processCode(sourceCode);
|
||||
// console.log('\n\n\n *** \n', JSON.stringify(sourceCode));
|
||||
var validate;
|
||||
try {
|
||||
var makeValidate = new Function(
|
||||
'self',
|
||||
'RULES',
|
||||
'formats',
|
||||
'root',
|
||||
'refVal',
|
||||
'defaults',
|
||||
'customRules',
|
||||
'equal',
|
||||
'ucs2length',
|
||||
'ValidationError',
|
||||
sourceCode
|
||||
);
|
||||
|
||||
validate = makeValidate(
|
||||
self,
|
||||
RULES,
|
||||
formats,
|
||||
root,
|
||||
refVal,
|
||||
defaults,
|
||||
customRules,
|
||||
equal,
|
||||
ucs2length,
|
||||
ValidationError
|
||||
);
|
||||
|
||||
refVal[0] = validate;
|
||||
} catch(e) {
|
||||
self.logger.error('Error compiling schema, function code:', sourceCode);
|
||||
throw e;
|
||||
}
|
||||
|
||||
validate.schema = _schema;
|
||||
validate.errors = null;
|
||||
validate.refs = refs;
|
||||
validate.refVal = refVal;
|
||||
validate.root = isRoot ? validate : _root;
|
||||
if ($async) validate.$async = true;
|
||||
if (opts.sourceCode === true) {
|
||||
validate.source = {
|
||||
code: sourceCode,
|
||||
patterns: patterns,
|
||||
defaults: defaults
|
||||
};
|
||||
}
|
||||
|
||||
return validate;
|
||||
}
|
||||
|
||||
function resolveRef(baseId, ref, isRoot) {
|
||||
ref = resolve.url(baseId, ref);
|
||||
var refIndex = refs[ref];
|
||||
var _refVal, refCode;
|
||||
if (refIndex !== undefined) {
|
||||
_refVal = refVal[refIndex];
|
||||
refCode = 'refVal[' + refIndex + ']';
|
||||
return resolvedRef(_refVal, refCode);
|
||||
}
|
||||
if (!isRoot && root.refs) {
|
||||
var rootRefId = root.refs[ref];
|
||||
if (rootRefId !== undefined) {
|
||||
_refVal = root.refVal[rootRefId];
|
||||
refCode = addLocalRef(ref, _refVal);
|
||||
return resolvedRef(_refVal, refCode);
|
||||
}
|
||||
}
|
||||
|
||||
refCode = addLocalRef(ref);
|
||||
var v = resolve.call(self, localCompile, root, ref);
|
||||
if (v === undefined) {
|
||||
var localSchema = localRefs && localRefs[ref];
|
||||
if (localSchema) {
|
||||
v = resolve.inlineRef(localSchema, opts.inlineRefs)
|
||||
? localSchema
|
||||
: compile.call(self, localSchema, root, localRefs, baseId);
|
||||
}
|
||||
}
|
||||
|
||||
if (v === undefined) {
|
||||
removeLocalRef(ref);
|
||||
} else {
|
||||
replaceLocalRef(ref, v);
|
||||
return resolvedRef(v, refCode);
|
||||
}
|
||||
}
|
||||
|
||||
function addLocalRef(ref, v) {
|
||||
var refId = refVal.length;
|
||||
refVal[refId] = v;
|
||||
refs[ref] = refId;
|
||||
return 'refVal' + refId;
|
||||
}
|
||||
|
||||
function removeLocalRef(ref) {
|
||||
delete refs[ref];
|
||||
}
|
||||
|
||||
function replaceLocalRef(ref, v) {
|
||||
var refId = refs[ref];
|
||||
refVal[refId] = v;
|
||||
}
|
||||
|
||||
function resolvedRef(refVal, code) {
|
||||
return typeof refVal == 'object' || typeof refVal == 'boolean'
|
||||
? { code: code, schema: refVal, inline: true }
|
||||
: { code: code, $async: refVal && !!refVal.$async };
|
||||
}
|
||||
|
||||
function usePattern(regexStr) {
|
||||
var index = patternsHash[regexStr];
|
||||
if (index === undefined) {
|
||||
index = patternsHash[regexStr] = patterns.length;
|
||||
patterns[index] = regexStr;
|
||||
}
|
||||
return 'pattern' + index;
|
||||
}
|
||||
|
||||
function useDefault(value) {
|
||||
switch (typeof value) {
|
||||
case 'boolean':
|
||||
case 'number':
|
||||
return '' + value;
|
||||
case 'string':
|
||||
return util.toQuotedString(value);
|
||||
case 'object':
|
||||
if (value === null) return 'null';
|
||||
var valueStr = stableStringify(value);
|
||||
var index = defaultsHash[valueStr];
|
||||
if (index === undefined) {
|
||||
index = defaultsHash[valueStr] = defaults.length;
|
||||
defaults[index] = value;
|
||||
}
|
||||
return 'default' + index;
|
||||
}
|
||||
}
|
||||
|
||||
function useCustomRule(rule, schema, parentSchema, it) {
|
||||
if (self._opts.validateSchema !== false) {
|
||||
var deps = rule.definition.dependencies;
|
||||
if (deps && !deps.every(function(keyword) {
|
||||
return Object.prototype.hasOwnProperty.call(parentSchema, keyword);
|
||||
}))
|
||||
throw new Error('parent schema must have all required keywords: ' + deps.join(','));
|
||||
|
||||
var validateSchema = rule.definition.validateSchema;
|
||||
if (validateSchema) {
|
||||
var valid = validateSchema(schema);
|
||||
if (!valid) {
|
||||
var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors);
|
||||
if (self._opts.validateSchema == 'log') self.logger.error(message);
|
||||
else throw new Error(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var compile = rule.definition.compile
|
||||
, inline = rule.definition.inline
|
||||
, macro = rule.definition.macro;
|
||||
|
||||
var validate;
|
||||
if (compile) {
|
||||
validate = compile.call(self, schema, parentSchema, it);
|
||||
} else if (macro) {
|
||||
validate = macro.call(self, schema, parentSchema, it);
|
||||
if (opts.validateSchema !== false) self.validateSchema(validate, true);
|
||||
} else if (inline) {
|
||||
validate = inline.call(self, it, rule.keyword, schema, parentSchema);
|
||||
} else {
|
||||
validate = rule.definition.validate;
|
||||
if (!validate) return;
|
||||
}
|
||||
|
||||
if (validate === undefined)
|
||||
throw new Error('custom keyword "' + rule.keyword + '"failed to compile');
|
||||
|
||||
var index = customRules.length;
|
||||
customRules[index] = validate;
|
||||
|
||||
return {
|
||||
code: 'customRule' + index,
|
||||
validate: validate
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks if the schema is currently compiled
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
* @return {Object} object with properties "index" (compilation index) and "compiling" (boolean)
|
||||
*/
|
||||
function checkCompiling(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
var index = compIndex.call(this, schema, root, baseId);
|
||||
if (index >= 0) return { index: index, compiling: true };
|
||||
index = this._compilations.length;
|
||||
this._compilations[index] = {
|
||||
schema: schema,
|
||||
root: root,
|
||||
baseId: baseId
|
||||
};
|
||||
return { index: index, compiling: false };
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the schema from the currently compiled list
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
*/
|
||||
function endCompiling(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
var i = compIndex.call(this, schema, root, baseId);
|
||||
if (i >= 0) this._compilations.splice(i, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Index of schema compilation in the currently compiled list
|
||||
* @this Ajv
|
||||
* @param {Object} schema schema to compile
|
||||
* @param {Object} root root object
|
||||
* @param {String} baseId base schema ID
|
||||
* @return {Integer} compilation index
|
||||
*/
|
||||
function compIndex(schema, root, baseId) {
|
||||
/* jshint validthis: true */
|
||||
for (var i=0; i<this._compilations.length; i++) {
|
||||
var c = this._compilations[i];
|
||||
if (c.schema == schema && c.root == root && c.baseId == baseId) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
function patternCode(i, patterns) {
|
||||
return 'var pattern' + i + ' = new RegExp(' + util.toQuotedString(patterns[i]) + ');';
|
||||
}
|
||||
|
||||
|
||||
function defaultCode(i) {
|
||||
return 'var default' + i + ' = defaults[' + i + '];';
|
||||
}
|
||||
|
||||
|
||||
function refValCode(i, refVal) {
|
||||
return refVal[i] === undefined ? '' : 'var refVal' + i + ' = refVal[' + i + '];';
|
||||
}
|
||||
|
||||
|
||||
function customRuleCode(i) {
|
||||
return 'var customRule' + i + ' = customRules[' + i + '];';
|
||||
}
|
||||
|
||||
|
||||
function vars(arr, statement) {
|
||||
if (!arr.length) return '';
|
||||
var code = '';
|
||||
for (var i=0; i<arr.length; i++)
|
||||
code += statement(i, arr);
|
||||
return code;
|
||||
}
|
270
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/resolve.js
generated
vendored
Normal file
270
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/resolve.js
generated
vendored
Normal file
@ -0,0 +1,270 @@
|
||||
'use strict';
|
||||
|
||||
var URI = require('uri-js')
|
||||
, equal = require('fast-deep-equal')
|
||||
, util = require('./util')
|
||||
, SchemaObject = require('./schema_obj')
|
||||
, traverse = require('json-schema-traverse');
|
||||
|
||||
module.exports = resolve;
|
||||
|
||||
resolve.normalizeId = normalizeId;
|
||||
resolve.fullPath = getFullPath;
|
||||
resolve.url = resolveUrl;
|
||||
resolve.ids = resolveIds;
|
||||
resolve.inlineRef = inlineRef;
|
||||
resolve.schema = resolveSchema;
|
||||
|
||||
/**
|
||||
* [resolve and compile the references ($ref)]
|
||||
* @this Ajv
|
||||
* @param {Function} compile reference to schema compilation funciton (localCompile)
|
||||
* @param {Object} root object with information about the root schema for the current schema
|
||||
* @param {String} ref reference to resolve
|
||||
* @return {Object|Function} schema object (if the schema can be inlined) or validation function
|
||||
*/
|
||||
function resolve(compile, root, ref) {
|
||||
/* jshint validthis: true */
|
||||
var refVal = this._refs[ref];
|
||||
if (typeof refVal == 'string') {
|
||||
if (this._refs[refVal]) refVal = this._refs[refVal];
|
||||
else return resolve.call(this, compile, root, refVal);
|
||||
}
|
||||
|
||||
refVal = refVal || this._schemas[ref];
|
||||
if (refVal instanceof SchemaObject) {
|
||||
return inlineRef(refVal.schema, this._opts.inlineRefs)
|
||||
? refVal.schema
|
||||
: refVal.validate || this._compile(refVal);
|
||||
}
|
||||
|
||||
var res = resolveSchema.call(this, root, ref);
|
||||
var schema, v, baseId;
|
||||
if (res) {
|
||||
schema = res.schema;
|
||||
root = res.root;
|
||||
baseId = res.baseId;
|
||||
}
|
||||
|
||||
if (schema instanceof SchemaObject) {
|
||||
v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId);
|
||||
} else if (schema !== undefined) {
|
||||
v = inlineRef(schema, this._opts.inlineRefs)
|
||||
? schema
|
||||
: compile.call(this, schema, root, undefined, baseId);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resolve schema, its root and baseId
|
||||
* @this Ajv
|
||||
* @param {Object} root root object with properties schema, refVal, refs
|
||||
* @param {String} ref reference to resolve
|
||||
* @return {Object} object with properties schema, root, baseId
|
||||
*/
|
||||
function resolveSchema(root, ref) {
|
||||
/* jshint validthis: true */
|
||||
var p = URI.parse(ref)
|
||||
, refPath = _getFullPath(p)
|
||||
, baseId = getFullPath(this._getId(root.schema));
|
||||
if (Object.keys(root.schema).length === 0 || refPath !== baseId) {
|
||||
var id = normalizeId(refPath);
|
||||
var refVal = this._refs[id];
|
||||
if (typeof refVal == 'string') {
|
||||
return resolveRecursive.call(this, root, refVal, p);
|
||||
} else if (refVal instanceof SchemaObject) {
|
||||
if (!refVal.validate) this._compile(refVal);
|
||||
root = refVal;
|
||||
} else {
|
||||
refVal = this._schemas[id];
|
||||
if (refVal instanceof SchemaObject) {
|
||||
if (!refVal.validate) this._compile(refVal);
|
||||
if (id == normalizeId(ref))
|
||||
return { schema: refVal, root: root, baseId: baseId };
|
||||
root = refVal;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!root.schema) return;
|
||||
baseId = getFullPath(this._getId(root.schema));
|
||||
}
|
||||
return getJsonPointer.call(this, p, baseId, root.schema, root);
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function resolveRecursive(root, ref, parsedRef) {
|
||||
/* jshint validthis: true */
|
||||
var res = resolveSchema.call(this, root, ref);
|
||||
if (res) {
|
||||
var schema = res.schema;
|
||||
var baseId = res.baseId;
|
||||
root = res.root;
|
||||
var id = this._getId(schema);
|
||||
if (id) baseId = resolveUrl(baseId, id);
|
||||
return getJsonPointer.call(this, parsedRef, baseId, schema, root);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']);
|
||||
/* @this Ajv */
|
||||
function getJsonPointer(parsedRef, baseId, schema, root) {
|
||||
/* jshint validthis: true */
|
||||
parsedRef.fragment = parsedRef.fragment || '';
|
||||
if (parsedRef.fragment.slice(0,1) != '/') return;
|
||||
var parts = parsedRef.fragment.split('/');
|
||||
|
||||
for (var i = 1; i < parts.length; i++) {
|
||||
var part = parts[i];
|
||||
if (part) {
|
||||
part = util.unescapeFragment(part);
|
||||
schema = schema[part];
|
||||
if (schema === undefined) break;
|
||||
var id;
|
||||
if (!PREVENT_SCOPE_CHANGE[part]) {
|
||||
id = this._getId(schema);
|
||||
if (id) baseId = resolveUrl(baseId, id);
|
||||
if (schema.$ref) {
|
||||
var $ref = resolveUrl(baseId, schema.$ref);
|
||||
var res = resolveSchema.call(this, root, $ref);
|
||||
if (res) {
|
||||
schema = res.schema;
|
||||
root = res.root;
|
||||
baseId = res.baseId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (schema !== undefined && schema !== root.schema)
|
||||
return { schema: schema, root: root, baseId: baseId };
|
||||
}
|
||||
|
||||
|
||||
var SIMPLE_INLINED = util.toHash([
|
||||
'type', 'format', 'pattern',
|
||||
'maxLength', 'minLength',
|
||||
'maxProperties', 'minProperties',
|
||||
'maxItems', 'minItems',
|
||||
'maximum', 'minimum',
|
||||
'uniqueItems', 'multipleOf',
|
||||
'required', 'enum'
|
||||
]);
|
||||
function inlineRef(schema, limit) {
|
||||
if (limit === false) return false;
|
||||
if (limit === undefined || limit === true) return checkNoRef(schema);
|
||||
else if (limit) return countKeys(schema) <= limit;
|
||||
}
|
||||
|
||||
|
||||
function checkNoRef(schema) {
|
||||
var item;
|
||||
if (Array.isArray(schema)) {
|
||||
for (var i=0; i<schema.length; i++) {
|
||||
item = schema[i];
|
||||
if (typeof item == 'object' && !checkNoRef(item)) return false;
|
||||
}
|
||||
} else {
|
||||
for (var key in schema) {
|
||||
if (key == '$ref') return false;
|
||||
item = schema[key];
|
||||
if (typeof item == 'object' && !checkNoRef(item)) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function countKeys(schema) {
|
||||
var count = 0, item;
|
||||
if (Array.isArray(schema)) {
|
||||
for (var i=0; i<schema.length; i++) {
|
||||
item = schema[i];
|
||||
if (typeof item == 'object') count += countKeys(item);
|
||||
if (count == Infinity) return Infinity;
|
||||
}
|
||||
} else {
|
||||
for (var key in schema) {
|
||||
if (key == '$ref') return Infinity;
|
||||
if (SIMPLE_INLINED[key]) {
|
||||
count++;
|
||||
} else {
|
||||
item = schema[key];
|
||||
if (typeof item == 'object') count += countKeys(item) + 1;
|
||||
if (count == Infinity) return Infinity;
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
function getFullPath(id, normalize) {
|
||||
if (normalize !== false) id = normalizeId(id);
|
||||
var p = URI.parse(id);
|
||||
return _getFullPath(p);
|
||||
}
|
||||
|
||||
|
||||
function _getFullPath(p) {
|
||||
return URI.serialize(p).split('#')[0] + '#';
|
||||
}
|
||||
|
||||
|
||||
var TRAILING_SLASH_HASH = /#\/?$/;
|
||||
function normalizeId(id) {
|
||||
return id ? id.replace(TRAILING_SLASH_HASH, '') : '';
|
||||
}
|
||||
|
||||
|
||||
function resolveUrl(baseId, id) {
|
||||
id = normalizeId(id);
|
||||
return URI.resolve(baseId, id);
|
||||
}
|
||||
|
||||
|
||||
/* @this Ajv */
|
||||
function resolveIds(schema) {
|
||||
var schemaId = normalizeId(this._getId(schema));
|
||||
var baseIds = {'': schemaId};
|
||||
var fullPaths = {'': getFullPath(schemaId, false)};
|
||||
var localRefs = {};
|
||||
var self = this;
|
||||
|
||||
traverse(schema, {allKeys: true}, function(sch, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) {
|
||||
if (jsonPtr === '') return;
|
||||
var id = self._getId(sch);
|
||||
var baseId = baseIds[parentJsonPtr];
|
||||
var fullPath = fullPaths[parentJsonPtr] + '/' + parentKeyword;
|
||||
if (keyIndex !== undefined)
|
||||
fullPath += '/' + (typeof keyIndex == 'number' ? keyIndex : util.escapeFragment(keyIndex));
|
||||
|
||||
if (typeof id == 'string') {
|
||||
id = baseId = normalizeId(baseId ? URI.resolve(baseId, id) : id);
|
||||
|
||||
var refVal = self._refs[id];
|
||||
if (typeof refVal == 'string') refVal = self._refs[refVal];
|
||||
if (refVal && refVal.schema) {
|
||||
if (!equal(sch, refVal.schema))
|
||||
throw new Error('id "' + id + '" resolves to more than one schema');
|
||||
} else if (id != normalizeId(fullPath)) {
|
||||
if (id[0] == '#') {
|
||||
if (localRefs[id] && !equal(sch, localRefs[id]))
|
||||
throw new Error('id "' + id + '" resolves to more than one schema');
|
||||
localRefs[id] = sch;
|
||||
} else {
|
||||
self._refs[id] = fullPath;
|
||||
}
|
||||
}
|
||||
}
|
||||
baseIds[jsonPtr] = baseId;
|
||||
fullPaths[jsonPtr] = fullPath;
|
||||
});
|
||||
|
||||
return localRefs;
|
||||
}
|
66
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/rules.js
generated
vendored
Normal file
66
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/rules.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
'use strict';
|
||||
|
||||
var ruleModules = require('../dotjs')
|
||||
, toHash = require('./util').toHash;
|
||||
|
||||
module.exports = function rules() {
|
||||
var RULES = [
|
||||
{ type: 'number',
|
||||
rules: [ { 'maximum': ['exclusiveMaximum'] },
|
||||
{ 'minimum': ['exclusiveMinimum'] }, 'multipleOf', 'format'] },
|
||||
{ type: 'string',
|
||||
rules: [ 'maxLength', 'minLength', 'pattern', 'format' ] },
|
||||
{ type: 'array',
|
||||
rules: [ 'maxItems', 'minItems', 'items', 'contains', 'uniqueItems' ] },
|
||||
{ type: 'object',
|
||||
rules: [ 'maxProperties', 'minProperties', 'required', 'dependencies', 'propertyNames',
|
||||
{ 'properties': ['additionalProperties', 'patternProperties'] } ] },
|
||||
{ rules: [ '$ref', 'const', 'enum', 'not', 'anyOf', 'oneOf', 'allOf', 'if' ] }
|
||||
];
|
||||
|
||||
var ALL = [ 'type', '$comment' ];
|
||||
var KEYWORDS = [
|
||||
'$schema', '$id', 'id', '$data', '$async', 'title',
|
||||
'description', 'default', 'definitions',
|
||||
'examples', 'readOnly', 'writeOnly',
|
||||
'contentMediaType', 'contentEncoding',
|
||||
'additionalItems', 'then', 'else'
|
||||
];
|
||||
var TYPES = [ 'number', 'integer', 'string', 'array', 'object', 'boolean', 'null' ];
|
||||
RULES.all = toHash(ALL);
|
||||
RULES.types = toHash(TYPES);
|
||||
|
||||
RULES.forEach(function (group) {
|
||||
group.rules = group.rules.map(function (keyword) {
|
||||
var implKeywords;
|
||||
if (typeof keyword == 'object') {
|
||||
var key = Object.keys(keyword)[0];
|
||||
implKeywords = keyword[key];
|
||||
keyword = key;
|
||||
implKeywords.forEach(function (k) {
|
||||
ALL.push(k);
|
||||
RULES.all[k] = true;
|
||||
});
|
||||
}
|
||||
ALL.push(keyword);
|
||||
var rule = RULES.all[keyword] = {
|
||||
keyword: keyword,
|
||||
code: ruleModules[keyword],
|
||||
implements: implKeywords
|
||||
};
|
||||
return rule;
|
||||
});
|
||||
|
||||
RULES.all.$comment = {
|
||||
keyword: '$comment',
|
||||
code: ruleModules.$comment
|
||||
};
|
||||
|
||||
if (group.type) RULES.types[group.type] = group;
|
||||
});
|
||||
|
||||
RULES.keywords = toHash(ALL.concat(KEYWORDS));
|
||||
RULES.custom = {};
|
||||
|
||||
return RULES;
|
||||
};
|
9
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/schema_obj.js
generated
vendored
Normal file
9
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/schema_obj.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./util');
|
||||
|
||||
module.exports = SchemaObject;
|
||||
|
||||
function SchemaObject(obj) {
|
||||
util.copy(obj, this);
|
||||
}
|
20
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/ucs2length.js
generated
vendored
Normal file
20
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/ucs2length.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
// https://mathiasbynens.be/notes/javascript-encoding
|
||||
// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode
|
||||
module.exports = function ucs2length(str) {
|
||||
var length = 0
|
||||
, len = str.length
|
||||
, pos = 0
|
||||
, value;
|
||||
while (pos < len) {
|
||||
length++;
|
||||
value = str.charCodeAt(pos++);
|
||||
if (value >= 0xD800 && value <= 0xDBFF && pos < len) {
|
||||
// high surrogate, and there is a next character
|
||||
value = str.charCodeAt(pos);
|
||||
if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate
|
||||
}
|
||||
}
|
||||
return length;
|
||||
};
|
274
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/util.js
generated
vendored
Normal file
274
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/compile/util.js
generated
vendored
Normal file
@ -0,0 +1,274 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
module.exports = {
|
||||
copy: copy,
|
||||
checkDataType: checkDataType,
|
||||
checkDataTypes: checkDataTypes,
|
||||
coerceToTypes: coerceToTypes,
|
||||
toHash: toHash,
|
||||
getProperty: getProperty,
|
||||
escapeQuotes: escapeQuotes,
|
||||
equal: require('fast-deep-equal'),
|
||||
ucs2length: require('./ucs2length'),
|
||||
varOccurences: varOccurences,
|
||||
varReplace: varReplace,
|
||||
cleanUpCode: cleanUpCode,
|
||||
finalCleanUpCode: finalCleanUpCode,
|
||||
schemaHasRules: schemaHasRules,
|
||||
schemaHasRulesExcept: schemaHasRulesExcept,
|
||||
schemaUnknownRules: schemaUnknownRules,
|
||||
toQuotedString: toQuotedString,
|
||||
getPathExpr: getPathExpr,
|
||||
getPath: getPath,
|
||||
getData: getData,
|
||||
unescapeFragment: unescapeFragment,
|
||||
unescapeJsonPointer: unescapeJsonPointer,
|
||||
escapeFragment: escapeFragment,
|
||||
escapeJsonPointer: escapeJsonPointer
|
||||
};
|
||||
|
||||
|
||||
function copy(o, to) {
|
||||
to = to || {};
|
||||
for (var key in o) to[key] = o[key];
|
||||
return to;
|
||||
}
|
||||
|
||||
|
||||
function checkDataType(dataType, data, negate) {
|
||||
var EQUAL = negate ? ' !== ' : ' === '
|
||||
, AND = negate ? ' || ' : ' && '
|
||||
, OK = negate ? '!' : ''
|
||||
, NOT = negate ? '' : '!';
|
||||
switch (dataType) {
|
||||
case 'null': return data + EQUAL + 'null';
|
||||
case 'array': return OK + 'Array.isArray(' + data + ')';
|
||||
case 'object': return '(' + OK + data + AND +
|
||||
'typeof ' + data + EQUAL + '"object"' + AND +
|
||||
NOT + 'Array.isArray(' + data + '))';
|
||||
case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND +
|
||||
NOT + '(' + data + ' % 1)' +
|
||||
AND + data + EQUAL + data + ')';
|
||||
default: return 'typeof ' + data + EQUAL + '"' + dataType + '"';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function checkDataTypes(dataTypes, data) {
|
||||
switch (dataTypes.length) {
|
||||
case 1: return checkDataType(dataTypes[0], data, true);
|
||||
default:
|
||||
var code = '';
|
||||
var types = toHash(dataTypes);
|
||||
if (types.array && types.object) {
|
||||
code = types.null ? '(': '(!' + data + ' || ';
|
||||
code += 'typeof ' + data + ' !== "object")';
|
||||
delete types.null;
|
||||
delete types.array;
|
||||
delete types.object;
|
||||
}
|
||||
if (types.number) delete types.integer;
|
||||
for (var t in types)
|
||||
code += (code ? ' && ' : '' ) + checkDataType(t, data, true);
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]);
|
||||
function coerceToTypes(optionCoerceTypes, dataTypes) {
|
||||
if (Array.isArray(dataTypes)) {
|
||||
var types = [];
|
||||
for (var i=0; i<dataTypes.length; i++) {
|
||||
var t = dataTypes[i];
|
||||
if (COERCE_TO_TYPES[t]) types[types.length] = t;
|
||||
else if (optionCoerceTypes === 'array' && t === 'array') types[types.length] = t;
|
||||
}
|
||||
if (types.length) return types;
|
||||
} else if (COERCE_TO_TYPES[dataTypes]) {
|
||||
return [dataTypes];
|
||||
} else if (optionCoerceTypes === 'array' && dataTypes === 'array') {
|
||||
return ['array'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function toHash(arr) {
|
||||
var hash = {};
|
||||
for (var i=0; i<arr.length; i++) hash[arr[i]] = true;
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
||||
var SINGLE_QUOTE = /'|\\/g;
|
||||
function getProperty(key) {
|
||||
return typeof key == 'number'
|
||||
? '[' + key + ']'
|
||||
: IDENTIFIER.test(key)
|
||||
? '.' + key
|
||||
: "['" + escapeQuotes(key) + "']";
|
||||
}
|
||||
|
||||
|
||||
function escapeQuotes(str) {
|
||||
return str.replace(SINGLE_QUOTE, '\\$&')
|
||||
.replace(/\n/g, '\\n')
|
||||
.replace(/\r/g, '\\r')
|
||||
.replace(/\f/g, '\\f')
|
||||
.replace(/\t/g, '\\t');
|
||||
}
|
||||
|
||||
|
||||
function varOccurences(str, dataVar) {
|
||||
dataVar += '[^0-9]';
|
||||
var matches = str.match(new RegExp(dataVar, 'g'));
|
||||
return matches ? matches.length : 0;
|
||||
}
|
||||
|
||||
|
||||
function varReplace(str, dataVar, expr) {
|
||||
dataVar += '([^0-9])';
|
||||
expr = expr.replace(/\$/g, '$$$$');
|
||||
return str.replace(new RegExp(dataVar, 'g'), expr + '$1');
|
||||
}
|
||||
|
||||
|
||||
var EMPTY_ELSE = /else\s*{\s*}/g
|
||||
, EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g
|
||||
, EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g;
|
||||
function cleanUpCode(out) {
|
||||
return out.replace(EMPTY_ELSE, '')
|
||||
.replace(EMPTY_IF_NO_ELSE, '')
|
||||
.replace(EMPTY_IF_WITH_ELSE, 'if (!($1))');
|
||||
}
|
||||
|
||||
|
||||
var ERRORS_REGEXP = /[^v.]errors/g
|
||||
, REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g
|
||||
, REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g
|
||||
, RETURN_VALID = 'return errors === 0;'
|
||||
, RETURN_TRUE = 'validate.errors = null; return true;'
|
||||
, RETURN_ASYNC = /if \(errors === 0\) return data;\s*else throw new ValidationError\(vErrors\);/
|
||||
, RETURN_DATA_ASYNC = 'return data;'
|
||||
, ROOTDATA_REGEXP = /[^A-Za-z_$]rootData[^A-Za-z0-9_$]/g
|
||||
, REMOVE_ROOTDATA = /if \(rootData === undefined\) rootData = data;/;
|
||||
|
||||
function finalCleanUpCode(out, async) {
|
||||
var matches = out.match(ERRORS_REGEXP);
|
||||
if (matches && matches.length == 2) {
|
||||
out = async
|
||||
? out.replace(REMOVE_ERRORS_ASYNC, '')
|
||||
.replace(RETURN_ASYNC, RETURN_DATA_ASYNC)
|
||||
: out.replace(REMOVE_ERRORS, '')
|
||||
.replace(RETURN_VALID, RETURN_TRUE);
|
||||
}
|
||||
|
||||
matches = out.match(ROOTDATA_REGEXP);
|
||||
if (!matches || matches.length !== 3) return out;
|
||||
return out.replace(REMOVE_ROOTDATA, '');
|
||||
}
|
||||
|
||||
|
||||
function schemaHasRules(schema, rules) {
|
||||
if (typeof schema == 'boolean') return !schema;
|
||||
for (var key in schema) if (rules[key]) return true;
|
||||
}
|
||||
|
||||
|
||||
function schemaHasRulesExcept(schema, rules, exceptKeyword) {
|
||||
if (typeof schema == 'boolean') return !schema && exceptKeyword != 'not';
|
||||
for (var key in schema) if (key != exceptKeyword && rules[key]) return true;
|
||||
}
|
||||
|
||||
|
||||
function schemaUnknownRules(schema, rules) {
|
||||
if (typeof schema == 'boolean') return;
|
||||
for (var key in schema) if (!rules[key]) return key;
|
||||
}
|
||||
|
||||
|
||||
function toQuotedString(str) {
|
||||
return '\'' + escapeQuotes(str) + '\'';
|
||||
}
|
||||
|
||||
|
||||
function getPathExpr(currentPath, expr, jsonPointers, isNumber) {
|
||||
var path = jsonPointers // false by default
|
||||
? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')')
|
||||
: (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\'');
|
||||
return joinPaths(currentPath, path);
|
||||
}
|
||||
|
||||
|
||||
function getPath(currentPath, prop, jsonPointers) {
|
||||
var path = jsonPointers // false by default
|
||||
? toQuotedString('/' + escapeJsonPointer(prop))
|
||||
: toQuotedString(getProperty(prop));
|
||||
return joinPaths(currentPath, path);
|
||||
}
|
||||
|
||||
|
||||
var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/;
|
||||
var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;
|
||||
function getData($data, lvl, paths) {
|
||||
var up, jsonPointer, data, matches;
|
||||
if ($data === '') return 'rootData';
|
||||
if ($data[0] == '/') {
|
||||
if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data);
|
||||
jsonPointer = $data;
|
||||
data = 'rootData';
|
||||
} else {
|
||||
matches = $data.match(RELATIVE_JSON_POINTER);
|
||||
if (!matches) throw new Error('Invalid JSON-pointer: ' + $data);
|
||||
up = +matches[1];
|
||||
jsonPointer = matches[2];
|
||||
if (jsonPointer == '#') {
|
||||
if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl);
|
||||
return paths[lvl - up];
|
||||
}
|
||||
|
||||
if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl);
|
||||
data = 'data' + ((lvl - up) || '');
|
||||
if (!jsonPointer) return data;
|
||||
}
|
||||
|
||||
var expr = data;
|
||||
var segments = jsonPointer.split('/');
|
||||
for (var i=0; i<segments.length; i++) {
|
||||
var segment = segments[i];
|
||||
if (segment) {
|
||||
data += getProperty(unescapeJsonPointer(segment));
|
||||
expr += ' && ' + data;
|
||||
}
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
|
||||
function joinPaths (a, b) {
|
||||
if (a == '""') return b;
|
||||
return (a + ' + ' + b).replace(/' \+ '/g, '');
|
||||
}
|
||||
|
||||
|
||||
function unescapeFragment(str) {
|
||||
return unescapeJsonPointer(decodeURIComponent(str));
|
||||
}
|
||||
|
||||
|
||||
function escapeFragment(str) {
|
||||
return encodeURIComponent(escapeJsonPointer(str));
|
||||
}
|
||||
|
||||
|
||||
function escapeJsonPointer(str) {
|
||||
return str.replace(/~/g, '~0').replace(/\//g, '~1');
|
||||
}
|
||||
|
||||
|
||||
function unescapeJsonPointer(str) {
|
||||
return str.replace(/~1/g, '/').replace(/~0/g, '~');
|
||||
}
|
49
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/data.js
generated
vendored
Normal file
49
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/data.js
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
'use strict';
|
||||
|
||||
var KEYWORDS = [
|
||||
'multipleOf',
|
||||
'maximum',
|
||||
'exclusiveMaximum',
|
||||
'minimum',
|
||||
'exclusiveMinimum',
|
||||
'maxLength',
|
||||
'minLength',
|
||||
'pattern',
|
||||
'additionalItems',
|
||||
'maxItems',
|
||||
'minItems',
|
||||
'uniqueItems',
|
||||
'maxProperties',
|
||||
'minProperties',
|
||||
'required',
|
||||
'additionalProperties',
|
||||
'enum',
|
||||
'format',
|
||||
'const'
|
||||
];
|
||||
|
||||
module.exports = function (metaSchema, keywordsJsonPointers) {
|
||||
for (var i=0; i<keywordsJsonPointers.length; i++) {
|
||||
metaSchema = JSON.parse(JSON.stringify(metaSchema));
|
||||
var segments = keywordsJsonPointers[i].split('/');
|
||||
var keywords = metaSchema;
|
||||
var j;
|
||||
for (j=1; j<segments.length; j++)
|
||||
keywords = keywords[segments[j]];
|
||||
|
||||
for (j=0; j<KEYWORDS.length; j++) {
|
||||
var key = KEYWORDS[j];
|
||||
var schema = keywords[key];
|
||||
if (schema) {
|
||||
keywords[key] = {
|
||||
anyOf: [
|
||||
schema,
|
||||
{ $ref: 'https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/data.json#' }
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return metaSchema;
|
||||
};
|
37
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/definition_schema.js
generated
vendored
Normal file
37
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/definition_schema.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var metaSchema = require('./refs/json-schema-draft-07.json');
|
||||
|
||||
module.exports = {
|
||||
$id: 'https://github.com/epoberezkin/ajv/blob/master/lib/definition_schema.js',
|
||||
definitions: {
|
||||
simpleTypes: metaSchema.definitions.simpleTypes
|
||||
},
|
||||
type: 'object',
|
||||
dependencies: {
|
||||
schema: ['validate'],
|
||||
$data: ['validate'],
|
||||
statements: ['inline'],
|
||||
valid: {not: {required: ['macro']}}
|
||||
},
|
||||
properties: {
|
||||
type: metaSchema.properties.type,
|
||||
schema: {type: 'boolean'},
|
||||
statements: {type: 'boolean'},
|
||||
dependencies: {
|
||||
type: 'array',
|
||||
items: {type: 'string'}
|
||||
},
|
||||
metaSchema: {type: 'object'},
|
||||
modifying: {type: 'boolean'},
|
||||
valid: {type: 'boolean'},
|
||||
$data: {type: 'boolean'},
|
||||
async: {type: 'boolean'},
|
||||
errors: {
|
||||
anyOf: [
|
||||
{type: 'boolean'},
|
||||
{const: 'full'}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
104
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/_limit.jst
generated
vendored
Normal file
104
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/_limit.jst
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{## def.setExclusiveLimit:
|
||||
$exclusive = true;
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
#}}
|
||||
|
||||
{{
|
||||
var $isMax = $keyword == 'maximum'
|
||||
, $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum'
|
||||
, $schemaExcl = it.schema[$exclusiveKeyword]
|
||||
, $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data
|
||||
, $op = $isMax ? '<' : '>'
|
||||
, $notOp = $isMax ? '>' : '<'
|
||||
, $errorKeyword = undefined;
|
||||
}}
|
||||
|
||||
{{? $isDataExcl }}
|
||||
{{
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
|
||||
, $exclusive = 'exclusive' + $lvl
|
||||
, $exclType = 'exclType' + $lvl
|
||||
, $exclIsNumber = 'exclIsNumber' + $lvl
|
||||
, $opExpr = 'op' + $lvl
|
||||
, $opStr = '\' + ' + $opExpr + ' + \'';
|
||||
}}
|
||||
var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
|
||||
{{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
|
||||
|
||||
var {{=$exclusive}};
|
||||
var {{=$exclType}} = typeof {{=$schemaValueExcl}};
|
||||
if ({{=$exclType}} != 'boolean' && {{=$exclType}} != 'undefined' && {{=$exclType}} != 'number') {
|
||||
{{ var $errorKeyword = $exclusiveKeyword; }}
|
||||
{{# def.error:'_exclusiveLimit' }}
|
||||
} else if ({{# def.$dataNotType:'number' }}
|
||||
{{=$exclType}} == 'number'
|
||||
? (
|
||||
({{=$exclusive}} = {{=$schemaValue}} === undefined || {{=$schemaValueExcl}} {{=$op}}= {{=$schemaValue}})
|
||||
? {{=$data}} {{=$notOp}}= {{=$schemaValueExcl}}
|
||||
: {{=$data}} {{=$notOp}} {{=$schemaValue}}
|
||||
)
|
||||
: (
|
||||
({{=$exclusive}} = {{=$schemaValueExcl}} === true)
|
||||
? {{=$data}} {{=$notOp}}= {{=$schemaValue}}
|
||||
: {{=$data}} {{=$notOp}} {{=$schemaValue}}
|
||||
)
|
||||
|| {{=$data}} !== {{=$data}}) {
|
||||
var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}=';
|
||||
{{
|
||||
if ($schema === undefined) {
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
$schemaValue = $schemaValueExcl;
|
||||
$isData = $isDataExcl;
|
||||
}
|
||||
}}
|
||||
{{??}}
|
||||
{{
|
||||
var $exclIsNumber = typeof $schemaExcl == 'number'
|
||||
, $opStr = $op; /*used in error*/
|
||||
}}
|
||||
|
||||
{{? $exclIsNumber && $isData }}
|
||||
{{ var $opExpr = '\'' + $opStr + '\''; /*used in error*/ }}
|
||||
if ({{# def.$dataNotType:'number' }}
|
||||
( {{=$schemaValue}} === undefined
|
||||
|| {{=$schemaExcl}} {{=$op}}= {{=$schemaValue}}
|
||||
? {{=$data}} {{=$notOp}}= {{=$schemaExcl}}
|
||||
: {{=$data}} {{=$notOp}} {{=$schemaValue}} )
|
||||
|| {{=$data}} !== {{=$data}}) {
|
||||
{{??}}
|
||||
{{
|
||||
if ($exclIsNumber && $schema === undefined) {
|
||||
{{# def.setExclusiveLimit }}
|
||||
$schemaValue = $schemaExcl;
|
||||
$notOp += '=';
|
||||
} else {
|
||||
if ($exclIsNumber)
|
||||
$schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);
|
||||
|
||||
if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {
|
||||
{{# def.setExclusiveLimit }}
|
||||
$notOp += '=';
|
||||
} else {
|
||||
$exclusive = false;
|
||||
$opStr += '=';
|
||||
}
|
||||
}
|
||||
|
||||
var $opExpr = '\'' + $opStr + '\''; /*used in error*/
|
||||
}}
|
||||
|
||||
if ({{# def.$dataNotType:'number' }}
|
||||
{{=$data}} {{=$notOp}} {{=$schemaValue}}
|
||||
|| {{=$data}} !== {{=$data}}) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{ $errorKeyword = $errorKeyword || $keyword; }}
|
||||
{{# def.error:'_limit' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
10
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/_limitItems.jst
generated
vendored
Normal file
10
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/_limitItems.jst
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{ var $op = $keyword == 'maxItems' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} {{=$data}}.length {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitItems' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
10
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/_limitLength.jst
generated
vendored
Normal file
10
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/_limitLength.jst
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{ var $op = $keyword == 'maxLength' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} {{# def.strLength }} {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitLength' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
10
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/_limitProperties.jst
generated
vendored
Normal file
10
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/_limitProperties.jst
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{ var $op = $keyword == 'maxProperties' ? '>' : '<'; }}
|
||||
if ({{# def.$dataNotType:'number' }} Object.keys({{=$data}}).length {{=$op}} {{=$schemaValue}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_limitProperties' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
34
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/allOf.jst
generated
vendored
Normal file
34
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/allOf.jst
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $currentBaseId = $it.baseId
|
||||
, $allSchemasEmpty = true;
|
||||
}}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{
|
||||
$allSchemasEmpty = false;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{? $allSchemasEmpty }}
|
||||
if (true) {
|
||||
{{??}}
|
||||
{{= $closingBraces.slice(0,-1) }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
48
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/anyOf.jst
generated
vendored
Normal file
48
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/anyOf.jst
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $noEmptySchema = $schema.every(function($sch) {
|
||||
return {{# def.nonEmptySchema:$sch }};
|
||||
});
|
||||
}}
|
||||
{{? $noEmptySchema }}
|
||||
{{ var $currentBaseId = $it.baseId; }}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}} = false;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
|
||||
{{=$valid}} = {{=$valid}} || {{=$nextValid}};
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{~}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.extraError:'anyOf' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
||||
{{?}}
|
61
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/coerce.def
generated
vendored
Normal file
61
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/coerce.def
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
{{## def.coerceType:
|
||||
{{
|
||||
var $dataType = 'dataType' + $lvl
|
||||
, $coerced = 'coerced' + $lvl;
|
||||
}}
|
||||
var {{=$dataType}} = typeof {{=$data}};
|
||||
{{? it.opts.coerceTypes == 'array'}}
|
||||
if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';
|
||||
{{?}}
|
||||
|
||||
var {{=$coerced}} = undefined;
|
||||
|
||||
{{ var $bracesCoercion = ''; }}
|
||||
{{~ $coerceToTypes:$type:$i }}
|
||||
{{? $i }}
|
||||
if ({{=$coerced}} === undefined) {
|
||||
{{ $bracesCoercion += '}'; }}
|
||||
{{?}}
|
||||
|
||||
{{? it.opts.coerceTypes == 'array' && $type != 'array' }}
|
||||
if ({{=$dataType}} == 'array' && {{=$data}}.length == 1) {
|
||||
{{=$coerced}} = {{=$data}} = {{=$data}}[0];
|
||||
{{=$dataType}} = typeof {{=$data}};
|
||||
/*if ({{=$dataType}} == 'object' && Array.isArray({{=$data}})) {{=$dataType}} = 'array';*/
|
||||
}
|
||||
{{?}}
|
||||
|
||||
{{? $type == 'string' }}
|
||||
if ({{=$dataType}} == 'number' || {{=$dataType}} == 'boolean')
|
||||
{{=$coerced}} = '' + {{=$data}};
|
||||
else if ({{=$data}} === null) {{=$coerced}} = '';
|
||||
{{?? $type == 'number' || $type == 'integer' }}
|
||||
if ({{=$dataType}} == 'boolean' || {{=$data}} === null
|
||||
|| ({{=$dataType}} == 'string' && {{=$data}} && {{=$data}} == +{{=$data}}
|
||||
{{? $type == 'integer' }} && !({{=$data}} % 1){{?}}))
|
||||
{{=$coerced}} = +{{=$data}};
|
||||
{{?? $type == 'boolean' }}
|
||||
if ({{=$data}} === 'false' || {{=$data}} === 0 || {{=$data}} === null)
|
||||
{{=$coerced}} = false;
|
||||
else if ({{=$data}} === 'true' || {{=$data}} === 1)
|
||||
{{=$coerced}} = true;
|
||||
{{?? $type == 'null' }}
|
||||
if ({{=$data}} === '' || {{=$data}} === 0 || {{=$data}} === false)
|
||||
{{=$coerced}} = null;
|
||||
{{?? it.opts.coerceTypes == 'array' && $type == 'array' }}
|
||||
if ({{=$dataType}} == 'string' || {{=$dataType}} == 'number' || {{=$dataType}} == 'boolean' || {{=$data}} == null)
|
||||
{{=$coerced}} = [{{=$data}}];
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{= $bracesCoercion }}
|
||||
|
||||
if ({{=$coerced}} === undefined) {
|
||||
{{# def.error:'type' }}
|
||||
} else {
|
||||
{{# def.setParentData }}
|
||||
{{=$data}} = {{=$coerced}};
|
||||
{{? !$dataLvl }}if ({{=$parentData}} !== undefined){{?}}
|
||||
{{=$parentData}}[{{=$parentDataProperty}}] = {{=$coerced}};
|
||||
}
|
||||
#}}
|
9
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/comment.jst
generated
vendored
Normal file
9
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/comment.jst
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{ var $comment = it.util.toQuotedString($schema); }}
|
||||
{{? it.opts.$comment === true }}
|
||||
console.log({{=$comment}});
|
||||
{{?? typeof it.opts.$comment == 'function' }}
|
||||
self._opts.$comment({{=$comment}}, {{=it.util.toQuotedString($errSchemaPath)}}, validate.root.schema);
|
||||
{{?}}
|
11
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/const.jst
generated
vendored
Normal file
11
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/const.jst
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{? !$isData }}
|
||||
var schema{{=$lvl}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
var {{=$valid}} = equal({{=$data}}, schema{{=$lvl}});
|
||||
{{# def.checkError:'const' }}
|
||||
{{? $breakOnError }} else { {{?}}
|
57
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/contains.jst
generated
vendored
Normal file
57
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/contains.jst
generated
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{
|
||||
var $idx = 'i' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $currentBaseId = it.baseId
|
||||
, $nonEmptySchema = {{# def.nonEmptySchema:$schema }};
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{? $nonEmptySchema }}
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
|
||||
var {{=$nextValid}} = false;
|
||||
|
||||
for (var {{=$idx}} = 0; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
if ({{=$nextValid}}) break;
|
||||
}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$nextValid}}) {
|
||||
{{??}}
|
||||
if ({{=$data}}.length == 0) {
|
||||
{{?}}
|
||||
|
||||
{{# def.error:'contains' }}
|
||||
} else {
|
||||
{{? $nonEmptySchema }}
|
||||
{{# def.resetErrors }}
|
||||
{{?}}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
191
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/custom.jst
generated
vendored
Normal file
191
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/custom.jst
generated
vendored
Normal file
@ -0,0 +1,191 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $rule = this
|
||||
, $definition = 'definition' + $lvl
|
||||
, $rDef = $rule.definition
|
||||
, $closingBraces = '';
|
||||
var $validate = $rDef.validate;
|
||||
var $compile, $inline, $macro, $ruleValidate, $validateCode;
|
||||
}}
|
||||
|
||||
{{? $isData && $rDef.$data }}
|
||||
{{
|
||||
$validateCode = 'keywordValidate' + $lvl;
|
||||
var $validateSchema = $rDef.validateSchema;
|
||||
}}
|
||||
var {{=$definition}} = RULES.custom['{{=$keyword}}'].definition;
|
||||
var {{=$validateCode}} = {{=$definition}}.validate;
|
||||
{{??}}
|
||||
{{
|
||||
$ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
|
||||
if (!$ruleValidate) return;
|
||||
$schemaValue = 'validate.schema' + $schemaPath;
|
||||
$validateCode = $ruleValidate.code;
|
||||
$compile = $rDef.compile;
|
||||
$inline = $rDef.inline;
|
||||
$macro = $rDef.macro;
|
||||
}}
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $ruleErrs = $validateCode + '.errors'
|
||||
, $i = 'i' + $lvl
|
||||
, $ruleErr = 'ruleErr' + $lvl
|
||||
, $asyncKeyword = $rDef.async;
|
||||
|
||||
if ($asyncKeyword && !it.async)
|
||||
throw new Error('async keyword in sync schema');
|
||||
}}
|
||||
|
||||
|
||||
{{? !($inline || $macro) }}{{=$ruleErrs}} = null;{{?}}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{## def.callRuleValidate:
|
||||
{{=$validateCode}}.call(
|
||||
{{? it.opts.passContext }}this{{??}}self{{?}}
|
||||
{{? $compile || $rDef.schema === false }}
|
||||
, {{=$data}}
|
||||
{{??}}
|
||||
, {{=$schemaValue}}
|
||||
, {{=$data}}
|
||||
, validate.schema{{=it.schemaPath}}
|
||||
{{?}}
|
||||
, {{# def.dataPath }}
|
||||
{{# def.passParentData }}
|
||||
, rootData
|
||||
)
|
||||
#}}
|
||||
|
||||
{{## def.extendErrors:_inline:
|
||||
for (var {{=$i}}={{=$errs}}; {{=$i}}<errors; {{=$i}}++) {
|
||||
var {{=$ruleErr}} = vErrors[{{=$i}}];
|
||||
if ({{=$ruleErr}}.dataPath === undefined)
|
||||
{{=$ruleErr}}.dataPath = (dataPath || '') + {{= it.errorPath }};
|
||||
{{# _inline ? 'if (\{\{=$ruleErr\}\}.schemaPath === undefined) {' : '' }}
|
||||
{{=$ruleErr}}.schemaPath = "{{=$errSchemaPath}}";
|
||||
{{# _inline ? '}' : '' }}
|
||||
{{? it.opts.verbose }}
|
||||
{{=$ruleErr}}.schema = {{=$schemaValue}};
|
||||
{{=$ruleErr}}.data = {{=$data}};
|
||||
{{?}}
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{? $isData && $rDef.$data }}
|
||||
{{ $closingBraces += '}'; }}
|
||||
if ({{=$schemaValue}} === undefined) {
|
||||
{{=$valid}} = true;
|
||||
} else {
|
||||
{{? $validateSchema }}
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{=$valid}} = {{=$definition}}.validateSchema({{=$schemaValue}});
|
||||
if ({{=$valid}}) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $inline }}
|
||||
{{? $rDef.statements }}
|
||||
{{= $ruleValidate.validate }}
|
||||
{{??}}
|
||||
{{=$valid}} = {{= $ruleValidate.validate }};
|
||||
{{?}}
|
||||
{{?? $macro }}
|
||||
{{# def.setupNextLevel }}
|
||||
{{
|
||||
$it.schema = $ruleValidate.validate;
|
||||
$it.schemaPath = '';
|
||||
}}
|
||||
{{# def.setCompositeRule }}
|
||||
{{ var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); }}
|
||||
{{# def.resetCompositeRule }}
|
||||
{{= $code }}
|
||||
{{??}}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def.callRuleValidate }}
|
||||
{{# def.storeDefOut:def_callRuleValidate }}
|
||||
|
||||
{{? $rDef.errors === false }}
|
||||
{{=$valid}} = {{? $asyncKeyword }}await {{?}}{{= def_callRuleValidate }};
|
||||
{{??}}
|
||||
{{? $asyncKeyword }}
|
||||
{{ $ruleErrs = 'customErrors' + $lvl; }}
|
||||
var {{=$ruleErrs}} = null;
|
||||
try {
|
||||
{{=$valid}} = await {{= def_callRuleValidate }};
|
||||
} catch (e) {
|
||||
{{=$valid}} = false;
|
||||
if (e instanceof ValidationError) {{=$ruleErrs}} = e.errors;
|
||||
else throw e;
|
||||
}
|
||||
{{??}}
|
||||
{{=$ruleErrs}} = null;
|
||||
{{=$valid}} = {{= def_callRuleValidate }};
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $rDef.modifying }}
|
||||
if ({{=$parentData}}) {{=$data}} = {{=$parentData}}[{{=$parentDataProperty}}];
|
||||
{{?}}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
{{## def.notValidationResult:
|
||||
{{? $rDef.valid === undefined }}
|
||||
!{{? $macro }}{{=$nextValid}}{{??}}{{=$valid}}{{?}}
|
||||
{{??}}
|
||||
{{= !$rDef.valid }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
{{? $rDef.valid }}
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{??}}
|
||||
if ({{# def.notValidationResult }}) {
|
||||
{{ $errorKeyword = $rule.keyword; }}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def.error:'custom' }}
|
||||
{{# def.storeDefOut:def_customError }}
|
||||
|
||||
{{? $inline }}
|
||||
{{? $rDef.errors }}
|
||||
{{? $rDef.errors != 'full' }}
|
||||
{{# def.extendErrors:true }}
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{? $rDef.errors === false}}
|
||||
{{= def_customError }}
|
||||
{{??}}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{= def_customError }}
|
||||
} else {
|
||||
{{# def.extendErrors:true }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{?? $macro }}
|
||||
{{# def.extraError:'custom' }}
|
||||
{{??}}
|
||||
{{? $rDef.errors === false}}
|
||||
{{= def_customError }}
|
||||
{{??}}
|
||||
if (Array.isArray({{=$ruleErrs}})) {
|
||||
if (vErrors === null) vErrors = {{=$ruleErrs}};
|
||||
else vErrors = vErrors.concat({{=$ruleErrs}});
|
||||
errors = vErrors.length;
|
||||
{{# def.extendErrors:false }}
|
||||
} else {
|
||||
{{= def_customError }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
{{?}}
|
47
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/defaults.def
generated
vendored
Normal file
47
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/defaults.def
generated
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
{{## def.assignDefault:
|
||||
{{? it.compositeRule }}
|
||||
{{
|
||||
if (it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored for: ' + $passData;
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
else throw new Error($defaultMsg);
|
||||
}
|
||||
}}
|
||||
{{??}}
|
||||
if ({{=$passData}} === undefined
|
||||
{{? it.opts.useDefaults == 'empty' }}
|
||||
|| {{=$passData}} === null
|
||||
|| {{=$passData}} === ''
|
||||
{{?}}
|
||||
)
|
||||
{{=$passData}} = {{? it.opts.useDefaults == 'shared' }}
|
||||
{{= it.useDefault($sch.default) }}
|
||||
{{??}}
|
||||
{{= JSON.stringify($sch.default) }}
|
||||
{{?}};
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.defaultProperties:
|
||||
{{
|
||||
var $schema = it.schema.properties
|
||||
, $schemaKeys = Object.keys($schema); }}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
{{ var $sch = $schema[$propertyKey]; }}
|
||||
{{? $sch.default !== undefined }}
|
||||
{{ var $passData = $data + it.util.getProperty($propertyKey); }}
|
||||
{{# def.assignDefault }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.defaultItems:
|
||||
{{~ it.schema.items:$sch:$i }}
|
||||
{{? $sch.default !== undefined }}
|
||||
{{ var $passData = $data + '[' + $i + ']'; }}
|
||||
{{# def.assignDefault }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
#}}
|
201
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/definitions.def
generated
vendored
Normal file
201
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/definitions.def
generated
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
{{## def.setupKeyword:
|
||||
{{
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.setCompositeRule:
|
||||
{{
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.resetCompositeRule:
|
||||
{{ it.compositeRule = $it.compositeRule = $wasComposite; }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.setupNextLevel:
|
||||
{{
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.ifValid:
|
||||
{{? $breakOnError }}
|
||||
if ({{=$valid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.ifResultValid:
|
||||
{{? $breakOnError }}
|
||||
if ({{=$nextValid}}) {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.elseIfValid:
|
||||
{{? $breakOnError }}
|
||||
{{ $closingBraces += '}'; }}
|
||||
else {
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.nonEmptySchema:_schema:
|
||||
(it.opts.strictKeywords
|
||||
? typeof _schema == 'object' && Object.keys(_schema).length > 0
|
||||
: it.util.schemaHasRules(_schema, it.RULES.all))
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.strLength:
|
||||
{{? it.opts.unicode === false }}
|
||||
{{=$data}}.length
|
||||
{{??}}
|
||||
ucs2length({{=$data}})
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.willOptimize:
|
||||
it.util.varOccurences($code, $nextData) < 2
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.generateSubschemaCode:
|
||||
{{
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.insertSubschemaCode:
|
||||
{{= it.validate($it) }}
|
||||
{{ $it.baseId = $currentBaseId; }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def._optimizeValidate:
|
||||
it.util.varReplace($code, $nextData, $passData)
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.optimizeValidate:
|
||||
{{? {{# def.willOptimize}} }}
|
||||
{{= {{# def._optimizeValidate }} }}
|
||||
{{??}}
|
||||
var {{=$nextData}} = {{=$passData}};
|
||||
{{= $code }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.cleanUp: {{ out = it.util.cleanUpCode(out); }} #}}
|
||||
|
||||
|
||||
{{## def.finalCleanUp: {{ out = it.util.finalCleanUpCode(out, $async); }} #}}
|
||||
|
||||
|
||||
{{## def.$data:
|
||||
{{
|
||||
var $isData = it.opts.$data && $schema && $schema.$data
|
||||
, $schemaValue;
|
||||
}}
|
||||
{{? $isData }}
|
||||
var schema{{=$lvl}} = {{= it.util.getData($schema.$data, $dataLvl, it.dataPathArr) }};
|
||||
{{ $schemaValue = 'schema' + $lvl; }}
|
||||
{{??}}
|
||||
{{ $schemaValue = $schema; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.$dataNotType:_type:
|
||||
{{?$isData}} ({{=$schemaValue}} !== undefined && typeof {{=$schemaValue}} != _type) || {{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.check$dataIsArray:
|
||||
if (schema{{=$lvl}} === undefined) {{=$valid}} = true;
|
||||
else if (!Array.isArray(schema{{=$lvl}})) {{=$valid}} = false;
|
||||
else {
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.beginDefOut:
|
||||
{{
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.storeDefOut:_variable:
|
||||
{{
|
||||
var _variable = out;
|
||||
out = $$outStack.pop();
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.dataPath:(dataPath || ''){{? it.errorPath != '""'}} + {{= it.errorPath }}{{?}}#}}
|
||||
|
||||
{{## def.setParentData:
|
||||
{{
|
||||
var $parentData = $dataLvl ? 'data' + (($dataLvl-1)||'') : 'parentData'
|
||||
, $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
||||
}}
|
||||
#}}
|
||||
|
||||
{{## def.passParentData:
|
||||
{{# def.setParentData }}
|
||||
, {{= $parentData }}
|
||||
, {{= $parentDataProperty }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.iterateProperties:
|
||||
{{? $ownProperties }}
|
||||
{{=$dataProperties}} = {{=$dataProperties}} || Object.keys({{=$data}});
|
||||
for (var {{=$idx}}=0; {{=$idx}}<{{=$dataProperties}}.length; {{=$idx}}++) {
|
||||
var {{=$key}} = {{=$dataProperties}}[{{=$idx}}];
|
||||
{{??}}
|
||||
for (var {{=$key}} in {{=$data}}) {
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.noPropertyInData:
|
||||
{{=$useData}} === undefined
|
||||
{{? $ownProperties }}
|
||||
|| !{{# def.isOwnProperty }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.isOwnProperty:
|
||||
Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($propertyKey)}}')
|
||||
#}}
|
80
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/dependencies.jst
generated
vendored
Normal file
80
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/dependencies.jst
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.missing }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.propertyInData:
|
||||
{{=$data}}{{= it.util.getProperty($property) }} !== undefined
|
||||
{{? $ownProperties }}
|
||||
&& Object.prototype.hasOwnProperty.call({{=$data}}, '{{=it.util.escapeQuotes($property)}}')
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $schemaDeps = {}
|
||||
, $propertyDeps = {}
|
||||
, $ownProperties = it.opts.ownProperties;
|
||||
|
||||
for ($property in $schema) {
|
||||
var $sch = $schema[$property];
|
||||
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
|
||||
$deps[$property] = $sch;
|
||||
}
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
|
||||
{{ var $currentErrorPath = it.errorPath; }}
|
||||
|
||||
var missing{{=$lvl}};
|
||||
{{ for (var $property in $propertyDeps) { }}
|
||||
{{ $deps = $propertyDeps[$property]; }}
|
||||
{{? $deps.length }}
|
||||
if ({{# def.propertyInData }}
|
||||
{{? $breakOnError }}
|
||||
&& ({{# def.checkMissingProperty:$deps }})) {
|
||||
{{# def.errorMissingProperty:'dependencies' }}
|
||||
{{??}}
|
||||
) {
|
||||
{{~ $deps:$propertyKey }}
|
||||
{{# def.allErrorsMissingProperty:'dependencies' }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
} {{# def.elseIfValid }}
|
||||
{{?}}
|
||||
{{ } }}
|
||||
|
||||
{{
|
||||
it.errorPath = $currentErrorPath;
|
||||
var $currentBaseId = $it.baseId;
|
||||
}}
|
||||
|
||||
|
||||
{{ for (var $property in $schemaDeps) { }}
|
||||
{{ var $sch = $schemaDeps[$property]; }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{# def.propertyInData }}) {
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + it.util.getProperty($property);
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{ } }}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
30
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/enum.jst
generated
vendored
Normal file
30
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/enum.jst
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $i = 'i' + $lvl
|
||||
, $vSchema = 'schema' + $lvl;
|
||||
}}
|
||||
|
||||
{{? !$isData }}
|
||||
var {{=$vSchema}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
var {{=$valid}};
|
||||
|
||||
{{?$isData}}{{# def.check$dataIsArray }}{{?}}
|
||||
|
||||
{{=$valid}} = false;
|
||||
|
||||
for (var {{=$i}}=0; {{=$i}}<{{=$vSchema}}.length; {{=$i}}++)
|
||||
if (equal({{=$data}}, {{=$vSchema}}[{{=$i}}])) {
|
||||
{{=$valid}} = true;
|
||||
break;
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
|
||||
{{# def.checkError:'enum' }}
|
||||
|
||||
{{? $breakOnError }} else { {{?}}
|
194
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/errors.def
generated
vendored
Normal file
194
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/errors.def
generated
vendored
Normal file
@ -0,0 +1,194 @@
|
||||
{{# def.definitions }}
|
||||
|
||||
{{## def._error:_rule:
|
||||
{{ 'istanbul ignore else'; }}
|
||||
{{? it.createErrors !== false }}
|
||||
{
|
||||
keyword: '{{= $errorKeyword || _rule }}'
|
||||
, dataPath: (dataPath || '') + {{= it.errorPath }}
|
||||
, schemaPath: {{=it.util.toQuotedString($errSchemaPath)}}
|
||||
, params: {{# def._errorParams[_rule] }}
|
||||
{{? it.opts.messages !== false }}
|
||||
, message: {{# def._errorMessages[_rule] }}
|
||||
{{?}}
|
||||
{{? it.opts.verbose }}
|
||||
, schema: {{# def._errorSchemas[_rule] }}
|
||||
, parentSchema: validate.schema{{=it.schemaPath}}
|
||||
, data: {{=$data}}
|
||||
{{?}}
|
||||
}
|
||||
{{??}}
|
||||
{}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def._addError:_rule:
|
||||
if (vErrors === null) vErrors = [err];
|
||||
else vErrors.push(err);
|
||||
errors++;
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.addError:_rule:
|
||||
var err = {{# def._error:_rule }};
|
||||
{{# def._addError:_rule }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.error:_rule:
|
||||
{{# def.beginDefOut}}
|
||||
{{# def._error:_rule }}
|
||||
{{# def.storeDefOut:__err }}
|
||||
|
||||
{{? !it.compositeRule && $breakOnError }}
|
||||
{{ 'istanbul ignore if'; }}
|
||||
{{? it.async }}
|
||||
throw new ValidationError([{{=__err}}]);
|
||||
{{??}}
|
||||
validate.errors = [{{=__err}}];
|
||||
return false;
|
||||
{{?}}
|
||||
{{??}}
|
||||
var err = {{=__err}};
|
||||
{{# def._addError:_rule }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.extraError:_rule:
|
||||
{{# def.addError:_rule}}
|
||||
{{? !it.compositeRule && $breakOnError }}
|
||||
{{ 'istanbul ignore if'; }}
|
||||
{{? it.async }}
|
||||
throw new ValidationError(vErrors);
|
||||
{{??}}
|
||||
validate.errors = vErrors;
|
||||
return false;
|
||||
{{?}}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.checkError:_rule:
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.error:_rule }}
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.resetErrors:
|
||||
errors = {{=$errs}};
|
||||
if (vErrors !== null) {
|
||||
if ({{=$errs}}) vErrors.length = {{=$errs}};
|
||||
else vErrors = null;
|
||||
}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.concatSchema:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=$schema}}{{?}}#}}
|
||||
{{## def.appendSchema:{{?$isData}}' + {{=$schemaValue}}{{??}}{{=$schemaValue}}'{{?}}#}}
|
||||
{{## def.concatSchemaEQ:{{?$isData}}' + {{=$schemaValue}} + '{{??}}{{=it.util.escapeQuotes($schema)}}{{?}}#}}
|
||||
|
||||
{{## def._errorMessages = {
|
||||
'false schema': "'boolean schema is false'",
|
||||
$ref: "'can\\\'t resolve reference {{=it.util.escapeQuotes($schema)}}'",
|
||||
additionalItems: "'should NOT have more than {{=$schema.length}} items'",
|
||||
additionalProperties: "'{{? it.opts._errorDataPathProperty }}is an invalid additional property{{??}}should NOT have additional properties{{?}}'",
|
||||
anyOf: "'should match some schema in anyOf'",
|
||||
const: "'should be equal to constant'",
|
||||
contains: "'should contain a valid item'",
|
||||
dependencies: "'should have {{? $deps.length == 1 }}property {{= it.util.escapeQuotes($deps[0]) }}{{??}}properties {{= it.util.escapeQuotes($deps.join(\", \")) }}{{?}} when property {{= it.util.escapeQuotes($property) }} is present'",
|
||||
'enum': "'should be equal to one of the allowed values'",
|
||||
format: "'should match format \"{{#def.concatSchemaEQ}}\"'",
|
||||
'if': "'should match \"' + {{=$ifClause}} + '\" schema'",
|
||||
_limit: "'should be {{=$opStr}} {{#def.appendSchema}}",
|
||||
_exclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'",
|
||||
_limitItems: "'should NOT have {{?$keyword=='maxItems'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} items'",
|
||||
_limitLength: "'should NOT be {{?$keyword=='maxLength'}}longer{{??}}shorter{{?}} than {{#def.concatSchema}} characters'",
|
||||
_limitProperties:"'should NOT have {{?$keyword=='maxProperties'}}more{{??}}fewer{{?}} than {{#def.concatSchema}} properties'",
|
||||
multipleOf: "'should be multiple of {{#def.appendSchema}}",
|
||||
not: "'should NOT be valid'",
|
||||
oneOf: "'should match exactly one schema in oneOf'",
|
||||
pattern: "'should match pattern \"{{#def.concatSchemaEQ}}\"'",
|
||||
propertyNames: "'property name \\'{{=$invalidName}}\\' is invalid'",
|
||||
required: "'{{? it.opts._errorDataPathProperty }}is a required property{{??}}should have required property \\'{{=$missingProperty}}\\'{{?}}'",
|
||||
type: "'should be {{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}'",
|
||||
uniqueItems: "'should NOT have duplicate items (items ## ' + j + ' and ' + i + ' are identical)'",
|
||||
custom: "'should pass \"{{=$rule.keyword}}\" keyword validation'",
|
||||
patternRequired: "'should have property matching pattern \\'{{=$missingPattern}}\\''",
|
||||
switch: "'should pass \"switch\" keyword validation'",
|
||||
_formatLimit: "'should be {{=$opStr}} \"{{#def.concatSchemaEQ}}\"'",
|
||||
_formatExclusiveLimit: "'{{=$exclusiveKeyword}} should be boolean'"
|
||||
} #}}
|
||||
|
||||
|
||||
{{## def.schemaRefOrVal: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=$schema}}{{?}} #}}
|
||||
{{## def.schemaRefOrQS: {{?$isData}}validate.schema{{=$schemaPath}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
|
||||
|
||||
{{## def._errorSchemas = {
|
||||
'false schema': "false",
|
||||
$ref: "{{=it.util.toQuotedString($schema)}}",
|
||||
additionalItems: "false",
|
||||
additionalProperties: "false",
|
||||
anyOf: "validate.schema{{=$schemaPath}}",
|
||||
const: "validate.schema{{=$schemaPath}}",
|
||||
contains: "validate.schema{{=$schemaPath}}",
|
||||
dependencies: "validate.schema{{=$schemaPath}}",
|
||||
'enum': "validate.schema{{=$schemaPath}}",
|
||||
format: "{{#def.schemaRefOrQS}}",
|
||||
'if': "validate.schema{{=$schemaPath}}",
|
||||
_limit: "{{#def.schemaRefOrVal}}",
|
||||
_exclusiveLimit: "validate.schema{{=$schemaPath}}",
|
||||
_limitItems: "{{#def.schemaRefOrVal}}",
|
||||
_limitLength: "{{#def.schemaRefOrVal}}",
|
||||
_limitProperties:"{{#def.schemaRefOrVal}}",
|
||||
multipleOf: "{{#def.schemaRefOrVal}}",
|
||||
not: "validate.schema{{=$schemaPath}}",
|
||||
oneOf: "validate.schema{{=$schemaPath}}",
|
||||
pattern: "{{#def.schemaRefOrQS}}",
|
||||
propertyNames: "validate.schema{{=$schemaPath}}",
|
||||
required: "validate.schema{{=$schemaPath}}",
|
||||
type: "validate.schema{{=$schemaPath}}",
|
||||
uniqueItems: "{{#def.schemaRefOrVal}}",
|
||||
custom: "validate.schema{{=$schemaPath}}",
|
||||
patternRequired: "validate.schema{{=$schemaPath}}",
|
||||
switch: "validate.schema{{=$schemaPath}}",
|
||||
_formatLimit: "{{#def.schemaRefOrQS}}",
|
||||
_formatExclusiveLimit: "validate.schema{{=$schemaPath}}"
|
||||
} #}}
|
||||
|
||||
|
||||
{{## def.schemaValueQS: {{?$isData}}{{=$schemaValue}}{{??}}{{=it.util.toQuotedString($schema)}}{{?}} #}}
|
||||
|
||||
{{## def._errorParams = {
|
||||
'false schema': "{}",
|
||||
$ref: "{ ref: '{{=it.util.escapeQuotes($schema)}}' }",
|
||||
additionalItems: "{ limit: {{=$schema.length}} }",
|
||||
additionalProperties: "{ additionalProperty: '{{=$additionalProperty}}' }",
|
||||
anyOf: "{}",
|
||||
const: "{ allowedValue: schema{{=$lvl}} }",
|
||||
contains: "{}",
|
||||
dependencies: "{ property: '{{= it.util.escapeQuotes($property) }}', missingProperty: '{{=$missingProperty}}', depsCount: {{=$deps.length}}, deps: '{{= it.util.escapeQuotes($deps.length==1 ? $deps[0] : $deps.join(\", \")) }}' }",
|
||||
'enum': "{ allowedValues: schema{{=$lvl}} }",
|
||||
format: "{ format: {{#def.schemaValueQS}} }",
|
||||
'if': "{ failingKeyword: {{=$ifClause}} }",
|
||||
_limit: "{ comparison: {{=$opExpr}}, limit: {{=$schemaValue}}, exclusive: {{=$exclusive}} }",
|
||||
_exclusiveLimit: "{}",
|
||||
_limitItems: "{ limit: {{=$schemaValue}} }",
|
||||
_limitLength: "{ limit: {{=$schemaValue}} }",
|
||||
_limitProperties:"{ limit: {{=$schemaValue}} }",
|
||||
multipleOf: "{ multipleOf: {{=$schemaValue}} }",
|
||||
not: "{}",
|
||||
oneOf: "{ passingSchemas: {{=$passingSchemas}} }",
|
||||
pattern: "{ pattern: {{#def.schemaValueQS}} }",
|
||||
propertyNames: "{ propertyName: '{{=$invalidName}}' }",
|
||||
required: "{ missingProperty: '{{=$missingProperty}}' }",
|
||||
type: "{ type: '{{? $typeIsArray }}{{= $typeSchema.join(\",\") }}{{??}}{{=$typeSchema}}{{?}}' }",
|
||||
uniqueItems: "{ i: i, j: j }",
|
||||
custom: "{ keyword: '{{=$rule.keyword}}' }",
|
||||
patternRequired: "{ missingPattern: '{{=$missingPattern}}' }",
|
||||
switch: "{ caseIndex: {{=$caseIndex}} }",
|
||||
_formatLimit: "{ comparison: {{=$opExpr}}, limit: {{#def.schemaValueQS}}, exclusive: {{=$exclusive}} }",
|
||||
_formatExclusiveLimit: "{}"
|
||||
} #}}
|
106
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/format.jst
generated
vendored
Normal file
106
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/format.jst
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{## def.skipFormat:
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{ return out; }}
|
||||
#}}
|
||||
|
||||
{{? it.opts.format === false }}{{# def.skipFormat }}{{?}}
|
||||
|
||||
|
||||
{{# def.$data }}
|
||||
|
||||
|
||||
{{## def.$dataCheckFormat:
|
||||
{{# def.$dataNotType:'string' }}
|
||||
({{? $unknownFormats != 'ignore' }}
|
||||
({{=$schemaValue}} && !{{=$format}}
|
||||
{{? $allowUnknown }}
|
||||
&& self._opts.unknownFormats.indexOf({{=$schemaValue}}) == -1
|
||||
{{?}}) ||
|
||||
{{?}}
|
||||
({{=$format}} && {{=$formatType}} == '{{=$ruleType}}'
|
||||
&& !(typeof {{=$format}} == 'function'
|
||||
? {{? it.async}}
|
||||
(async{{=$lvl}} ? await {{=$format}}({{=$data}}) : {{=$format}}({{=$data}}))
|
||||
{{??}}
|
||||
{{=$format}}({{=$data}})
|
||||
{{?}}
|
||||
: {{=$format}}.test({{=$data}}))))
|
||||
#}}
|
||||
|
||||
{{## def.checkFormat:
|
||||
{{
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema);
|
||||
if ($isObject) $formatRef += '.validate';
|
||||
}}
|
||||
{{? typeof $format == 'function' }}
|
||||
{{=$formatRef}}({{=$data}})
|
||||
{{??}}
|
||||
{{=$formatRef}}.test({{=$data}})
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $unknownFormats = it.opts.unknownFormats
|
||||
, $allowUnknown = Array.isArray($unknownFormats);
|
||||
}}
|
||||
|
||||
{{? $isData }}
|
||||
{{
|
||||
var $format = 'format' + $lvl
|
||||
, $isObject = 'isObject' + $lvl
|
||||
, $formatType = 'formatType' + $lvl;
|
||||
}}
|
||||
var {{=$format}} = formats[{{=$schemaValue}}];
|
||||
var {{=$isObject}} = typeof {{=$format}} == 'object'
|
||||
&& !({{=$format}} instanceof RegExp)
|
||||
&& {{=$format}}.validate;
|
||||
var {{=$formatType}} = {{=$isObject}} && {{=$format}}.type || 'string';
|
||||
if ({{=$isObject}}) {
|
||||
{{? it.async}}
|
||||
var async{{=$lvl}} = {{=$format}}.async;
|
||||
{{?}}
|
||||
{{=$format}} = {{=$format}}.validate;
|
||||
}
|
||||
if ({{# def.$dataCheckFormat }}) {
|
||||
{{??}}
|
||||
{{ var $format = it.formats[$schema]; }}
|
||||
{{? !$format }}
|
||||
{{? $unknownFormats == 'ignore' }}
|
||||
{{ it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"'); }}
|
||||
{{# def.skipFormat }}
|
||||
{{?? $allowUnknown && $unknownFormats.indexOf($schema) >= 0 }}
|
||||
{{# def.skipFormat }}
|
||||
{{??}}
|
||||
{{ throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{
|
||||
var $isObject = typeof $format == 'object'
|
||||
&& !($format instanceof RegExp)
|
||||
&& $format.validate;
|
||||
var $formatType = $isObject && $format.type || 'string';
|
||||
if ($isObject) {
|
||||
var $async = $format.async === true;
|
||||
$format = $format.validate;
|
||||
}
|
||||
}}
|
||||
{{? $formatType != $ruleType }}
|
||||
{{# def.skipFormat }}
|
||||
{{?}}
|
||||
{{? $async }}
|
||||
{{
|
||||
if (!it.async) throw new Error('async format in sync schema');
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';
|
||||
}}
|
||||
if (!(await {{=$formatRef}}({{=$data}}))) {
|
||||
{{??}}
|
||||
if (!{{# def.checkFormat }}) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{# def.error:'format' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
75
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/if.jst
generated
vendored
Normal file
75
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/if.jst
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateIfClause:_clause:
|
||||
{{
|
||||
$it.schema = it.schema['_clause'];
|
||||
$it.schemaPath = it.schemaPath + '._clause';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/_clause';
|
||||
}}
|
||||
{{# def.insertSubschemaCode }}
|
||||
{{=$valid}} = {{=$nextValid}};
|
||||
{{? $thenPresent && $elsePresent }}
|
||||
{{ $ifClause = 'ifClause' + $lvl; }}
|
||||
var {{=$ifClause}} = '_clause';
|
||||
{{??}}
|
||||
{{ $ifClause = '\'_clause\''; }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
{{
|
||||
var $thenSch = it.schema['then']
|
||||
, $elseSch = it.schema['else']
|
||||
, $thenPresent = $thenSch !== undefined && {{# def.nonEmptySchema:$thenSch }}
|
||||
, $elsePresent = $elseSch !== undefined && {{# def.nonEmptySchema:$elseSch }}
|
||||
, $currentBaseId = $it.baseId;
|
||||
}}
|
||||
|
||||
{{? $thenPresent || $elsePresent }}
|
||||
{{
|
||||
var $ifClause;
|
||||
$it.createErrors = false;
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}} = true;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
{{# def.insertSubschemaCode }}
|
||||
{{ $it.createErrors = true; }}
|
||||
{{# def.resetErrors }}
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{? $thenPresent }}
|
||||
if ({{=$nextValid}}) {
|
||||
{{# def.validateIfClause:then }}
|
||||
}
|
||||
{{? $elsePresent }}
|
||||
else {
|
||||
{{?}}
|
||||
{{??}}
|
||||
if (!{{=$nextValid}}) {
|
||||
{{?}}
|
||||
|
||||
{{? $elsePresent }}
|
||||
{{# def.validateIfClause:else }}
|
||||
}
|
||||
{{?}}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.extraError:'if' }}
|
||||
}
|
||||
{{? $breakOnError }} else { {{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
100
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/items.jst
generated
vendored
Normal file
100
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/items.jst
generated
vendored
Normal file
@ -0,0 +1,100 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateItems:startFrom:
|
||||
for (var {{=$idx}} = {{=startFrom}}; {{=$idx}} < {{=$data}}.length; {{=$idx}}++) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
{{? $breakOnError }}
|
||||
if (!{{=$nextValid}}) break;
|
||||
{{?}}
|
||||
}
|
||||
#}}
|
||||
|
||||
{{
|
||||
var $idx = 'i' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $currentBaseId = it.baseId;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$valid}};
|
||||
|
||||
{{? Array.isArray($schema) }}
|
||||
{{ /* 'items' is an array of schemas */}}
|
||||
{{ var $additionalItems = it.schema.additionalItems; }}
|
||||
{{? $additionalItems === false }}
|
||||
{{=$valid}} = {{=$data}}.length <= {{= $schema.length }};
|
||||
{{
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
}}
|
||||
{{# def.checkError:'additionalItems' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{# def.elseIfValid}}
|
||||
{{?}}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}.length > {{=$i}}) {
|
||||
{{
|
||||
var $passData = $data + '[' + $i + ']';
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
|
||||
$it.dataPathArr[$dataNxt] = $i;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
|
||||
{{? typeof $additionalItems == 'object' && {{# def.nonEmptySchema:$additionalItems }} }}
|
||||
{{
|
||||
$it.schema = $additionalItems;
|
||||
$it.schemaPath = it.schemaPath + '.additionalItems';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
}}
|
||||
{{=$nextValid}} = true;
|
||||
|
||||
if ({{=$data}}.length > {{= $schema.length }}) {
|
||||
{{# def.validateItems: $schema.length }}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
|
||||
{{?? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{ /* 'items' is a single schema */}}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
{{# def.validateItems: 0 }}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
39
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/missing.def
generated
vendored
Normal file
39
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/missing.def
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
{{## def.checkMissingProperty:_properties:
|
||||
{{~ _properties:$propertyKey:$i }}
|
||||
{{?$i}} || {{?}}
|
||||
{{
|
||||
var $prop = it.util.getProperty($propertyKey)
|
||||
, $useData = $data + $prop;
|
||||
}}
|
||||
( ({{# def.noPropertyInData }}) && (missing{{=$lvl}} = {{= it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop) }}) )
|
||||
{{~}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.errorMissingProperty:_error:
|
||||
{{
|
||||
var $propertyPath = 'missing' + $lvl
|
||||
, $missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.opts.jsonPointers
|
||||
? it.util.getPathExpr($currentErrorPath, $propertyPath, true)
|
||||
: $currentErrorPath + ' + ' + $propertyPath;
|
||||
}
|
||||
}}
|
||||
{{# def.error:_error }}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.allErrorsMissingProperty:_error:
|
||||
{{
|
||||
var $prop = it.util.getProperty($propertyKey)
|
||||
, $missingProperty = it.util.escapeQuotes($propertyKey)
|
||||
, $useData = $data + $prop;
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
if ({{# def.noPropertyInData }}) {
|
||||
{{# def.addError:_error }}
|
||||
}
|
||||
#}}
|
20
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/multipleOf.jst
generated
vendored
Normal file
20
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/multipleOf.jst
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
var division{{=$lvl}};
|
||||
if ({{?$isData}}
|
||||
{{=$schemaValue}} !== undefined && (
|
||||
typeof {{=$schemaValue}} != 'number' ||
|
||||
{{?}}
|
||||
(division{{=$lvl}} = {{=$data}} / {{=$schemaValue}},
|
||||
{{? it.opts.multipleOfPrecision }}
|
||||
Math.abs(Math.round(division{{=$lvl}}) - division{{=$lvl}}) > 1e-{{=it.opts.multipleOfPrecision}}
|
||||
{{??}}
|
||||
division{{=$lvl}} !== parseInt(division{{=$lvl}})
|
||||
{{?}}
|
||||
)
|
||||
{{?$isData}} ) {{?}} ) {
|
||||
{{# def.error:'multipleOf' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
43
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/not.jst
generated
vendored
Normal file
43
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/not.jst
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{
|
||||
$it.createErrors = false;
|
||||
var $allErrorsOption;
|
||||
if ($it.opts.allErrors) {
|
||||
$allErrorsOption = $it.opts.allErrors;
|
||||
$it.opts.allErrors = false;
|
||||
}
|
||||
}}
|
||||
{{= it.validate($it) }}
|
||||
{{
|
||||
$it.createErrors = true;
|
||||
if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
|
||||
}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
if ({{=$nextValid}}) {
|
||||
{{# def.error:'not' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
||||
{{??}}
|
||||
{{# def.addError:'not' }}
|
||||
{{? $breakOnError}}
|
||||
if (false) {
|
||||
{{?}}
|
||||
{{?}}
|
54
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/oneOf.jst
generated
vendored
Normal file
54
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/oneOf.jst
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
{{
|
||||
var $currentBaseId = $it.baseId
|
||||
, $prevValid = 'prevValid' + $lvl
|
||||
, $passingSchemas = 'passingSchemas' + $lvl;
|
||||
}}
|
||||
|
||||
var {{=$errs}} = errors
|
||||
, {{=$prevValid}} = false
|
||||
, {{=$valid}} = false
|
||||
, {{=$passingSchemas}} = null;
|
||||
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{~ $schema:$sch:$i }}
|
||||
{{? {{# def.nonEmptySchema:$sch }} }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
}}
|
||||
|
||||
{{# def.insertSubschemaCode }}
|
||||
{{??}}
|
||||
var {{=$nextValid}} = true;
|
||||
{{?}}
|
||||
|
||||
{{? $i }}
|
||||
if ({{=$nextValid}} && {{=$prevValid}}) {
|
||||
{{=$valid}} = false;
|
||||
{{=$passingSchemas}} = [{{=$passingSchemas}}, {{=$i}}];
|
||||
} else {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
|
||||
if ({{=$nextValid}}) {
|
||||
{{=$valid}} = {{=$prevValid}} = true;
|
||||
{{=$passingSchemas}} = {{=$i}};
|
||||
}
|
||||
{{~}}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.extraError:'oneOf' }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
{{? it.opts.allErrors }} } {{?}}
|
14
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/pattern.jst
generated
vendored
Normal file
14
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/pattern.jst
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{
|
||||
var $regexp = $isData
|
||||
? '(new RegExp(' + $schemaValue + '))'
|
||||
: it.usePattern($schema);
|
||||
}}
|
||||
|
||||
if ({{# def.$dataNotType:'string' }} !{{=$regexp}}.test({{=$data}}) ) {
|
||||
{{# def.error:'pattern' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
244
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/properties.jst
generated
vendored
Normal file
244
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/properties.jst
generated
vendored
Normal file
@ -0,0 +1,244 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateAdditional:
|
||||
{{ /* additionalProperties is schema */
|
||||
$it.schema = $aProperties;
|
||||
$it.schemaPath = it.schemaPath + '.additionalProperties';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalProperties';
|
||||
$it.errorPath = it.opts._errorDataPathProperty
|
||||
? it.errorPath
|
||||
: it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $key = 'key' + $lvl
|
||||
, $idx = 'idx' + $lvl
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $dataProperties = 'dataProperties' + $lvl;
|
||||
|
||||
var $schemaKeys = Object.keys($schema || {})
|
||||
, $pProperties = it.schema.patternProperties || {}
|
||||
, $pPropertyKeys = Object.keys($pProperties)
|
||||
, $aProperties = it.schema.additionalProperties
|
||||
, $someProperties = $schemaKeys.length || $pPropertyKeys.length
|
||||
, $noAdditional = $aProperties === false
|
||||
, $additionalIsSchema = typeof $aProperties == 'object'
|
||||
&& Object.keys($aProperties).length
|
||||
, $removeAdditional = it.opts.removeAdditional
|
||||
, $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional
|
||||
, $ownProperties = it.opts.ownProperties
|
||||
, $currentBaseId = it.baseId;
|
||||
|
||||
var $required = it.schema.required;
|
||||
if ($required && !(it.opts.$data && $required.$data) && $required.length < it.opts.loopRequired)
|
||||
var $requiredHash = it.util.toHash($required);
|
||||
}}
|
||||
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
var {{=$nextValid}} = true;
|
||||
{{? $ownProperties }}
|
||||
var {{=$dataProperties}} = undefined;
|
||||
{{?}}
|
||||
|
||||
{{? $checkAdditional }}
|
||||
{{# def.iterateProperties }}
|
||||
{{? $someProperties }}
|
||||
var isAdditional{{=$lvl}} = !(false
|
||||
{{? $schemaKeys.length }}
|
||||
{{? $schemaKeys.length > 8 }}
|
||||
|| validate.schema{{=$schemaPath}}.hasOwnProperty({{=$key}})
|
||||
{{??}}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
|| {{=$key}} == {{= it.util.toQuotedString($propertyKey) }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{? $pPropertyKeys.length }}
|
||||
{{~ $pPropertyKeys:$pProperty:$i }}
|
||||
|| {{= it.usePattern($pProperty) }}.test({{=$key}})
|
||||
{{~}}
|
||||
{{?}}
|
||||
);
|
||||
|
||||
if (isAdditional{{=$lvl}}) {
|
||||
{{?}}
|
||||
{{? $removeAdditional == 'all' }}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
{{??}}
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath;
|
||||
var $additionalProperty = '\' + ' + $key + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
{{? $noAdditional }}
|
||||
{{? $removeAdditional }}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
{{??}}
|
||||
{{=$nextValid}} = false;
|
||||
{{
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalProperties';
|
||||
}}
|
||||
{{# def.error:'additionalProperties' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{? $breakOnError }} break; {{?}}
|
||||
{{?}}
|
||||
{{?? $additionalIsSchema }}
|
||||
{{? $removeAdditional == 'failing' }}
|
||||
var {{=$errs}} = errors;
|
||||
{{# def.setCompositeRule }}
|
||||
|
||||
{{# def.validateAdditional }}
|
||||
|
||||
if (!{{=$nextValid}}) {
|
||||
errors = {{=$errs}};
|
||||
if (validate.errors !== null) {
|
||||
if (errors) validate.errors.length = errors;
|
||||
else validate.errors = null;
|
||||
}
|
||||
delete {{=$data}}[{{=$key}}];
|
||||
}
|
||||
|
||||
{{# def.resetCompositeRule }}
|
||||
{{??}}
|
||||
{{# def.validateAdditional }}
|
||||
{{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
{{?}}
|
||||
{{? $someProperties }}
|
||||
}
|
||||
{{?}}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}}
|
||||
|
||||
{{ var $useDefaults = it.opts.useDefaults && !it.compositeRule; }}
|
||||
|
||||
{{? $schemaKeys.length }}
|
||||
{{~ $schemaKeys:$propertyKey }}
|
||||
{{ var $sch = $schema[$propertyKey]; }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$sch}} }}
|
||||
{{
|
||||
var $prop = it.util.getProperty($propertyKey)
|
||||
, $passData = $data + $prop
|
||||
, $hasDefault = $useDefaults && $sch.default !== undefined;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + $prop;
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey);
|
||||
$it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers);
|
||||
$it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey);
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
|
||||
{{? {{# def.willOptimize }} }}
|
||||
{{
|
||||
$code = {{# def._optimizeValidate }};
|
||||
var $useData = $passData;
|
||||
}}
|
||||
{{??}}
|
||||
{{ var $useData = $nextData; }}
|
||||
var {{=$nextData}} = {{=$passData}};
|
||||
{{?}}
|
||||
|
||||
{{? $hasDefault }}
|
||||
{{= $code }}
|
||||
{{??}}
|
||||
{{? $requiredHash && $requiredHash[$propertyKey] }}
|
||||
if ({{# def.noPropertyInData }}) {
|
||||
{{=$nextValid}} = false;
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath
|
||||
, $currErrSchemaPath = $errSchemaPath
|
||||
, $missingProperty = it.util.escapeQuotes($propertyKey);
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
|
||||
}
|
||||
$errSchemaPath = it.errSchemaPath + '/required';
|
||||
}}
|
||||
{{# def.error:'required' }}
|
||||
{{ $errSchemaPath = $currErrSchemaPath; }}
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
} else {
|
||||
{{??}}
|
||||
{{? $breakOnError }}
|
||||
if ({{# def.noPropertyInData }}) {
|
||||
{{=$nextValid}} = true;
|
||||
} else {
|
||||
{{??}}
|
||||
if ({{=$useData}} !== undefined
|
||||
{{? $ownProperties }}
|
||||
&& {{# def.isOwnProperty }}
|
||||
{{?}}
|
||||
) {
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{= $code }}
|
||||
}
|
||||
{{?}} {{ /* $hasDefault */ }}
|
||||
{{?}} {{ /* def.nonEmptySchema */ }}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
|
||||
{{? $pPropertyKeys.length }}
|
||||
{{~ $pPropertyKeys:$pProperty }}
|
||||
{{ var $sch = $pProperties[$pProperty]; }}
|
||||
|
||||
{{? {{# def.nonEmptySchema:$sch}} }}
|
||||
{{
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty);
|
||||
$it.errSchemaPath = it.errSchemaPath + '/patternProperties/'
|
||||
+ it.util.escapeFragment($pProperty);
|
||||
}}
|
||||
|
||||
{{# def.iterateProperties }}
|
||||
if ({{= it.usePattern($pProperty) }}.test({{=$key}})) {
|
||||
{{
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers);
|
||||
var $passData = $data + '[' + $key + ']';
|
||||
$it.dataPathArr[$dataNxt] = $key;
|
||||
}}
|
||||
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
|
||||
{{? $breakOnError }} if (!{{=$nextValid}}) break; {{?}}
|
||||
}
|
||||
{{? $breakOnError }} else {{=$nextValid}} = true; {{?}}
|
||||
}
|
||||
|
||||
{{# def.ifResultValid }}
|
||||
{{?}} {{ /* def.nonEmptySchema */ }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
54
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/propertyNames.jst
generated
vendored
Normal file
54
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/propertyNames.jst
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
var {{=$errs}} = errors;
|
||||
|
||||
{{? {{# def.nonEmptySchema:$schema }} }}
|
||||
{{
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
}}
|
||||
|
||||
{{
|
||||
var $key = 'key' + $lvl
|
||||
, $idx = 'idx' + $lvl
|
||||
, $i = 'i' + $lvl
|
||||
, $invalidName = '\' + ' + $key + ' + \''
|
||||
, $dataNxt = $it.dataLevel = it.dataLevel + 1
|
||||
, $nextData = 'data' + $dataNxt
|
||||
, $dataProperties = 'dataProperties' + $lvl
|
||||
, $ownProperties = it.opts.ownProperties
|
||||
, $currentBaseId = it.baseId;
|
||||
}}
|
||||
|
||||
{{? $ownProperties }}
|
||||
var {{=$dataProperties}} = undefined;
|
||||
{{?}}
|
||||
{{# def.iterateProperties }}
|
||||
var startErrs{{=$lvl}} = errors;
|
||||
|
||||
{{ var $passData = $key; }}
|
||||
{{# def.setCompositeRule }}
|
||||
{{# def.generateSubschemaCode }}
|
||||
{{# def.optimizeValidate }}
|
||||
{{# def.resetCompositeRule }}
|
||||
|
||||
if (!{{=$nextValid}}) {
|
||||
for (var {{=$i}}=startErrs{{=$lvl}}; {{=$i}}<errors; {{=$i}}++) {
|
||||
vErrors[{{=$i}}].propertyName = {{=$key}};
|
||||
}
|
||||
{{# def.extraError:'propertyNames' }}
|
||||
{{? $breakOnError }} break; {{?}}
|
||||
}
|
||||
}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces }}
|
||||
if ({{=$errs}} == errors) {
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
85
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/ref.jst
generated
vendored
Normal file
85
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/ref.jst
generated
vendored
Normal file
@ -0,0 +1,85 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{## def._validateRef:_v:
|
||||
{{? it.opts.passContext }}
|
||||
{{=_v}}.call(this,
|
||||
{{??}}
|
||||
{{=_v}}(
|
||||
{{?}}
|
||||
{{=$data}}, {{# def.dataPath }}{{# def.passParentData }}, rootData)
|
||||
#}}
|
||||
|
||||
{{ var $async, $refCode; }}
|
||||
{{? $schema == '#' || $schema == '#/' }}
|
||||
{{
|
||||
if (it.isRoot) {
|
||||
$async = it.async;
|
||||
$refCode = 'validate';
|
||||
} else {
|
||||
$async = it.root.schema.$async === true;
|
||||
$refCode = 'root.refVal[0]';
|
||||
}
|
||||
}}
|
||||
{{??}}
|
||||
{{ var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); }}
|
||||
{{? $refVal === undefined }}
|
||||
{{ var $message = it.MissingRefError.message(it.baseId, $schema); }}
|
||||
{{? it.opts.missingRefs == 'fail' }}
|
||||
{{ it.logger.error($message); }}
|
||||
{{# def.error:'$ref' }}
|
||||
{{? $breakOnError }} if (false) { {{?}}
|
||||
{{?? it.opts.missingRefs == 'ignore' }}
|
||||
{{ it.logger.warn($message); }}
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{??}}
|
||||
{{ throw new it.MissingRefError(it.baseId, $schema, $message); }}
|
||||
{{?}}
|
||||
{{?? $refVal.inline }}
|
||||
{{# def.setupNextLevel }}
|
||||
{{
|
||||
$it.schema = $refVal.schema;
|
||||
$it.schemaPath = '';
|
||||
$it.errSchemaPath = $schema;
|
||||
}}
|
||||
{{ var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); }}
|
||||
{{= $code }}
|
||||
{{? $breakOnError}}
|
||||
if ({{=$nextValid}}) {
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{
|
||||
$async = $refVal.$async === true || (it.async && $refVal.$async !== false);
|
||||
$refCode = $refVal.code;
|
||||
}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $refCode }}
|
||||
{{# def.beginDefOut}}
|
||||
{{# def._validateRef:$refCode }}
|
||||
{{# def.storeDefOut:__callValidate }}
|
||||
|
||||
{{? $async }}
|
||||
{{ if (!it.async) throw new Error('async schema referenced by sync schema'); }}
|
||||
{{? $breakOnError }} var {{=$valid}}; {{?}}
|
||||
try {
|
||||
await {{=__callValidate}};
|
||||
{{? $breakOnError }} {{=$valid}} = true; {{?}}
|
||||
} catch (e) {
|
||||
if (!(e instanceof ValidationError)) throw e;
|
||||
if (vErrors === null) vErrors = e.errors;
|
||||
else vErrors = vErrors.concat(e.errors);
|
||||
errors = vErrors.length;
|
||||
{{? $breakOnError }} {{=$valid}} = false; {{?}}
|
||||
}
|
||||
{{? $breakOnError }} if ({{=$valid}}) { {{?}}
|
||||
{{??}}
|
||||
if (!{{=__callValidate}}) {
|
||||
if (vErrors === null) vErrors = {{=$refCode}}.errors;
|
||||
else vErrors = vErrors.concat({{=$refCode}}.errors);
|
||||
errors = vErrors.length;
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
{{?}}
|
||||
{{?}}
|
108
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/required.jst
generated
vendored
Normal file
108
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/required.jst
generated
vendored
Normal file
@ -0,0 +1,108 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.missing }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
{{ var $vSchema = 'schema' + $lvl; }}
|
||||
|
||||
{{## def.setupLoop:
|
||||
{{? !$isData }}
|
||||
var {{=$vSchema}} = validate.schema{{=$schemaPath}};
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $i = 'i' + $lvl
|
||||
, $propertyPath = 'schema' + $lvl + '[' + $i + ']'
|
||||
, $missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers);
|
||||
}
|
||||
}}
|
||||
#}}
|
||||
|
||||
|
||||
{{## def.isRequiredOwnProperty:
|
||||
Object.prototype.hasOwnProperty.call({{=$data}}, {{=$vSchema}}[{{=$i}}])
|
||||
#}}
|
||||
|
||||
|
||||
{{? !$isData }}
|
||||
{{? $schema.length < it.opts.loopRequired &&
|
||||
it.schema.properties && Object.keys(it.schema.properties).length }}
|
||||
{{ var $required = []; }}
|
||||
{{~ $schema:$property }}
|
||||
{{ var $propertySch = it.schema.properties[$property]; }}
|
||||
{{? !($propertySch && {{# def.nonEmptySchema:$propertySch}}) }}
|
||||
{{ $required[$required.length] = $property; }}
|
||||
{{?}}
|
||||
{{~}}
|
||||
{{??}}
|
||||
{{ var $required = $schema; }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? $isData || $required.length }}
|
||||
{{
|
||||
var $currentErrorPath = it.errorPath
|
||||
, $loopRequired = $isData || $required.length >= it.opts.loopRequired
|
||||
, $ownProperties = it.opts.ownProperties;
|
||||
}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
var missing{{=$lvl}};
|
||||
{{? $loopRequired }}
|
||||
{{# def.setupLoop }}
|
||||
var {{=$valid}} = true;
|
||||
|
||||
{{?$isData}}{{# def.check$dataIsArray }}{{?}}
|
||||
|
||||
for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
|
||||
{{=$valid}} = {{=$data}}[{{=$vSchema}}[{{=$i}}]] !== undefined
|
||||
{{? $ownProperties }}
|
||||
&& {{# def.isRequiredOwnProperty }}
|
||||
{{?}};
|
||||
if (!{{=$valid}}) break;
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
|
||||
{{# def.checkError:'required' }}
|
||||
else {
|
||||
{{??}}
|
||||
if ({{# def.checkMissingProperty:$required }}) {
|
||||
{{# def.errorMissingProperty:'required' }}
|
||||
} else {
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{? $loopRequired }}
|
||||
{{# def.setupLoop }}
|
||||
{{? $isData }}
|
||||
if ({{=$vSchema}} && !Array.isArray({{=$vSchema}})) {
|
||||
{{# def.addError:'required' }}
|
||||
} else if ({{=$vSchema}} !== undefined) {
|
||||
{{?}}
|
||||
|
||||
for (var {{=$i}} = 0; {{=$i}} < {{=$vSchema}}.length; {{=$i}}++) {
|
||||
if ({{=$data}}[{{=$vSchema}}[{{=$i}}]] === undefined
|
||||
{{? $ownProperties }}
|
||||
|| !{{# def.isRequiredOwnProperty }}
|
||||
{{?}}) {
|
||||
{{# def.addError:'required' }}
|
||||
}
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
{{??}}
|
||||
{{~ $required:$propertyKey }}
|
||||
{{# def.allErrorsMissingProperty:'required' }}
|
||||
{{~}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{ it.errorPath = $currentErrorPath; }}
|
||||
|
||||
{{?? $breakOnError }}
|
||||
if (true) {
|
||||
{{?}}
|
62
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/uniqueItems.jst
generated
vendored
Normal file
62
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/uniqueItems.jst
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.$data }}
|
||||
|
||||
|
||||
{{? ($schema || $isData) && it.opts.uniqueItems !== false }}
|
||||
{{? $isData }}
|
||||
var {{=$valid}};
|
||||
if ({{=$schemaValue}} === false || {{=$schemaValue}} === undefined)
|
||||
{{=$valid}} = true;
|
||||
else if (typeof {{=$schemaValue}} != 'boolean')
|
||||
{{=$valid}} = false;
|
||||
else {
|
||||
{{?}}
|
||||
|
||||
var i = {{=$data}}.length
|
||||
, {{=$valid}} = true
|
||||
, j;
|
||||
if (i > 1) {
|
||||
{{
|
||||
var $itemType = it.schema.items && it.schema.items.type
|
||||
, $typeIsArray = Array.isArray($itemType);
|
||||
}}
|
||||
{{? !$itemType || $itemType == 'object' || $itemType == 'array' ||
|
||||
($typeIsArray && ($itemType.indexOf('object') >= 0 || $itemType.indexOf('array') >= 0)) }}
|
||||
outer:
|
||||
for (;i--;) {
|
||||
for (j = i; j--;) {
|
||||
if (equal({{=$data}}[i], {{=$data}}[j])) {
|
||||
{{=$valid}} = false;
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
{{??}}
|
||||
var itemIndices = {}, item;
|
||||
for (;i--;) {
|
||||
var item = {{=$data}}[i];
|
||||
{{ var $method = 'checkDataType' + ($typeIsArray ? 's' : ''); }}
|
||||
if ({{= it.util[$method]($itemType, 'item', true) }}) continue;
|
||||
{{? $typeIsArray}}
|
||||
if (typeof item == 'string') item = '"' + item;
|
||||
{{?}}
|
||||
if (typeof itemIndices[item] == 'number') {
|
||||
{{=$valid}} = false;
|
||||
j = itemIndices[item];
|
||||
break;
|
||||
}
|
||||
itemIndices[item] = i;
|
||||
}
|
||||
{{?}}
|
||||
}
|
||||
|
||||
{{? $isData }} } {{?}}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{# def.error:'uniqueItems' }}
|
||||
} {{? $breakOnError }} else { {{?}}
|
||||
{{??}}
|
||||
{{? $breakOnError }} if (true) { {{?}}
|
||||
{{?}}
|
282
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/validate.jst
generated
vendored
Normal file
282
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dot/validate.jst
generated
vendored
Normal file
@ -0,0 +1,282 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.defaults }}
|
||||
{{# def.coerce }}
|
||||
|
||||
{{ /**
|
||||
* schema compilation (render) time:
|
||||
* it = { schema, RULES, _validate, opts }
|
||||
* it.validate - this template function,
|
||||
* it is used recursively to generate code for subschemas
|
||||
*
|
||||
* runtime:
|
||||
* "validate" is a variable name to which this function will be assigned
|
||||
* validateRef etc. are defined in the parent scope in index.js
|
||||
*/ }}
|
||||
|
||||
{{
|
||||
var $async = it.schema.$async === true
|
||||
, $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref')
|
||||
, $id = it.self._getId(it.schema);
|
||||
}}
|
||||
|
||||
{{
|
||||
if (it.opts.strictKeywords) {
|
||||
var $unknownKwd = it.util.schemaUnknownRules(it.schema, it.RULES.keywords);
|
||||
if ($unknownKwd) {
|
||||
var $keywordsMsg = 'unknown keyword: ' + $unknownKwd;
|
||||
if (it.opts.strictKeywords === 'log') it.logger.warn($keywordsMsg);
|
||||
else throw new Error($keywordsMsg);
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
{{? it.isTop }}
|
||||
var validate = {{?$async}}{{it.async = true;}}async {{?}}function(data, dataPath, parentData, parentDataProperty, rootData) {
|
||||
'use strict';
|
||||
{{? $id && (it.opts.sourceCode || it.opts.processCode) }}
|
||||
{{= '/\*# sourceURL=' + $id + ' */' }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref) }}
|
||||
{{ var $keyword = 'false schema'; }}
|
||||
{{# def.setupKeyword }}
|
||||
{{? it.schema === false}}
|
||||
{{? it.isTop}}
|
||||
{{ $breakOnError = true; }}
|
||||
{{??}}
|
||||
var {{=$valid}} = false;
|
||||
{{?}}
|
||||
{{# def.error:'false schema' }}
|
||||
{{??}}
|
||||
{{? it.isTop}}
|
||||
{{? $async }}
|
||||
return data;
|
||||
{{??}}
|
||||
validate.errors = null;
|
||||
return true;
|
||||
{{?}}
|
||||
{{??}}
|
||||
var {{=$valid}} = true;
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? it.isTop}}
|
||||
};
|
||||
return validate;
|
||||
{{?}}
|
||||
|
||||
{{ return out; }}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? it.isTop }}
|
||||
{{
|
||||
var $top = it.isTop
|
||||
, $lvl = it.level = 0
|
||||
, $dataLvl = it.dataLevel = 0
|
||||
, $data = 'data';
|
||||
it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema));
|
||||
it.baseId = it.baseId || it.rootId;
|
||||
delete it.isTop;
|
||||
|
||||
it.dataPathArr = [undefined];
|
||||
|
||||
if (it.schema.default !== undefined && it.opts.useDefaults && it.opts.strictDefaults) {
|
||||
var $defaultMsg = 'default is ignored in the schema root';
|
||||
if (it.opts.strictDefaults === 'log') it.logger.warn($defaultMsg);
|
||||
else throw new Error($defaultMsg);
|
||||
}
|
||||
}}
|
||||
|
||||
var vErrors = null; {{ /* don't edit, used in replace */ }}
|
||||
var errors = 0; {{ /* don't edit, used in replace */ }}
|
||||
if (rootData === undefined) rootData = data; {{ /* don't edit, used in replace */ }}
|
||||
{{??}}
|
||||
{{
|
||||
var $lvl = it.level
|
||||
, $dataLvl = it.dataLevel
|
||||
, $data = 'data' + ($dataLvl || '');
|
||||
|
||||
if ($id) it.baseId = it.resolve.url(it.baseId, $id);
|
||||
|
||||
if ($async && !it.async) throw new Error('async schema in sync schema');
|
||||
}}
|
||||
|
||||
var errs_{{=$lvl}} = errors;
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $valid = 'valid' + $lvl
|
||||
, $breakOnError = !it.opts.allErrors
|
||||
, $closingBraces1 = ''
|
||||
, $closingBraces2 = '';
|
||||
|
||||
var $errorKeyword;
|
||||
var $typeSchema = it.schema.type
|
||||
, $typeIsArray = Array.isArray($typeSchema);
|
||||
|
||||
if ($typeSchema && it.opts.nullable && it.schema.nullable === true) {
|
||||
if ($typeIsArray) {
|
||||
if ($typeSchema.indexOf('null') == -1)
|
||||
$typeSchema = $typeSchema.concat('null');
|
||||
} else if ($typeSchema != 'null') {
|
||||
$typeSchema = [$typeSchema, 'null'];
|
||||
$typeIsArray = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ($typeIsArray && $typeSchema.length == 1) {
|
||||
$typeSchema = $typeSchema[0];
|
||||
$typeIsArray = false;
|
||||
}
|
||||
}}
|
||||
|
||||
{{## def.checkType:
|
||||
{{
|
||||
var $schemaPath = it.schemaPath + '.type'
|
||||
, $errSchemaPath = it.errSchemaPath + '/type'
|
||||
, $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType';
|
||||
}}
|
||||
|
||||
if ({{= it.util[$method]($typeSchema, $data, true) }}) {
|
||||
#}}
|
||||
|
||||
{{? it.schema.$ref && $refKeywords }}
|
||||
{{? it.opts.extendRefs == 'fail' }}
|
||||
{{ throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); }}
|
||||
{{?? it.opts.extendRefs !== true }}
|
||||
{{
|
||||
$refKeywords = false;
|
||||
it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"');
|
||||
}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? it.schema.$comment && it.opts.$comment }}
|
||||
{{= it.RULES.all.$comment.code(it, '$comment') }}
|
||||
{{?}}
|
||||
|
||||
{{? $typeSchema }}
|
||||
{{? it.opts.coerceTypes }}
|
||||
{{ var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); }}
|
||||
{{?}}
|
||||
|
||||
{{ var $rulesGroup = it.RULES.types[$typeSchema]; }}
|
||||
{{? $coerceToTypes || $typeIsArray || $rulesGroup === true ||
|
||||
($rulesGroup && !$shouldUseGroup($rulesGroup)) }}
|
||||
{{
|
||||
var $schemaPath = it.schemaPath + '.type'
|
||||
, $errSchemaPath = it.errSchemaPath + '/type';
|
||||
}}
|
||||
{{# def.checkType }}
|
||||
{{? $coerceToTypes }}
|
||||
{{# def.coerceType }}
|
||||
{{??}}
|
||||
{{# def.error:'type' }}
|
||||
{{?}}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
|
||||
{{? it.schema.$ref && !$refKeywords }}
|
||||
{{= it.RULES.all.$ref.code(it, '$ref') }}
|
||||
{{? $breakOnError }}
|
||||
}
|
||||
if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) {
|
||||
{{ $closingBraces2 += '}'; }}
|
||||
{{?}}
|
||||
{{??}}
|
||||
{{~ it.RULES:$rulesGroup }}
|
||||
{{? $shouldUseGroup($rulesGroup) }}
|
||||
{{? $rulesGroup.type }}
|
||||
if ({{= it.util.checkDataType($rulesGroup.type, $data) }}) {
|
||||
{{?}}
|
||||
{{? it.opts.useDefaults }}
|
||||
{{? $rulesGroup.type == 'object' && it.schema.properties }}
|
||||
{{# def.defaultProperties }}
|
||||
{{?? $rulesGroup.type == 'array' && Array.isArray(it.schema.items) }}
|
||||
{{# def.defaultItems }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{~ $rulesGroup.rules:$rule }}
|
||||
{{? $shouldUseRule($rule) }}
|
||||
{{ var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); }}
|
||||
{{? $code }}
|
||||
{{= $code }}
|
||||
{{? $breakOnError }}
|
||||
{{ $closingBraces1 += '}'; }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{~}}
|
||||
{{? $breakOnError }}
|
||||
{{= $closingBraces1 }}
|
||||
{{ $closingBraces1 = ''; }}
|
||||
{{?}}
|
||||
{{? $rulesGroup.type }}
|
||||
}
|
||||
{{? $typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes }}
|
||||
else {
|
||||
{{
|
||||
var $schemaPath = it.schemaPath + '.type'
|
||||
, $errSchemaPath = it.errSchemaPath + '/type';
|
||||
}}
|
||||
{{# def.error:'type' }}
|
||||
}
|
||||
{{?}}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }}
|
||||
if (errors === {{?$top}}0{{??}}errs_{{=$lvl}}{{?}}) {
|
||||
{{ $closingBraces2 += '}'; }}
|
||||
{{?}}
|
||||
{{?}}
|
||||
{{~}}
|
||||
{{?}}
|
||||
|
||||
{{? $breakOnError }} {{= $closingBraces2 }} {{?}}
|
||||
|
||||
{{? $top }}
|
||||
{{? $async }}
|
||||
if (errors === 0) return data; {{ /* don't edit, used in replace */ }}
|
||||
else throw new ValidationError(vErrors); {{ /* don't edit, used in replace */ }}
|
||||
{{??}}
|
||||
validate.errors = vErrors; {{ /* don't edit, used in replace */ }}
|
||||
return errors === 0; {{ /* don't edit, used in replace */ }}
|
||||
{{?}}
|
||||
};
|
||||
|
||||
return validate;
|
||||
{{??}}
|
||||
var {{=$valid}} = errors === errs_{{=$lvl}};
|
||||
{{?}}
|
||||
|
||||
{{# def.cleanUp }}
|
||||
|
||||
{{? $top }}
|
||||
{{# def.finalCleanUp }}
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
function $shouldUseGroup($rulesGroup) {
|
||||
var rules = $rulesGroup.rules;
|
||||
for (var i=0; i < rules.length; i++)
|
||||
if ($shouldUseRule(rules[i]))
|
||||
return true;
|
||||
}
|
||||
|
||||
function $shouldUseRule($rule) {
|
||||
return it.schema[$rule.keyword] !== undefined ||
|
||||
($rule.implements && $ruleImplementsSomeKeyword($rule));
|
||||
}
|
||||
|
||||
function $ruleImplementsSomeKeyword($rule) {
|
||||
var impl = $rule.implements;
|
||||
for (var i=0; i < impl.length; i++)
|
||||
if (it.schema[impl[i]] !== undefined)
|
||||
return true;
|
||||
}
|
||||
}}
|
3
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/README.md
generated
vendored
Normal file
3
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/README.md
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
These files are compiled dot templates from dot folder.
|
||||
|
||||
Do NOT edit them directly, edit the templates and run `npm run build` from main ajv folder.
|
157
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/_limit.js
generated
vendored
Normal file
157
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/_limit.js
generated
vendored
Normal file
@ -0,0 +1,157 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limit(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $isMax = $keyword == 'maximum',
|
||||
$exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum',
|
||||
$schemaExcl = it.schema[$exclusiveKeyword],
|
||||
$isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data,
|
||||
$op = $isMax ? '<' : '>',
|
||||
$notOp = $isMax ? '>' : '<',
|
||||
$errorKeyword = undefined;
|
||||
if ($isDataExcl) {
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
|
||||
$exclusive = 'exclusive' + $lvl,
|
||||
$exclType = 'exclType' + $lvl,
|
||||
$exclIsNumber = 'exclIsNumber' + $lvl,
|
||||
$opExpr = 'op' + $lvl,
|
||||
$opStr = '\' + ' + $opExpr + ' + \'';
|
||||
out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
|
||||
$schemaValueExcl = 'schemaExcl' + $lvl;
|
||||
out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { ';
|
||||
var $errorKeyword = $exclusiveKeyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\'; ';
|
||||
if ($schema === undefined) {
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
$schemaValue = $schemaValueExcl;
|
||||
$isData = $isDataExcl;
|
||||
}
|
||||
} else {
|
||||
var $exclIsNumber = typeof $schemaExcl == 'number',
|
||||
$opStr = $op;
|
||||
if ($exclIsNumber && $isData) {
|
||||
var $opExpr = '\'' + $opStr + '\'';
|
||||
out += ' if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { ';
|
||||
} else {
|
||||
if ($exclIsNumber && $schema === undefined) {
|
||||
$exclusive = true;
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
$schemaValue = $schemaExcl;
|
||||
$notOp += '=';
|
||||
} else {
|
||||
if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema);
|
||||
if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) {
|
||||
$exclusive = true;
|
||||
$errorKeyword = $exclusiveKeyword;
|
||||
$errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword;
|
||||
$notOp += '=';
|
||||
} else {
|
||||
$exclusive = false;
|
||||
$opStr += '=';
|
||||
}
|
||||
}
|
||||
var $opExpr = '\'' + $opStr + '\'';
|
||||
out += ' if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { ';
|
||||
}
|
||||
}
|
||||
$errorKeyword = $errorKeyword || $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be ' + ($opStr) + ' ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + ($schemaValue) + '\'';
|
||||
}
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
77
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/_limitItems.js
generated
vendored
Normal file
77
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/_limitItems.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limitItems(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $op = $keyword == 'maxItems' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { ';
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have ';
|
||||
if ($keyword == 'maxItems') {
|
||||
out += 'more';
|
||||
} else {
|
||||
out += 'fewer';
|
||||
}
|
||||
out += ' than ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' items\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
82
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/_limitLength.js
generated
vendored
Normal file
82
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/_limitLength.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limitLength(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $op = $keyword == 'maxLength' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
if (it.opts.unicode === false) {
|
||||
out += ' ' + ($data) + '.length ';
|
||||
} else {
|
||||
out += ' ucs2length(' + ($data) + ') ';
|
||||
}
|
||||
out += ' ' + ($op) + ' ' + ($schemaValue) + ') { ';
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT be ';
|
||||
if ($keyword == 'maxLength') {
|
||||
out += 'longer';
|
||||
} else {
|
||||
out += 'shorter';
|
||||
}
|
||||
out += ' than ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' characters\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
77
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/_limitProperties.js
generated
vendored
Normal file
77
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/_limitProperties.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
'use strict';
|
||||
module.exports = function generate__limitProperties(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $op = $keyword == 'maxProperties' ? '>' : '<';
|
||||
out += 'if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || ';
|
||||
}
|
||||
out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { ';
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have ';
|
||||
if ($keyword == 'maxProperties') {
|
||||
out += 'more';
|
||||
} else {
|
||||
out += 'fewer';
|
||||
}
|
||||
out += ' than ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' properties\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
43
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/allOf.js
generated
vendored
Normal file
43
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/allOf.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
module.exports = function generate_allOf(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $currentBaseId = $it.baseId,
|
||||
$allSchemasEmpty = true;
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $sch, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
$allSchemasEmpty = false;
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($breakOnError) {
|
||||
if ($allSchemasEmpty) {
|
||||
out += ' if (true) { ';
|
||||
} else {
|
||||
out += ' ' + ($closingBraces.slice(0, -1)) + ' ';
|
||||
}
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
74
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/anyOf.js
generated
vendored
Normal file
74
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/anyOf.js
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
'use strict';
|
||||
module.exports = function generate_anyOf(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $noEmptySchema = $schema.every(function($sch) {
|
||||
return (it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all));
|
||||
});
|
||||
if ($noEmptySchema) {
|
||||
var $currentBaseId = $it.baseId;
|
||||
out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; ';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $sch, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should match some schema in anyOf\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
out += ' validate.errors = vErrors; return false; ';
|
||||
}
|
||||
}
|
||||
out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
14
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/comment.js
generated
vendored
Normal file
14
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/comment.js
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
module.exports = function generate_comment(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $schema = it.schema[$keyword];
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $comment = it.util.toQuotedString($schema);
|
||||
if (it.opts.$comment === true) {
|
||||
out += ' console.log(' + ($comment) + ');';
|
||||
} else if (typeof it.opts.$comment == 'function') {
|
||||
out += ' self._opts.$comment(' + ($comment) + ', ' + (it.util.toQuotedString($errSchemaPath)) + ', validate.root.schema);';
|
||||
}
|
||||
return out;
|
||||
}
|
56
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/const.js
generated
vendored
Normal file
56
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/const.js
generated
vendored
Normal file
@ -0,0 +1,56 @@
|
||||
'use strict';
|
||||
module.exports = function generate_const(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if (!$isData) {
|
||||
out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';';
|
||||
}
|
||||
out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValue: schema' + ($lvl) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be equal to constant\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' }';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
82
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/contains.js
generated
vendored
Normal file
82
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/contains.js
generated
vendored
Normal file
@ -0,0 +1,82 @@
|
||||
'use strict';
|
||||
module.exports = function generate_contains(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $idx = 'i' + $lvl,
|
||||
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
||||
$nextData = 'data' + $dataNxt,
|
||||
$currentBaseId = it.baseId,
|
||||
$nonEmptySchema = (it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all));
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
|
||||
if ($nonEmptySchema) {
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
out += ' if (' + ($nextValid) + ') break; } ';
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {';
|
||||
} else {
|
||||
out += ' if (' + ($data) + '.length == 0) {';
|
||||
}
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should contain a valid item\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else { ';
|
||||
if ($nonEmptySchema) {
|
||||
out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
|
||||
}
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
228
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/custom.js
generated
vendored
Normal file
228
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/custom.js
generated
vendored
Normal file
@ -0,0 +1,228 @@
|
||||
'use strict';
|
||||
module.exports = function generate_custom(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $rule = this,
|
||||
$definition = 'definition' + $lvl,
|
||||
$rDef = $rule.definition,
|
||||
$closingBraces = '';
|
||||
var $compile, $inline, $macro, $ruleValidate, $validateCode;
|
||||
if ($isData && $rDef.$data) {
|
||||
$validateCode = 'keywordValidate' + $lvl;
|
||||
var $validateSchema = $rDef.validateSchema;
|
||||
out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;';
|
||||
} else {
|
||||
$ruleValidate = it.useCustomRule($rule, $schema, it.schema, it);
|
||||
if (!$ruleValidate) return;
|
||||
$schemaValue = 'validate.schema' + $schemaPath;
|
||||
$validateCode = $ruleValidate.code;
|
||||
$compile = $rDef.compile;
|
||||
$inline = $rDef.inline;
|
||||
$macro = $rDef.macro;
|
||||
}
|
||||
var $ruleErrs = $validateCode + '.errors',
|
||||
$i = 'i' + $lvl,
|
||||
$ruleErr = 'ruleErr' + $lvl,
|
||||
$asyncKeyword = $rDef.async;
|
||||
if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema');
|
||||
if (!($inline || $macro)) {
|
||||
out += '' + ($ruleErrs) + ' = null;';
|
||||
}
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
|
||||
if ($isData && $rDef.$data) {
|
||||
$closingBraces += '}';
|
||||
out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { ';
|
||||
if ($validateSchema) {
|
||||
$closingBraces += '}';
|
||||
out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { ';
|
||||
}
|
||||
}
|
||||
if ($inline) {
|
||||
if ($rDef.statements) {
|
||||
out += ' ' + ($ruleValidate.validate) + ' ';
|
||||
} else {
|
||||
out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; ';
|
||||
}
|
||||
} else if ($macro) {
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
$it.schema = $ruleValidate.validate;
|
||||
$it.schemaPath = '';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
var $code = it.validate($it).replace(/validate\.schema/g, $validateCode);
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += ' ' + ($code);
|
||||
} else {
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
out += ' ' + ($validateCode) + '.call( ';
|
||||
if (it.opts.passContext) {
|
||||
out += 'this';
|
||||
} else {
|
||||
out += 'self';
|
||||
}
|
||||
if ($compile || $rDef.schema === false) {
|
||||
out += ' , ' + ($data) + ' ';
|
||||
} else {
|
||||
out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' ';
|
||||
}
|
||||
out += ' , (dataPath || \'\')';
|
||||
if (it.errorPath != '""') {
|
||||
out += ' + ' + (it.errorPath);
|
||||
}
|
||||
var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData',
|
||||
$parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty';
|
||||
out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) ';
|
||||
var def_callRuleValidate = out;
|
||||
out = $$outStack.pop();
|
||||
if ($rDef.errors === false) {
|
||||
out += ' ' + ($valid) + ' = ';
|
||||
if ($asyncKeyword) {
|
||||
out += 'await ';
|
||||
}
|
||||
out += '' + (def_callRuleValidate) + '; ';
|
||||
} else {
|
||||
if ($asyncKeyword) {
|
||||
$ruleErrs = 'customErrors' + $lvl;
|
||||
out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = await ' + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } ';
|
||||
} else {
|
||||
out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; ';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($rDef.modifying) {
|
||||
out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];';
|
||||
}
|
||||
out += '' + ($closingBraces);
|
||||
if ($rDef.valid) {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
} else {
|
||||
out += ' if ( ';
|
||||
if ($rDef.valid === undefined) {
|
||||
out += ' !';
|
||||
if ($macro) {
|
||||
out += '' + ($nextValid);
|
||||
} else {
|
||||
out += '' + ($valid);
|
||||
}
|
||||
} else {
|
||||
out += ' ' + (!$rDef.valid) + ' ';
|
||||
}
|
||||
out += ') { ';
|
||||
$errorKeyword = $rule.keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = '';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
var def_customError = out;
|
||||
out = $$outStack.pop();
|
||||
if ($inline) {
|
||||
if ($rDef.errors) {
|
||||
if ($rDef.errors != 'full') {
|
||||
out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } ';
|
||||
if (it.opts.verbose) {
|
||||
out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
|
||||
}
|
||||
out += ' } ';
|
||||
}
|
||||
} else {
|
||||
if ($rDef.errors === false) {
|
||||
out += ' ' + (def_customError) + ' ';
|
||||
} else {
|
||||
out += ' if (' + ($errs) + ' == errors) { ' + (def_customError) + ' } else { for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; if (' + ($ruleErr) + '.schemaPath === undefined) { ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; } ';
|
||||
if (it.opts.verbose) {
|
||||
out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
|
||||
}
|
||||
out += ' } } ';
|
||||
}
|
||||
}
|
||||
} else if ($macro) {
|
||||
out += ' var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
out += ' validate.errors = vErrors; return false; ';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($rDef.errors === false) {
|
||||
out += ' ' + (def_customError) + ' ';
|
||||
} else {
|
||||
out += ' if (Array.isArray(' + ($ruleErrs) + ')) { if (vErrors === null) vErrors = ' + ($ruleErrs) + '; else vErrors = vErrors.concat(' + ($ruleErrs) + '); errors = vErrors.length; for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '<errors; ' + ($i) + '++) { var ' + ($ruleErr) + ' = vErrors[' + ($i) + ']; if (' + ($ruleErr) + '.dataPath === undefined) ' + ($ruleErr) + '.dataPath = (dataPath || \'\') + ' + (it.errorPath) + '; ' + ($ruleErr) + '.schemaPath = "' + ($errSchemaPath) + '"; ';
|
||||
if (it.opts.verbose) {
|
||||
out += ' ' + ($ruleErr) + '.schema = ' + ($schemaValue) + '; ' + ($ruleErr) + '.data = ' + ($data) + '; ';
|
||||
}
|
||||
out += ' } } else { ' + (def_customError) + ' } ';
|
||||
}
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
168
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/dependencies.js
generated
vendored
Normal file
168
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/dependencies.js
generated
vendored
Normal file
@ -0,0 +1,168 @@
|
||||
'use strict';
|
||||
module.exports = function generate_dependencies(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $schemaDeps = {},
|
||||
$propertyDeps = {},
|
||||
$ownProperties = it.opts.ownProperties;
|
||||
for ($property in $schema) {
|
||||
var $sch = $schema[$property];
|
||||
var $deps = Array.isArray($sch) ? $propertyDeps : $schemaDeps;
|
||||
$deps[$property] = $sch;
|
||||
}
|
||||
out += 'var ' + ($errs) + ' = errors;';
|
||||
var $currentErrorPath = it.errorPath;
|
||||
out += 'var missing' + ($lvl) + ';';
|
||||
for (var $property in $propertyDeps) {
|
||||
$deps = $propertyDeps[$property];
|
||||
if ($deps.length) {
|
||||
out += ' if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
|
||||
if ($ownProperties) {
|
||||
out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' && ( ';
|
||||
var arr1 = $deps;
|
||||
if (arr1) {
|
||||
var $propertyKey, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$propertyKey = arr1[$i += 1];
|
||||
if ($i) {
|
||||
out += ' || ';
|
||||
}
|
||||
var $prop = it.util.getProperty($propertyKey),
|
||||
$useData = $data + $prop;
|
||||
out += ' ( ( ' + ($useData) + ' === undefined ';
|
||||
if ($ownProperties) {
|
||||
out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
|
||||
}
|
||||
out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) ';
|
||||
}
|
||||
}
|
||||
out += ')) { ';
|
||||
var $propertyPath = 'missing' + $lvl,
|
||||
$missingProperty = '\' + ' + $propertyPath + ' + \'';
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath;
|
||||
}
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should have ';
|
||||
if ($deps.length == 1) {
|
||||
out += 'property ' + (it.util.escapeQuotes($deps[0]));
|
||||
} else {
|
||||
out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));
|
||||
}
|
||||
out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
} else {
|
||||
out += ' ) { ';
|
||||
var arr2 = $deps;
|
||||
if (arr2) {
|
||||
var $propertyKey, i2 = -1,
|
||||
l2 = arr2.length - 1;
|
||||
while (i2 < l2) {
|
||||
$propertyKey = arr2[i2 += 1];
|
||||
var $prop = it.util.getProperty($propertyKey),
|
||||
$missingProperty = it.util.escapeQuotes($propertyKey),
|
||||
$useData = $data + $prop;
|
||||
if (it.opts._errorDataPathProperty) {
|
||||
it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers);
|
||||
}
|
||||
out += ' if ( ' + ($useData) + ' === undefined ';
|
||||
if ($ownProperties) {
|
||||
out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') ';
|
||||
}
|
||||
out += ') { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should have ';
|
||||
if ($deps.length == 1) {
|
||||
out += 'property ' + (it.util.escapeQuotes($deps[0]));
|
||||
} else {
|
||||
out += 'properties ' + (it.util.escapeQuotes($deps.join(", ")));
|
||||
}
|
||||
out += ' when property ' + (it.util.escapeQuotes($property)) + ' is present\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
|
||||
}
|
||||
}
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
$closingBraces += '}';
|
||||
out += ' else { ';
|
||||
}
|
||||
}
|
||||
}
|
||||
it.errorPath = $currentErrorPath;
|
||||
var $currentBaseId = $it.baseId;
|
||||
for (var $property in $schemaDeps) {
|
||||
var $sch = $schemaDeps[$property];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
out += ' ' + ($nextValid) + ' = true; if ( ' + ($data) + (it.util.getProperty($property)) + ' !== undefined ';
|
||||
if ($ownProperties) {
|
||||
out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($property)) + '\') ';
|
||||
}
|
||||
out += ') { ';
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + it.util.getProperty($property);
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($property);
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
66
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/enum.js
generated
vendored
Normal file
66
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/enum.js
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
'use strict';
|
||||
module.exports = function generate_enum(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $i = 'i' + $lvl,
|
||||
$vSchema = 'schema' + $lvl;
|
||||
if (!$isData) {
|
||||
out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + ';';
|
||||
}
|
||||
out += 'var ' + ($valid) + ';';
|
||||
if ($isData) {
|
||||
out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {';
|
||||
}
|
||||
out += '' + ($valid) + ' = false;for (var ' + ($i) + '=0; ' + ($i) + '<' + ($vSchema) + '.length; ' + ($i) + '++) if (equal(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + '])) { ' + ($valid) + ' = true; break; }';
|
||||
if ($isData) {
|
||||
out += ' } ';
|
||||
}
|
||||
out += ' if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be equal to one of the allowed values\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' }';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
150
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/format.js
generated
vendored
Normal file
150
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/format.js
generated
vendored
Normal file
@ -0,0 +1,150 @@
|
||||
'use strict';
|
||||
module.exports = function generate_format(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
if (it.opts.format === false) {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
var $unknownFormats = it.opts.unknownFormats,
|
||||
$allowUnknown = Array.isArray($unknownFormats);
|
||||
if ($isData) {
|
||||
var $format = 'format' + $lvl,
|
||||
$isObject = 'isObject' + $lvl,
|
||||
$formatType = 'formatType' + $lvl;
|
||||
out += ' var ' + ($format) + ' = formats[' + ($schemaValue) + ']; var ' + ($isObject) + ' = typeof ' + ($format) + ' == \'object\' && !(' + ($format) + ' instanceof RegExp) && ' + ($format) + '.validate; var ' + ($formatType) + ' = ' + ($isObject) + ' && ' + ($format) + '.type || \'string\'; if (' + ($isObject) + ') { ';
|
||||
if (it.async) {
|
||||
out += ' var async' + ($lvl) + ' = ' + ($format) + '.async; ';
|
||||
}
|
||||
out += ' ' + ($format) + ' = ' + ($format) + '.validate; } if ( ';
|
||||
if ($isData) {
|
||||
out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || ';
|
||||
}
|
||||
out += ' (';
|
||||
if ($unknownFormats != 'ignore') {
|
||||
out += ' (' + ($schemaValue) + ' && !' + ($format) + ' ';
|
||||
if ($allowUnknown) {
|
||||
out += ' && self._opts.unknownFormats.indexOf(' + ($schemaValue) + ') == -1 ';
|
||||
}
|
||||
out += ') || ';
|
||||
}
|
||||
out += ' (' + ($format) + ' && ' + ($formatType) + ' == \'' + ($ruleType) + '\' && !(typeof ' + ($format) + ' == \'function\' ? ';
|
||||
if (it.async) {
|
||||
out += ' (async' + ($lvl) + ' ? await ' + ($format) + '(' + ($data) + ') : ' + ($format) + '(' + ($data) + ')) ';
|
||||
} else {
|
||||
out += ' ' + ($format) + '(' + ($data) + ') ';
|
||||
}
|
||||
out += ' : ' + ($format) + '.test(' + ($data) + '))))) {';
|
||||
} else {
|
||||
var $format = it.formats[$schema];
|
||||
if (!$format) {
|
||||
if ($unknownFormats == 'ignore') {
|
||||
it.logger.warn('unknown format "' + $schema + '" ignored in schema at path "' + it.errSchemaPath + '"');
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
return out;
|
||||
} else if ($allowUnknown && $unknownFormats.indexOf($schema) >= 0) {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
return out;
|
||||
} else {
|
||||
throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"');
|
||||
}
|
||||
}
|
||||
var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate;
|
||||
var $formatType = $isObject && $format.type || 'string';
|
||||
if ($isObject) {
|
||||
var $async = $format.async === true;
|
||||
$format = $format.validate;
|
||||
}
|
||||
if ($formatType != $ruleType) {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
return out;
|
||||
}
|
||||
if ($async) {
|
||||
if (!it.async) throw new Error('async format in sync schema');
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate';
|
||||
out += ' if (!(await ' + ($formatRef) + '(' + ($data) + '))) { ';
|
||||
} else {
|
||||
out += ' if (! ';
|
||||
var $formatRef = 'formats' + it.util.getProperty($schema);
|
||||
if ($isObject) $formatRef += '.validate';
|
||||
if (typeof $format == 'function') {
|
||||
out += ' ' + ($formatRef) + '(' + ($data) + ') ';
|
||||
} else {
|
||||
out += ' ' + ($formatRef) + '.test(' + ($data) + ') ';
|
||||
}
|
||||
out += ') { ';
|
||||
}
|
||||
}
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: ';
|
||||
if ($isData) {
|
||||
out += '' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should match format "';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + (it.util.escapeQuotes($schema));
|
||||
}
|
||||
out += '"\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
104
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/if.js
generated
vendored
Normal file
104
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/if.js
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
'use strict';
|
||||
module.exports = function generate_if(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $thenSch = it.schema['then'],
|
||||
$elseSch = it.schema['else'],
|
||||
$thenPresent = $thenSch !== undefined && (it.opts.strictKeywords ? typeof $thenSch == 'object' && Object.keys($thenSch).length > 0 : it.util.schemaHasRules($thenSch, it.RULES.all)),
|
||||
$elsePresent = $elseSch !== undefined && (it.opts.strictKeywords ? typeof $elseSch == 'object' && Object.keys($elseSch).length > 0 : it.util.schemaHasRules($elseSch, it.RULES.all)),
|
||||
$currentBaseId = $it.baseId;
|
||||
if ($thenPresent || $elsePresent) {
|
||||
var $ifClause;
|
||||
$it.createErrors = false;
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = true; ';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
$it.createErrors = true;
|
||||
out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
if ($thenPresent) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$it.schema = it.schema['then'];
|
||||
$it.schemaPath = it.schemaPath + '.then';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/then';
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';
|
||||
if ($thenPresent && $elsePresent) {
|
||||
$ifClause = 'ifClause' + $lvl;
|
||||
out += ' var ' + ($ifClause) + ' = \'then\'; ';
|
||||
} else {
|
||||
$ifClause = '\'then\'';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($elsePresent) {
|
||||
out += ' else { ';
|
||||
}
|
||||
} else {
|
||||
out += ' if (!' + ($nextValid) + ') { ';
|
||||
}
|
||||
if ($elsePresent) {
|
||||
$it.schema = it.schema['else'];
|
||||
$it.schemaPath = it.schemaPath + '.else';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/else';
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
out += ' ' + ($valid) + ' = ' + ($nextValid) + '; ';
|
||||
if ($thenPresent && $elsePresent) {
|
||||
$ifClause = 'ifClause' + $lvl;
|
||||
out += ' var ' + ($ifClause) + ' = \'else\'; ';
|
||||
} else {
|
||||
$ifClause = '\'else\'';
|
||||
}
|
||||
out += ' } ';
|
||||
}
|
||||
out += ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('if') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { failingKeyword: ' + ($ifClause) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should match "\' + ' + ($ifClause) + ' + \'" schema\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError(vErrors); ';
|
||||
} else {
|
||||
out += ' validate.errors = vErrors; return false; ';
|
||||
}
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
} else {
|
||||
if ($breakOnError) {
|
||||
out += ' if (true) { ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
33
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/index.js
generated
vendored
Normal file
33
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/index.js
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
'use strict';
|
||||
|
||||
//all requires must be explicit because browserify won't work with dynamic requires
|
||||
module.exports = {
|
||||
'$ref': require('./ref'),
|
||||
allOf: require('./allOf'),
|
||||
anyOf: require('./anyOf'),
|
||||
'$comment': require('./comment'),
|
||||
const: require('./const'),
|
||||
contains: require('./contains'),
|
||||
dependencies: require('./dependencies'),
|
||||
'enum': require('./enum'),
|
||||
format: require('./format'),
|
||||
'if': require('./if'),
|
||||
items: require('./items'),
|
||||
maximum: require('./_limit'),
|
||||
minimum: require('./_limit'),
|
||||
maxItems: require('./_limitItems'),
|
||||
minItems: require('./_limitItems'),
|
||||
maxLength: require('./_limitLength'),
|
||||
minLength: require('./_limitLength'),
|
||||
maxProperties: require('./_limitProperties'),
|
||||
minProperties: require('./_limitProperties'),
|
||||
multipleOf: require('./multipleOf'),
|
||||
not: require('./not'),
|
||||
oneOf: require('./oneOf'),
|
||||
pattern: require('./pattern'),
|
||||
properties: require('./properties'),
|
||||
propertyNames: require('./propertyNames'),
|
||||
required: require('./required'),
|
||||
uniqueItems: require('./uniqueItems'),
|
||||
validate: require('./validate')
|
||||
};
|
141
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/items.js
generated
vendored
Normal file
141
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/items.js
generated
vendored
Normal file
@ -0,0 +1,141 @@
|
||||
'use strict';
|
||||
module.exports = function generate_items(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $idx = 'i' + $lvl,
|
||||
$dataNxt = $it.dataLevel = it.dataLevel + 1,
|
||||
$nextData = 'data' + $dataNxt,
|
||||
$currentBaseId = it.baseId;
|
||||
out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';';
|
||||
if (Array.isArray($schema)) {
|
||||
var $additionalItems = it.schema.additionalItems;
|
||||
if ($additionalItems === false) {
|
||||
out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; ';
|
||||
var $currErrSchemaPath = $errSchemaPath;
|
||||
$errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
out += ' if (!' + ($valid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
$errSchemaPath = $currErrSchemaPath;
|
||||
if ($breakOnError) {
|
||||
$closingBraces += '}';
|
||||
out += ' else { ';
|
||||
}
|
||||
}
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $sch, $i = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($i < l1) {
|
||||
$sch = arr1[$i += 1];
|
||||
if ((it.opts.strictKeywords ? typeof $sch == 'object' && Object.keys($sch).length > 0 : it.util.schemaHasRules($sch, it.RULES.all))) {
|
||||
out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { ';
|
||||
var $passData = $data + '[' + $i + ']';
|
||||
$it.schema = $sch;
|
||||
$it.schemaPath = $schemaPath + '[' + $i + ']';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $i;
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true);
|
||||
$it.dataPathArr[$dataNxt] = $i;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof $additionalItems == 'object' && (it.opts.strictKeywords ? typeof $additionalItems == 'object' && Object.keys($additionalItems).length > 0 : it.util.schemaHasRules($additionalItems, it.RULES.all))) {
|
||||
$it.schema = $additionalItems;
|
||||
$it.schemaPath = it.schemaPath + '.additionalItems';
|
||||
$it.errSchemaPath = it.errSchemaPath + '/additionalItems';
|
||||
out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' if (!' + ($nextValid) + ') break; ';
|
||||
}
|
||||
out += ' } } ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
}
|
||||
} else if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { ';
|
||||
$it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true);
|
||||
var $passData = $data + '[' + $idx + ']';
|
||||
$it.dataPathArr[$dataNxt] = $idx;
|
||||
var $code = it.validate($it);
|
||||
$it.baseId = $currentBaseId;
|
||||
if (it.util.varOccurences($code, $nextData) < 2) {
|
||||
out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' ';
|
||||
} else {
|
||||
out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' ';
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' if (!' + ($nextValid) + ') break; ';
|
||||
}
|
||||
out += ' }';
|
||||
}
|
||||
if ($breakOnError) {
|
||||
out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {';
|
||||
}
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
77
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/multipleOf.js
generated
vendored
Normal file
77
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/multipleOf.js
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
'use strict';
|
||||
module.exports = function generate_multipleOf(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
out += 'var division' + ($lvl) + ';if (';
|
||||
if ($isData) {
|
||||
out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || ';
|
||||
}
|
||||
out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', ';
|
||||
if (it.opts.multipleOfPrecision) {
|
||||
out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' ';
|
||||
} else {
|
||||
out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') ';
|
||||
}
|
||||
out += ' ) ';
|
||||
if ($isData) {
|
||||
out += ' ) ';
|
||||
}
|
||||
out += ' ) { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be multiple of ';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + ($schemaValue) + '\'';
|
||||
}
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + ($schema);
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '} ';
|
||||
if ($breakOnError) {
|
||||
out += ' else { ';
|
||||
}
|
||||
return out;
|
||||
}
|
84
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/not.js
generated
vendored
Normal file
84
package/lean/luci-app-jd-dailybonus/root/usr/lib/node/request/node_modules/ajv/lib/dotjs/not.js
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
'use strict';
|
||||
module.exports = function generate_not(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
if ((it.opts.strictKeywords ? typeof $schema == 'object' && Object.keys($schema).length > 0 : it.util.schemaHasRules($schema, it.RULES.all))) {
|
||||
$it.schema = $schema;
|
||||
$it.schemaPath = $schemaPath;
|
||||
$it.errSchemaPath = $errSchemaPath;
|
||||
out += ' var ' + ($errs) + ' = errors; ';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
$it.createErrors = false;
|
||||
var $allErrorsOption;
|
||||
if ($it.opts.allErrors) {
|
||||
$allErrorsOption = $it.opts.allErrors;
|
||||
$it.opts.allErrors = false;
|
||||
}
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.createErrors = true;
|
||||
if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption;
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += ' if (' + ($nextValid) + ') { ';
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT be valid\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) {
|
||||
/* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } ';
|
||||
if (it.opts.allErrors) {
|
||||
out += ' } ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should NOT be valid\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
if ($breakOnError) {
|
||||
out += ' if (false) { ';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user