first commit

main
liuwne 2 years ago
commit 32f47e324d
  1. 33
      .hbuilderx/launch.json
  2. 24
      App.vue
  3. 5
      common/FileManage.js
  4. 222
      common/blue_request.js
  5. 97
      common/network/protocol645.js
  6. BIN
      components/nk-select-file/img/back.png
  7. BIN
      components/nk-select-file/img/check.png
  8. BIN
      components/nk-select-file/img/checkout.png
  9. BIN
      components/nk-select-file/img/comefile.png
  10. BIN
      components/nk-select-file/img/file.png
  11. BIN
      components/nk-select-file/img/files.png
  12. BIN
      components/nk-select-file/img/rightjt.png
  13. 703
      components/nk-select-file/nk-select-file.vue
  14. 20
      index.html
  15. 20
      main.js
  16. 87
      manifest.json
  17. 15
      node_modules/.bin/color-support
  18. 17
      node_modules/.bin/color-support.cmd
  19. 18
      node_modules/.bin/color-support.ps1
  20. 15
      node_modules/.bin/in-install
  21. 17
      node_modules/.bin/in-install.cmd
  22. 18
      node_modules/.bin/in-install.ps1
  23. 15
      node_modules/.bin/in-publish
  24. 17
      node_modules/.bin/in-publish.cmd
  25. 18
      node_modules/.bin/in-publish.ps1
  26. 15
      node_modules/.bin/json5
  27. 17
      node_modules/.bin/json5.cmd
  28. 18
      node_modules/.bin/json5.ps1
  29. 15
      node_modules/.bin/mkdirp
  30. 17
      node_modules/.bin/mkdirp.cmd
  31. 18
      node_modules/.bin/mkdirp.ps1
  32. 15
      node_modules/.bin/node-gyp
  33. 17
      node_modules/.bin/node-gyp.cmd
  34. 18
      node_modules/.bin/node-gyp.ps1
  35. 15
      node_modules/.bin/node-sass
  36. 17
      node_modules/.bin/node-sass.cmd
  37. 18
      node_modules/.bin/node-sass.ps1
  38. 15
      node_modules/.bin/node-which
  39. 17
      node_modules/.bin/node-which.cmd
  40. 18
      node_modules/.bin/node-which.ps1
  41. 15
      node_modules/.bin/nopt
  42. 17
      node_modules/.bin/nopt.cmd
  43. 18
      node_modules/.bin/nopt.ps1
  44. 15
      node_modules/.bin/not-in-install
  45. 17
      node_modules/.bin/not-in-install.cmd
  46. 18
      node_modules/.bin/not-in-install.ps1
  47. 15
      node_modules/.bin/not-in-publish
  48. 17
      node_modules/.bin/not-in-publish.cmd
  49. 18
      node_modules/.bin/not-in-publish.ps1
  50. 15
      node_modules/.bin/resolve
  51. 17
      node_modules/.bin/resolve.cmd
  52. 18
      node_modules/.bin/resolve.ps1
  53. 15
      node_modules/.bin/rimraf
  54. 17
      node_modules/.bin/rimraf.cmd
  55. 18
      node_modules/.bin/rimraf.ps1
  56. 15
      node_modules/.bin/sassgraph
  57. 17
      node_modules/.bin/sassgraph.cmd
  58. 18
      node_modules/.bin/sassgraph.ps1
  59. 15
      node_modules/.bin/semver
  60. 17
      node_modules/.bin/semver.cmd
  61. 18
      node_modules/.bin/semver.ps1
  62. 15
      node_modules/.bin/sshpk-conv
  63. 17
      node_modules/.bin/sshpk-conv.cmd
  64. 18
      node_modules/.bin/sshpk-conv.ps1
  65. 15
      node_modules/.bin/sshpk-sign
  66. 17
      node_modules/.bin/sshpk-sign.cmd
  67. 18
      node_modules/.bin/sshpk-sign.ps1
  68. 15
      node_modules/.bin/sshpk-verify
  69. 17
      node_modules/.bin/sshpk-verify.cmd
  70. 18
      node_modules/.bin/sshpk-verify.ps1
  71. 15
      node_modules/.bin/strip-indent
  72. 17
      node_modules/.bin/strip-indent.cmd
  73. 18
      node_modules/.bin/strip-indent.ps1
  74. 15
      node_modules/.bin/uuid
  75. 17
      node_modules/.bin/uuid.cmd
  76. 18
      node_modules/.bin/uuid.ps1
  77. 15
      node_modules/.bin/which
  78. 17
      node_modules/.bin/which.cmd
  79. 18
      node_modules/.bin/which.ps1
  80. 21
      node_modules/@types/json-schema/LICENSE
  81. 15
      node_modules/@types/json-schema/README.md
  82. 749
      node_modules/@types/json-schema/index.d.ts
  83. 65
      node_modules/@types/json-schema/package.json
  84. 46
      node_modules/abbrev/LICENSE
  85. 23
      node_modules/abbrev/README.md
  86. 61
      node_modules/abbrev/abbrev.js
  87. 56
      node_modules/abbrev/package.json
  88. 21
      node_modules/ajv-keywords/LICENSE
  89. 836
      node_modules/ajv-keywords/README.md
  90. 7
      node_modules/ajv-keywords/ajv-keywords.d.ts
  91. 35
      node_modules/ajv-keywords/index.js
  92. 101
      node_modules/ajv-keywords/keywords/_formatLimit.js
  93. 15
      node_modules/ajv-keywords/keywords/_util.js
  94. 18
      node_modules/ajv-keywords/keywords/allRequired.js
  95. 24
      node_modules/ajv-keywords/keywords/anyRequired.js
  96. 54
      node_modules/ajv-keywords/keywords/deepProperties.js
  97. 57
      node_modules/ajv-keywords/keywords/deepRequired.js
  98. 116
      node_modules/ajv-keywords/keywords/dot/_formatLimit.jst
  99. 33
      node_modules/ajv-keywords/keywords/dot/patternRequired.jst
  100. 71
      node_modules/ajv-keywords/keywords/dot/switch.jst
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,33 @@
{
// launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version" : "0.0",
"configurations" : [
{
"app-plus" : {
"launchtype" : "local"
},
"default" : {
"launchtype" : "local"
},
"mp-alipay" : {
"launchtype" : "local"
},
"mp-jd" : {
"launchtype" : "local"
},
"mp-weixin" : {
"launchtype" : "local"
},
"type" : "uniCloud"
},
{
"playground" : "standard",
"type" : "uni-app:app-android"
},
{
"playground" : "custom",
"type" : "uni-app:app-ios"
}
]
}

@ -0,0 +1,24 @@
<script>
export default {
globalData: {
id:0
},
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style lang="scss">
/*每个页面公共css */
@import "/node_modules/uview-ui/index.scss";
page {
height: 100%;
}
</style>

@ -0,0 +1,5 @@
class FileManage{
readFile(){
}
}

@ -0,0 +1,222 @@
// #ifdef APP
import ecUI from '@/utils/ecUI.js'
import ecBLE from '@/utils/ecBLE/ecBLE.js'
// #endif
// #ifdef MP
const ecUI = require('@/utils/ecUI.js')
const ecBLE = require('@/utils/ecBLE/ecBLE.js')
// #endif
export function hexToString(hex)
{
var tmp = '';
if(hex < 0)
{
hex=hex+256;
}
tmp = hex.toString(16)
tmp = tmp.padStart(2, '0')
return tmp
}
export function send_uart(id,cc,icode,len,msg)
{
var code=''
var send_data=[],send_stringdata='',send_length=0;
if(cc == '08')
{
send_length = 18
}
else if(cc == '8f')
{
send_length = len+12;
}
else{
send_length = len+14;
}
send_data[0]='68';
send_data[7]='68';
for(var i=0 ; i<6; i ++)
{
send_data[6-i] = id.substr(2*i,2);
}
//获取控制码
send_data[8]=cc;
var i1,i2,i3,i4
if(cc == '08'||cc == '8f')
{
//获取长度
send_data[9]=hexToString(len);
//获取时钟 ss mm hh dd mm yy+33H
for(var i1=0 ; i1<len; i1 ++)
{
send_data[10+i1] = hexToString((parseInt(msg.substr(2*i1,2),16)+51)%256);
}
}
else{
//获取长度
send_data[9]=hexToString(len+2);
//获取 icode ,同时+33H
if(cc=="0f"){
for(var i=0 ; i<2; i++)
{
send_data[10+i] = icode.substr(2*i,2);
}
}else{
for(var i=0 ; i<2; i++)
{
send_data[11-i] = hexToString((parseInt(icode.substr(2*i,2),16)+51)%256);
}
}
//获取数据内容 +33H
if(icode=='b200'){
//文件校验和
for(var b1=0;b1<4;b1++){
send_data[15-b1] = hexToString((parseInt(msg.textChecks.substr(2*b1,2),16)+51)%256);
}
//数据长度
for(var b2=0;b2<4;b2++){
send_data[19-b2] = hexToString((parseInt(msg.lenChecks.substr(2*b2,2),16)+51)%256);
}
}else if(cc=="0f"){
for(var i=0;i<len;i++){
send_data[12+i] = hexToString((msg[i]+51)%256);
}
}else{
for(var i1=0 ; i1<len; i1++)
{
send_data[12+i1] = hexToString((parseInt(msg.substr(2*i1,2),16)+51)%256);
}
}
}
// if(cc=='0f'){
// let sum2=0
// for(var j2 = 0;j2 <send_length-2;j2++)
// {
// sum2= sum2+parseInt(send_data[j2],16);
// }
// sum2 = sum2.toString().slice(-2);
// send_data[send_length-2]= hexToString(sum2);
// }else{
let sum = 0;
//计算645累加校验和
for(var j = 0;j < send_length-2;j++)
{
sum =sum + parseInt(send_data[j],16);
}
sum = sum%256;
send_data[send_length-2]= hexToString(sum);
// }
send_data[send_length-1]='16'
//发送数据转为字符串
for(var k = 0; k < send_length; k++)
{
send_stringdata=send_stringdata+send_data[k]
}
console.log('发送命令:'+send_stringdata);
ecBLE.writeBLECharacteristicValue(send_stringdata, true)
if(cc == '8f')
{
return
}
return new Promise((resolve, reject) => {
ecBLE.onBLECharacteristicValueChange((str, strHex) => {
recv_uart(strHex)
console.log('设备回复:'+strHex);
resolve(getApp().globalData.uart_645datalink)
})
})
}
//串口接收解析
export function recv_uart(rec)
{
var uart_645datalink={
id:'',
cc:'',
len:'',
icode:'',
data:[],
uart_recvflag: 0,//接收正确645协议 0:未收到正确报文 1:收到正确报文
}
var recv_data=[],recv_length=0
//去除fe,获得完整645协议报文
var start = rec.indexOf('68')
recv_length = rec.length/2;
rec = rec.slice(start,rec.length)
recv_length = rec.length/2;
uart_645datalink.text = rec
if(recv_length > 0)
{
//获取645报文,按照字节存储到数组
for(var i=0 ; i<recv_length; i ++)
{
recv_data[i] = rec.substr(2*i,2);
}
let sum = 0;
if(recv_data[0] == '68'&& recv_data[7] == '68')
{
//计算645累加校验和
for(var j = 0;j < recv_length-2;j++)
{
sum =sum + parseInt(recv_data[j],16);
}
sum = sum%256;
//验证校验和
if(sum == parseInt(recv_data[recv_length-2],16))
{
//获取设备ID
uart_645datalink.id= recv_data[6]+recv_data[5]+recv_data[4]+recv_data[3]+recv_data[2]+recv_data[1];
//获取控制码
uart_645datalink.cc = recv_data[8];
//获取数据长度
uart_645datalink.len = parseInt(recv_data[9],16)
if(uart_645datalink.len >=2)
{
//获取标识编码
uart_645datalink.icode = hexToString(parseInt(recv_data[11],16)-51)+hexToString(parseInt(recv_data[10],16)-51);
//获取数据
for(var k=0;k<uart_645datalink.len-2;k++)
{
uart_645datalink.data[k] = hexToString(parseInt(recv_data[12+k],16)-51);
}
}
else{
uart_645datalink.icode = ''
//获取数据
for(var k=0;k<uart_645datalink.len;k++)
{
uart_645datalink.data[k] = hexToString(parseInt(recv_data[10+k],16)-51);
}
}
uart_645datalink.uart_recvflag = 1;
}
else{
uart_645datalink.uart_recvflag = 0;
}
}
else{
uart_645datalink.uart_recvflag = 0;
}
}
else{
uart_645datalink.uart_recvflag = 0;
}
getApp().globalData.uart_645datalink = uart_645datalink
}

@ -0,0 +1,97 @@
import {send_uart} from '@/common/blue_request.js';
//控制命令回复处理
export function receivecommand(result,data) {
if((result.id == data.id) && ((parseInt(result.cc,16)&(1<<6)) == 0))
{
return true
}
else{
return false
}
}
//设置无线模块频段命令发送
export function setwirelessspectrum(data) {
return send_uart(data.id,'04','5a52',3,data.msg)
}
//读取灯杆状态命令发送
export function sendReadlampstatus(data) {
return send_uart(data.id,'01','cf01',0,'')
}
//灯杆调光命令发送
export function sendLampdimmer(data) {
return send_uart(data.id,'04','c125',data.len,data.msg)
}
//灯杆调光恢复自动命令发送
export function sendResumeLampdimmer(data) {
return send_uart(data.id,'04','c103',data.len,data.msg)
}
//设备时间表设置命令发送
export function setDeviceTimetable(data) {
return send_uart(data.id,'04','c011',30,data.msg)
}
//设备时间表读取命令发送
export function readDeviceTimetable(data) {
return send_uart(data.id,'01','c011',0,'')
}
//设备场景设置命令发送
export function setDeviceScenetable(data) {
return send_uart(data.id,'04','c012',24,data.msg)
}
//设备场景读取命令发送
export function readDeviceScenetable(data) {
return send_uart(data.id,'01','c012',0,'')
}
//读取设备版本号命令发送
export function readDeviceVersion(data) {
return send_uart(data.id,'01','c00e',0,'')
}
//广播校时命令发送
export function sendBroadcasttiming(data) {
return send_uart('999999999999','08','',6,data.msg)
}
//组调光命令发送
export function sendLampzonedimmer(data) {
return send_uart(data.id,'04','c125',data.len,data.msg)
}
//全网调光命令发送
export function sendLampAlldimmer(data) {
return send_uart('999999999999','04','c125',data.len,data.msg)
}
//组时间表设置命令发送
export function setGroupTimetable(data) {
return send_uart(data.id,'04','c011',30,data.msg)
}
//全网调光命令发送
export function setAllTimetable(data) {
return send_uart('999999999999','04','c011',30,data.msg)
}
//设备升级命令发送
export function sendDeviceUpgrade(data){
return send_uart(data.id,'0f',data.number,data.len,data.msg)
}
//设备启动升级命令发送
export function sendStartUpgtade(data){
return send_uart(data.id,'04','b200',8,data.msg)
}
//读取设备版本命令发送
export function sendReadDevicestatus(data) {
return send_uart(data.id,'01','c00e',0,'')
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

@ -0,0 +1,703 @@
<template>
<view class="file-outerBox" @touchmove.prevent v-if="isOpen">
<view style="width: 100%; padding-top: --status-bar-height;"></view>
<view class="file-titel" :style="{backgroundColor: navBgColor}">
<view class="file-nav-leftBox" @click="backAddress">
<image src="./img/back.png" mode="widthFix" class="file-back-img"></image>
</view>
<text :style="titelStyle">
{{titel}}
</text>
<view class="file-nav-rightBox"></view>
</view>
<view class="file-address">
<view class="root-box" @click="backRoot">
内部存储
<image src="./img/rightjt.png" mode="widthFix" class="to-img-box"></image>
</view>
<scroll-view :scroll-x="true" class="address-scroll">
<view class="address-box" v-for="(item,index) in addressBar" @click="backFolder(item,index)">
{{item.name}}
<image src="./img/rightjt.png" mode="widthFix" class="to-img-box"></image>
</view>
</scroll-view>
</view>
<view class="">
<scroll-view :scroll-y="true" :style="{height: 'calc(100vh - ' + (barHeight*2 + 280) + 'rpx)'}">
<view class="select-tips" v-if="inaccessible">
<view style="line-height: 40rpx;">
无法访问的文件夹
</view>
<view style="line-height: 40rpx;">
建议前往安卓存储访问框架查看文件
</view>
</view>
<view class="folder-box" v-for="item in folderArr" @click="toFolder(item)">
<view class="folder-name-box">
<image src="./img/files.png" mode="widthFix" class="folder-img"></image>
<view class="name-box">{{item.name}}</view>
</view>
<view>
<image src="./img/comefile.png" mode="widthFix" class="toFolder-img"></image>
</view>
</view>
<view class="file-box" v-for="(item,index) in fileArr" @click="selectFile(index)">
<view class="file-name-box">
<image src="./img/file.png" mode="widthFix" class="file-img"></image>
<!-- <image :src="txtImg" mode="widthFix" class="file-img" v-if="item.type == 'txt'"></image>
<image :src="docImg" mode="widthFix" class="file-img" v-if="item.type == 'doc'"></image>
<image :src="pdfImg" mode="widthFix" class="file-img" v-if="item.type == 'pdf'"></image> -->
<view class="name-box">
{{item.name}}
</view>
</view>
<view>
<image src="./img/check.png" mode="widthFix" class="select-img" v-if="item.select"></image>
<image src="./img/checkout.png" mode="widthFix" class="select-img" v-else></image>
</view>
</view>
</scroll-view>
<u-toast ref="uToast"></u-toast>
</view>
<view class="">
<button type="default" class="select-foot-btn" :style="btnStyle" @click="uploadBtn">选择</button>
</view>
</view>
</template>
<script>
/*
*
* {property} 使用 v-model 绑定一个变量来控制组件的开启与关闭
* {property} navBgColor [String] 顶部标题栏背景色
* {property} folderImg [String] 文件夹的图片
* {property} backImg [String] 返回上一级图片
* {property} directionImg [String] 右指向箭头
* {property} enterImg [String] 进入文件夹箭头
* {property} fileImg [String] 未知文件通用图标当前仅可识别 pdfdoc/docxtxt
* {property} txtImg [String] txt文件图标
* {property} docImg [String] doc/docx文件图标
* {property} pdfImg [String] pdf文件图标
* {property} selectedImg [String] 选中状态下的按钮图标
* {property} unselectedImg [String] 未选中状态下的按钮图标
* {property} titel [String] 标题文字默认 '选择文件'
* {property} titelSize [String,Number] 标题文字大小默认 36rpx
* {property} titelWeight [String,Number] 标题文字粗细默认 600
* {property} titelColor [String] 标题文字颜色默认 #373737
* {property} btnText [String] 底部按钮文字 默认 '上传'
* {property} btnSize [String,Number] 底部按钮文字大小 默认 36rpx
* {property} btnHeight [String,Number] 底部按钮高度 默认 92rpx
* {property} btnBgColor [String] 底部按钮颜色 默认 #6521e2
* {property} btnTextColor [String] 底部按钮文字颜色 默认 #fff
* {property} filterArr [Array] 筛选文件类型示例['doc','PDF']不区分大小写
*
* {event} confirm [Function] 点击上传按钮触发的回调事件会返回选中文件的地址 event = [{name: name, url: path, sizeMB: sizeMb}]
* name: 文件名 url: 文件地址 sizeMB: 文件大小单位MB
*/
import { read } from 'fs';
export default {
name: "nk-select-file",
props: {
value: {
type: Boolean,
default: false
},
docImg: {
type: String,
default: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-5c697db4-d920-4af3-90a0-19211379b881/501660e5-8386-473f-bfcb-34c0b2b4a2f8.png'
},
pdfImg: {
type: String,
default: 'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-5c697db4-d920-4af3-90a0-19211379b881/b1056050-6d27-454e-b2b7-51e3832cfe5e.png'
},
selectedImg: {
type: String,
default: './img/check.png'
},
unselectedImg: {
type: String,
default: './img/checkout.png'
},
titel: {
type: String,
default: '选择文件'
},
titelSize: {
type: [String, Number],
default: 36
},
titelWeight: {
type: [String, Number],
default: 600
},
titelColor: {
type: String,
default: '#373737'
},
btnText: {
type: String,
default: '上传'
},
btnSize: {
type: [String, Number],
default: 36
},
btnHeight: {
type: [String, Number],
default: 92
},
btnBgColor: {
type: String,
default: '#6521e2'
},
btnTextColor: {
type: String,
default: '#fff'
},
navBgColor: {
type: String,
default: '#fff'
},
filterArr: {
type: Array,
default () {
return []
}
}
},
data() {
return {
barHeight: '', //
rootAddress: {}, //
addressBar: [], //
folderArr: [], //
fileArr: [], //
selectArr: [], //
isExit: true, // 退
isOpen: false,
inaccessible: false, // 访
titelStyle: {
fontSize: this.titelSize + 'rpx',
fontWeight: this.titelWeight,
color: this.titelColor
},
btnStyle: {
height: this.btnHeight + 'rpx',
backgroundColor: this.btnBgColor,
color: this.btnTextColor,
fontSize: this.btnSize + 'rpx'
},
filterReg: '',
};
},
watch: {
value(val) {
if (val) {
this.open();
} else {
this.close();
}
}
},
mounted() {
if (this.filterArr.length > 0) {
let str = this.filterArr.join("|");
this.filterReg = new RegExp(str, 'i');
}
},
methods: {
//
open() {
this.isOpen = true;
this.getBarHeight();
this.getRootDirectory();
},
//
close() {
this.isOpen = false;
this.rootAddress = {}; //
this.addressBar = []; //
this.folderArr = [];
this.fileArr = [];
this.selectArr = []; //
this.$emit('input', false);
// value
this.$nextTick(() => {
this.$emit('change', false);
})
},
//
getBarHeight() {
var self = this;
uni.getSystemInfo({
success(res) {
self.barHeight = res.statusBarHeight;
}
})
},
//
getRootDirectory() {
this.inaccessible = false;
// 退便退
this.isExit = false;
this.addressBar = [];
var environment = plus.android.importClass("android.os.Environment");
environment.getExternalStorageState() === environment.MEDIA_MOUNTED;
var sdRoot = environment.getExternalStorageDirectory();
var rootName = plus.android.invoke(sdRoot, "getName");
this.rootAddress = {
name: rootName,
file: sdRoot,
};
var files = plus.android.invoke(sdRoot, "listFiles");
var len = files.length;
for (let i = 0; i < len; i++) {
//
if (!plus.android.invoke(files[i], "isHidden")) {
//
if (plus.android.invoke(files[i], "isDirectory")) {
var folderName = plus.android.invoke(files[i], "getName")
this.folderArr.push({
name: folderName,
file: files[i]
})
} else {
var fileName = plus.android.invoke(files[i], "getName")
if (this.filterArr.length > 0) {
if (fileName.search(this.filterReg) < 0) {
continue;
}
}
if (fileName.search(/bin/i) > -1) {
//
this.fileArr.push({
name: fileName,
file: files[i],
type: 'bin',
select: false
})
}
// else if (fileName.search(/doc|docx/i) > -1) {
// // doc/docx
// this.fileArr.push({
// name: fileName,
// file: files[i],
// type: 'doc',
// select: false
// })
// } else if (fileName.search(/pdf/i) > -1) {
// // pdf
// this.fileArr.push({
// name: fileName,
// file: files[i],
// type: 'pdf',
// select: false
// })
// } else {
// //
// this.fileArr.push({
// name: fileName,
// file: files[i],
// type: 'file',
// select: false
// })
// }
}
}
}
//
this.folderArr.sort(function(a, b) {
return a.name.toUpperCase() > b.name.toUpperCase() ? '1' : '-1'
});
this.fileArr.sort(function(a, b) {
return a.name.toUpperCase() > b.name.toUpperCase() ? '1' : '-1'
});
this.rootAddress.folderArr = this.folderArr;
this.rootAddress.fileArr = this.fileArr;
},
//
toFolder(event) {
this.isExit = false; // 退
this.folderArr = [];
this.fileArr = [];
this.addressBar.push(event)
var files = plus.android.invoke(event.file, "listFiles");
if (files == null) {
this.inaccessible = true;
}
var len = files.length;
for (let i = 0; i < len; i++) {
//
if (!plus.android.invoke(files[i], "isHidden")) {
//
if (plus.android.invoke(files[i], "isDirectory")) {
var folderName = plus.android.invoke(files[i], "getName")
this.folderArr.push({
name: folderName,
file: files[i]
})
} else {
var fileName = plus.android.invoke(files[i], "getName")
if (this.filterArr.length > 0) {
if (fileName.search(this.filterReg) < 0) {
continue;
}
}
if (fileName.search(/txt/i) > -1) {
// txt
this.fileArr.push({
name: fileName,
file: files[i],
type: 'txt',
select: false
})
} else if (fileName.search(/doc|docx/i) > -1) {
// doc/docx
this.fileArr.push({
name: fileName,
file: files[i],
type: 'doc',
select: false
})
} else if (fileName.search(/pdf/i) > -1) {
// pdf
this.fileArr.push({
name: fileName,
file: files[i],
type: 'pdf',
select: false
})
} else {
//
this.fileArr.push({
name: fileName,
file: files[i],
type: 'file',
select: false
})
}
}
}
}
//
this.folderArr.sort(function(a, b) {
return a.name.toUpperCase() > b.name.toUpperCase() ? '1' : '-1'
});
this.fileArr.sort(function(a, b) {
return a.name.toUpperCase() > b.name.toUpperCase() ? '1' : '-1'
});
},
//
backRoot() {
this.inaccessible = false;
this.addressBar = [];
this.folderArr = this.rootAddress.folderArr;
this.fileArr = this.rootAddress.fileArr;
},
//
backFolder(event, index) {
this.inaccessible = false;
var len = this.addressBar.length;
if (index + 1 == len) {
// --
return;
} else {
this.folderArr = [];
this.fileArr = [];
this.addressBar.splice(index + 1, len - index + 1)
var files = plus.android.invoke(event.file, "listFiles");
var len = files.length;
for (let i = 0; i < len; i++) {
//
if (!plus.android.invoke(files[i], "isHidden")) {
//
if (plus.android.invoke(files[i], "isDirectory")) {
var folderName = plus.android.invoke(files[i], "getName")
this.folderArr.push({
name: folderName,
file: files[i]
})
} else {
var fileName = plus.android.invoke(files[i], "getName");
if (this.filterArr.length > 0) {
if (fileName.search(this.filterReg) < 0) {
continue;
}
}
if (fileName.search(/txt/i) > -1) {
// txt
this.fileArr.push({
name: fileName,
file: files[i],
type: 'txt',
select: false
})
} else if (fileName.search(/doc|docx/i) > -1) {
// doc/docx
this.fileArr.push({
name: fileName,
file: files[i],
type: 'doc',
select: false
})
} else if (fileName.search(/pdf/i) > -1) {
// pdf
this.fileArr.push({
name: fileName,
file: files[i],
type: 'pdf',
select: false
})
} else {
//
this.fileArr.push({
name: fileName,
file: files[i],
type: 'file',
select: false
})
}
}
}
}
//
this.folderArr.sort(function(a, b) {
return a.name.toUpperCase() > b.name.toUpperCase() ? '1' : '-1'
});
this.fileArr.sort(function(a, b) {
return a.name.toUpperCase() > b.name.toUpperCase() ? '1' : '-1'
});
}
},
//
selectFile(index) {
if (this.fileArr[index].select) {
//
this.$set(this.fileArr[index], 'select', false);
let name = this.fileArr[index].name;
for (let i = 0; i < this.selectArr.length; i++) {
if (name == this.selectArr[i].name) {
this.selectArr.splice(i, 1);
break;
}
}
} else {
//
this.$set(this.fileArr[index], 'select', true);
//
var FileInputStream = plus.android.importClass("java.io.FileInputStream");
var fileSize = new FileInputStream(this.fileArr[index].file);
//
var Path = plus.android.invoke(this.fileArr[index].file, "getPath");
var size = fileSize.available();
var sizeMb = size / 1048576;
sizeMb = sizeMb.toFixed(4);
this.selectArr.push({
name: this.fileArr[index].name,
url: Path,
sizeMB: sizeMb,
})
}
},
//
uploadBtn() {
if(this.selectArr.length==1){
this.$emit("confirm", this.selectArr);
this.close();
}else{
this.$refs.uToast.show({
message: "只能选择单个文件!",
type: "error",
});
}
},
//
backAddress() {
//
var len = this.addressBar.length;
if (len > 1) {
//
let index = len - 2;
let event = this.addressBar[index];
this.backFolder(event, index);
} else {
// 退
if (this.isExit) {
// 退
this.close();
// this.$u.toast('退')
} else {
//
this.isExit = true; // 退
this.backRoot();
uni.showToast({
title: '再操作一次退出文件选择',
icon: 'none',
duration: 1000
});
}
}
}
}
}
</script>
<style scoped>
.file-outerBox {
width: 100%;
height: 100vh;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1070;
padding-bottom: 40rpx;
background-color: #fff;
}
.file-titel {
width: 100%;
height: 80rpx;
line-height: 80rpx;
text-align: center;
// background-color: #FFFFFF;
padding: 0 32rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.file-nav-leftBox {
width: 60rpx;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
}
.file-back-img {
width: 36rpx;
}
.file-nav-rightBox {
width: 60rpx;
height: 100%;
}
.file-address {
width: 100%;
height: 60rpx;
background-color: #FBFBFB;
padding: 0 32rpx;
display: flex;
color: #373737;
font-size: 24rpx;
}
.address-scroll {
width: calc(100% - 116rpx);
white-space: nowrap;
height: 100%;
}
.address-box {
height: 60rpx;
line-height: 60rpx;
display: inline-block;
}
.to-img-box {
width: 20rpx;
}
.root-box {
width: 116rpx;
height: 60rpx;
line-height: 60rpx;
display: inline-block;
box-shadow: 10rpx 0 10rpx -10rpx rgba(8, 8, 8, 0.3);
}
.to-img-box {
width: 20rpx;
}
.folder-box {
height: 120rpx;
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 32rpx;
border-bottom: 1px solid #EEEEEE;
}
.folder-name-box {
width: 80%;
display: flex;
align-items: center;
flex-wrap: wrap;
}
.folder-img {
width: 72rpx;
margin-right: 16rpx;
}
.name-box {
width: calc(100% - 100rpx);
overflow: hidden;
word-wrap: break-word;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.toFolder-img {
width: 28rpx;
}
.select-tips {
width: 100%;
height: 160rpx;
text-align: center;
font-size: 32rpx;
color: #888;
padding-top: 60rpx;
}
.file-box {
height: 120rpx;
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 32rpx;
border-bottom: 1px solid #EEEEEE;
}
.file-name-box {
width: 80%;
display: flex;
align-items: center;
// .type-file{
// width: 60rpx;
// margin-left: 10rpx;
// }
}
.file-img {
width: 72rpx;
margin-right: 16rpx;
}
.name-box {
width: calc(100% - 100rpx);
overflow: hidden;
word-wrap: break-word;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.select-img {
width: 32rpx;
}
.select-foot-btn {
width: calc(100% - 64rpx);
margin-top: 20rpx;
}
</style>

@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
</body>
</html>

@ -0,0 +1,20 @@
import App from './App'
import Vue from 'vue'
import uView from "uview-ui";
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
Vue.use(uView);
Vue.prototype.$deviceId = 0;
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp(){
const app = createSSRApp(App)
return {
app
}
}
// #endif

@ -0,0 +1,87 @@
{
"name" : "易加蓝牙助手",
"appid" : "__UNI__5E03357",
"description" : "",
"versionName" : "1.0.1",
"versionCode" : "100",
"transformPx" : false,
/* 5+App */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* */
"modules" : {
"Bluetooth" : {}
},
/* */
"distribute" : {
/* android */
"android" : {
"permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios */
"ios" : {
"dSYMs" : false
},
/* SDK */
"sdkConfigs" : {
"ad" : {}
}
}
},
/* */
"quickapp" : {},
/* */
"mp-weixin" : {
"appid" : "wx1f29c7267f21e2b6",
"setting" : {
"urlCheck" : false,
"es6" : true,
"minified" : true,
"postcss" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true,
"appid" : "2021002131657266"
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "2",
"mp-jd" : {
"appid" : "7486D34CA8B8A081F2A426DFC43C84B9"
}
}

15
node_modules/.bin/color-support generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../color-support/bin.js" "$@"
ret=$?
else
node "$basedir/../color-support/bin.js" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\color-support\bin.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../color-support/bin.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../color-support/bin.js" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/in-install generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../in-publish/in-install.js" "$@"
ret=$?
else
node "$basedir/../in-publish/in-install.js" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/in-install.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\in-publish\in-install.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/in-install.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../in-publish/in-install.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../in-publish/in-install.js" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/in-publish generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../in-publish/in-publish.js" "$@"
ret=$?
else
node "$basedir/../in-publish/in-publish.js" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/in-publish.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\in-publish\in-publish.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/in-publish.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../in-publish/in-publish.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../in-publish/in-publish.js" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/json5 generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../json5/lib/cli.js" "$@"
ret=$?
else
node "$basedir/../json5/lib/cli.js" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/json5.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\json5\lib\cli.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/json5.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../json5/lib/cli.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../json5/lib/cli.js" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/mkdirp generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../mkdirp/bin/cmd.js" "$@"
ret=$?
else
node "$basedir/../mkdirp/bin/cmd.js" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/mkdirp.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\mkdirp\bin\cmd.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/mkdirp.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../mkdirp/bin/cmd.js" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/node-gyp generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../node-gyp/bin/node-gyp.js" "$@"
ret=$?
else
node "$basedir/../node-gyp/bin/node-gyp.js" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/node-gyp.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\node-gyp\bin\node-gyp.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/node-gyp.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../node-gyp/bin/node-gyp.js" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/node-sass generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../node-sass/bin/node-sass" "$@"
ret=$?
else
node "$basedir/../node-sass/bin/node-sass" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/node-sass.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\node-sass\bin\node-sass" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/node-sass.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../node-sass/bin/node-sass" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../node-sass/bin/node-sass" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/node-which generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../which/bin/node-which" "$@"
ret=$?
else
node "$basedir/../which/bin/node-which" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/node-which.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\which\bin\node-which" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/node-which.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../which/bin/node-which" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../which/bin/node-which" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/nopt generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../nopt/bin/nopt.js" "$@"
ret=$?
else
node "$basedir/../nopt/bin/nopt.js" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/nopt.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\nopt\bin\nopt.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/nopt.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../nopt/bin/nopt.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../nopt/bin/nopt.js" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/not-in-install generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../in-publish/not-in-install.js" "$@"
ret=$?
else
node "$basedir/../in-publish/not-in-install.js" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\in-publish\not-in-install.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../in-publish/not-in-install.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../in-publish/not-in-install.js" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/not-in-publish generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../in-publish/not-in-publish.js" "$@"
ret=$?
else
node "$basedir/../in-publish/not-in-publish.js" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\in-publish\not-in-publish.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../in-publish/not-in-publish.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../in-publish/not-in-publish.js" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/resolve generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../resolve/bin/resolve" "$@"
ret=$?
else
node "$basedir/../resolve/bin/resolve" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/resolve.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\resolve\bin\resolve" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/resolve.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../resolve/bin/resolve" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../resolve/bin/resolve" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/rimraf generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../rimraf/bin.js" "$@"
ret=$?
else
node "$basedir/../rimraf/bin.js" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/rimraf.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\rimraf\bin.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/rimraf.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../rimraf/bin.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../rimraf/bin.js" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/sassgraph generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../sass-graph/bin/sassgraph" "$@"
ret=$?
else
node "$basedir/../sass-graph/bin/sassgraph" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/sassgraph.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\sass-graph\bin\sassgraph" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/sassgraph.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../sass-graph/bin/sassgraph" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../sass-graph/bin/sassgraph" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/semver generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../semver/bin/semver" "$@"
ret=$?
else
node "$basedir/../semver/bin/semver" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/semver.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\semver\bin\semver" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/semver.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../semver/bin/semver" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../semver/bin/semver" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/sshpk-conv generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../sshpk/bin/sshpk-conv" "$@"
ret=$?
else
node "$basedir/../sshpk/bin/sshpk-conv" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/sshpk-conv.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\sshpk\bin\sshpk-conv" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/sshpk-conv.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-conv" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../sshpk/bin/sshpk-conv" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/sshpk-sign generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../sshpk/bin/sshpk-sign" "$@"
ret=$?
else
node "$basedir/../sshpk/bin/sshpk-sign" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/sshpk-sign.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\sshpk\bin\sshpk-sign" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/sshpk-sign.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-sign" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../sshpk/bin/sshpk-sign" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/sshpk-verify generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../sshpk/bin/sshpk-verify" "$@"
ret=$?
else
node "$basedir/../sshpk/bin/sshpk-verify" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\sshpk\bin\sshpk-verify" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../sshpk/bin/sshpk-verify" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../sshpk/bin/sshpk-verify" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/strip-indent generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../strip-indent/cli.js" "$@"
ret=$?
else
node "$basedir/../strip-indent/cli.js" "$@"
ret=$?
fi
exit $ret

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\strip-indent\cli.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../strip-indent/cli.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../strip-indent/cli.js" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/uuid generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../uuid/bin/uuid" "$@"
ret=$?
else
node "$basedir/../uuid/bin/uuid" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/uuid.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\uuid\bin\uuid" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/uuid.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../uuid/bin/uuid" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../uuid/bin/uuid" $args
$ret=$LASTEXITCODE
}
exit $ret

15
node_modules/.bin/which generated vendored

@ -0,0 +1,15 @@
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../which/bin/which" "$@"
ret=$?
else
node "$basedir/../which/bin/which" "$@"
ret=$?
fi
exit $ret

17
node_modules/.bin/which.cmd generated vendored

@ -0,0 +1,17 @@
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\which\bin\which" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b

18
node_modules/.bin/which.ps1 generated vendored

@ -0,0 +1,18 @@
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../which/bin/which" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../which/bin/which" $args
$ret=$LASTEXITCODE
}
exit $ret

@ -0,0 +1,21 @@
MIT License
Copyright (c) Microsoft Corporation.
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

@ -0,0 +1,15 @@
# Installation
> `npm install --save @types/json-schema`
# Summary
This package contains type definitions for json-schema (https://github.com/kriszyp/json-schema).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-schema.
### Additional Details
* Last updated: Tue, 07 Nov 2023 03:09:37 GMT
* Dependencies: none
# Credits
These definitions were written by [Boris Cherny](https://github.com/bcherny), [Lucian Buzzo](https://github.com/lucianbuzzo), [Roland Groza](https://github.com/rolandjitsu), and [Jason Kwok](https://github.com/JasonHK).

@ -0,0 +1,749 @@
// ==================================================================================================
// JSON Schema Draft 04
// ==================================================================================================
/**
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
*/
export type JSONSchema4TypeName =
| "string" //
| "number"
| "integer"
| "boolean"
| "object"
| "array"
| "null"
| "any";
/**
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
*/
export type JSONSchema4Type =
| string //
| number
| boolean
| JSONSchema4Object
| JSONSchema4Array
| null;
// Workaround for infinite type recursion
export interface JSONSchema4Object {
[key: string]: JSONSchema4Type;
}
// Workaround for infinite type recursion
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
export interface JSONSchema4Array extends Array<JSONSchema4Type> {}
/**
* Meta schema
*
* Recommended values:
* - 'http://json-schema.org/schema#'
* - 'http://json-schema.org/hyper-schema#'
* - 'http://json-schema.org/draft-04/schema#'
* - 'http://json-schema.org/draft-04/hyper-schema#'
* - 'http://json-schema.org/draft-03/schema#'
* - 'http://json-schema.org/draft-03/hyper-schema#'
*
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
*/
export type JSONSchema4Version = string;
/**
* JSON Schema V4
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04
*/
export interface JSONSchema4 {
id?: string | undefined;
$ref?: string | undefined;
$schema?: JSONSchema4Version | undefined;
/**
* This attribute is a string that provides a short description of the
* instance property.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
*/
title?: string | undefined;
/**
* This attribute is a string that provides a full description of the of
* purpose the instance property.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
*/
description?: string | undefined;
default?: JSONSchema4Type | undefined;
multipleOf?: number | undefined;
maximum?: number | undefined;
exclusiveMaximum?: boolean | undefined;
minimum?: number | undefined;
exclusiveMinimum?: boolean | undefined;
maxLength?: number | undefined;
minLength?: number | undefined;
pattern?: string | undefined;
/**
* May only be defined when "items" is defined, and is a tuple of JSONSchemas.
*
* This provides a definition for additional items in an array instance
* when tuple definitions of the items is provided. This can be false
* to indicate additional items in the array are not allowed, or it can
* be a schema that defines the schema of the additional items.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
*/
additionalItems?: boolean | JSONSchema4 | undefined;
/**
* This attribute defines the allowed items in an instance array, and
* MUST be a schema or an array of schemas. The default value is an
* empty schema which allows any value for items in the instance array.
*
* When this attribute value is a schema and the instance value is an
* array, then all the items in the array MUST be valid according to the
* schema.
*
* When this attribute value is an array of schemas and the instance
* value is an array, each position in the instance array MUST conform
* to the schema in the corresponding position for this array. This
* called tuple typing. When tuple typing is used, additional items are
* allowed, disallowed, or constrained by the "additionalItems"
* (Section 5.6) attribute using the same rules as
* "additionalProperties" (Section 5.4) for objects.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
*/
items?: JSONSchema4 | JSONSchema4[] | undefined;
maxItems?: number | undefined;
minItems?: number | undefined;
uniqueItems?: boolean | undefined;
maxProperties?: number | undefined;
minProperties?: number | undefined;
/**
* This attribute indicates if the instance must have a value, and not
* be undefined. This is false by default, making the instance
* optional.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
*/
required?: boolean | string[] | undefined;
/**
* This attribute defines a schema for all properties that are not
* explicitly defined in an object type definition. If specified, the
* value MUST be a schema or a boolean. If false is provided, no
* additional properties are allowed beyond the properties defined in
* the schema. The default value is an empty schema which allows any
* value for additional properties.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
*/
additionalProperties?: boolean | JSONSchema4 | undefined;
definitions?: {
[k: string]: JSONSchema4;
} | undefined;
/**
* This attribute is an object with property definitions that define the
* valid values of instance object property values. When the instance
* value is an object, the property values of the instance object MUST
* conform to the property definitions in this object. In this object,
* each property definition's value MUST be a schema, and the property's
* name MUST be the name of the instance property that it defines. The
* instance property value MUST be valid according to the schema from
* the property definition. Properties are considered unordered, the
* order of the instance properties MAY be in any order.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
*/
properties?: {
[k: string]: JSONSchema4;
} | undefined;
/**
* This attribute is an object that defines the schema for a set of
* property names of an object instance. The name of each property of
* this attribute's object is a regular expression pattern in the ECMA
* 262/Perl 5 format, while the value is a schema. If the pattern
* matches the name of a property on the instance object, the value of
* the instance's property MUST be valid against the pattern name's
* schema value.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
*/
patternProperties?: {
[k: string]: JSONSchema4;
} | undefined;
dependencies?: {
[k: string]: JSONSchema4 | string[];
} | undefined;
/**
* This provides an enumeration of all possible values that are valid
* for the instance property. This MUST be an array, and each item in
* the array represents a possible value for the instance value. If
* this attribute is defined, the instance value MUST be one of the
* values in the array in order for the schema to be valid.
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
*/
enum?: JSONSchema4Type[] | undefined;
/**
* A single type, or a union of simple types
*/
type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
allOf?: JSONSchema4[] | undefined;
anyOf?: JSONSchema4[] | undefined;
oneOf?: JSONSchema4[] | undefined;
not?: JSONSchema4 | undefined;
/**
* The value of this property MUST be another schema which will provide
* a base schema which the current schema will inherit from. The
* inheritance rules are such that any instance that is valid according
* to the current schema MUST be valid according to the referenced
* schema. This MAY also be an array, in which case, the instance MUST
* be valid for all the schemas in the array. A schema that extends
* another schema MAY define additional attributes, constrain existing
* attributes, or add other constraints.
*
* Conceptually, the behavior of extends can be seen as validating an
* instance against all constraints in the extending schema as well as
* the extended schema(s).
*
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
*/
extends?: string | string[] | undefined;
/**
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6
*/
[k: string]: any;
format?: string | undefined;
}
// ==================================================================================================
// JSON Schema Draft 06
// ==================================================================================================
export type JSONSchema6TypeName =
| "string" //
| "number"
| "integer"
| "boolean"
| "object"
| "array"
| "null"
| "any";
export type JSONSchema6Type =
| string //
| number
| boolean
| JSONSchema6Object
| JSONSchema6Array
| null;
// Workaround for infinite type recursion
export interface JSONSchema6Object {
[key: string]: JSONSchema6Type;
}
// Workaround for infinite type recursion
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
export interface JSONSchema6Array extends Array<JSONSchema6Type> {}
/**
* Meta schema
*
* Recommended values:
* - 'http://json-schema.org/schema#'
* - 'http://json-schema.org/hyper-schema#'
* - 'http://json-schema.org/draft-06/schema#'
* - 'http://json-schema.org/draft-06/hyper-schema#'
*
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
*/
export type JSONSchema6Version = string;
/**
* JSON Schema V6
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01
*/
export type JSONSchema6Definition = JSONSchema6 | boolean;
export interface JSONSchema6 {
$id?: string | undefined;
$ref?: string | undefined;
$schema?: JSONSchema6Version | undefined;
/**
* Must be strictly greater than 0.
* A numeric instance is valid only if division by this keyword's value results in an integer.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.1
*/
multipleOf?: number | undefined;
/**
* Representing an inclusive upper limit for a numeric instance.
* This keyword validates only if the instance is less than or exactly equal to "maximum".
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.2
*/
maximum?: number | undefined;
/**
* Representing an exclusive upper limit for a numeric instance.
* This keyword validates only if the instance is strictly less than (not equal to) to "exclusiveMaximum".
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.3
*/
exclusiveMaximum?: number | undefined;
/**
* Representing an inclusive lower limit for a numeric instance.
* This keyword validates only if the instance is greater than or exactly equal to "minimum".
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.4
*/
minimum?: number | undefined;
/**
* Representing an exclusive lower limit for a numeric instance.
* This keyword validates only if the instance is strictly greater than (not equal to) to "exclusiveMinimum".
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.5
*/
exclusiveMinimum?: number | undefined;
/**
* Must be a non-negative integer.
* A string instance is valid against this keyword if its length is less than, or equal to, the value of this keyword.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.6
*/
maxLength?: number | undefined;
/**
* Must be a non-negative integer.
* A string instance is valid against this keyword if its length is greater than, or equal to, the value of this keyword.
* Omitting this keyword has the same behavior as a value of 0.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.7
*/
minLength?: number | undefined;
/**
* Should be a valid regular expression, according to the ECMA 262 regular expression dialect.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.8
*/
pattern?: string | undefined;
/**
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
* Omitting this keyword has the same behavior as an empty schema.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.9
*/
items?: JSONSchema6Definition | JSONSchema6Definition[] | undefined;
/**
* This keyword determines how child instances validate for arrays, and does not directly validate the immediate instance itself.
* If "items" is an array of schemas, validation succeeds if every instance element
* at a position greater than the size of "items" validates against "additionalItems".
* Otherwise, "additionalItems" MUST be ignored, as the "items" schema
* (possibly the default value of an empty schema) is applied to all elements.
* Omitting this keyword has the same behavior as an empty schema.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.10
*/
additionalItems?: JSONSchema6Definition | undefined;
/**
* Must be a non-negative integer.
* An array instance is valid against "maxItems" if its size is less than, or equal to, the value of this keyword.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.11
*/
maxItems?: number | undefined;
/**
* Must be a non-negative integer.
* An array instance is valid against "maxItems" if its size is greater than, or equal to, the value of this keyword.
* Omitting this keyword has the same behavior as a value of 0.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.12
*/
minItems?: number | undefined;
/**
* If this keyword has boolean value false, the instance validates successfully.
* If it has boolean value true, the instance validates successfully if all of its elements are unique.
* Omitting this keyword has the same behavior as a value of false.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.13
*/
uniqueItems?: boolean | undefined;
/**
* An array instance is valid against "contains" if at least one of its elements is valid against the given schema.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.14
*/
contains?: JSONSchema6Definition | undefined;
/**
* Must be a non-negative integer.
* An object instance is valid against "maxProperties" if its number of properties is less than, or equal to, the value of this keyword.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.15
*/
maxProperties?: number | undefined;
/**
* Must be a non-negative integer.
* An object instance is valid against "maxProperties" if its number of properties is greater than,
* or equal to, the value of this keyword.
* Omitting this keyword has the same behavior as a value of 0.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.16
*/
minProperties?: number | undefined;
/**
* Elements of this array must be unique.
* An object instance is valid against this keyword if every item in the array is the name of a property in the instance.
* Omitting this keyword has the same behavior as an empty array.
*
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.17
*/
required?: string[] | undefined;
/**
* This keyword determines how child instances validate for objects, and does not directly validate the immediate instance itself.
* Validation succeeds if, for each name that appears in both the instance and as a name within this keyword's value,
* the child instance for that name successfully validates against the corresponding schema.
* Omitting this keyword has the same behavior as an empty object.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.18
*/
properties?: {
[k: string]: JSONSchema6Definition;
} | undefined;
/**
* This attribute is an object that defines the schema for a set of property names of an object instance.
* The name of each property of this attribute's object is a regular expression pattern in the ECMA 262, while the value is a schema.
* If the pattern matches the name of a property on the instance object, the value of the instance's property
* MUST be valid against the pattern name's schema value.
* Omitting this keyword has the same behavior as an empty object.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.19
*/
patternProperties?: {
[k: string]: JSONSchema6Definition;
} | undefined;
/**
* This attribute defines a schema for all properties that are not explicitly defined in an object type definition.
* If specified, the value MUST be a schema or a boolean.
* If false is provided, no additional properties are allowed beyond the properties defined in the schema.
* The default value is an empty schema which allows any value for additional properties.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.20
*/
additionalProperties?: JSONSchema6Definition | undefined;
/**
* This keyword specifies rules that are evaluated if the instance is an object and contains a certain property.
* Each property specifies a dependency.
* If the dependency value is an array, each element in the array must be unique.
* Omitting this keyword has the same behavior as an empty object.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.21
*/
dependencies?: {
[k: string]: JSONSchema6Definition | string[];
} | undefined;
/**
* Takes a schema which validates the names of all properties rather than their values.
* Note the property name that the schema is testing will always be a string.
* Omitting this keyword has the same behavior as an empty schema.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.22
*/
propertyNames?: JSONSchema6Definition | undefined;
/**
* This provides an enumeration of all possible values that are valid
* for the instance property. This MUST be an array, and each item in
* the array represents a possible value for the instance value. If
* this attribute is defined, the instance value MUST be one of the
* values in the array in order for the schema to be valid.
*
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.23
*/
enum?: JSONSchema6Type[] | undefined;
/**
* More readable form of a one-element "enum"
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.24
*/
const?: JSONSchema6Type | undefined;
/**
* A single type, or a union of simple types
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.25
*/
type?: JSONSchema6TypeName | JSONSchema6TypeName[] | undefined;
/**
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.26
*/
allOf?: JSONSchema6Definition[] | undefined;
/**
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.27
*/
anyOf?: JSONSchema6Definition[] | undefined;
/**
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.28
*/
oneOf?: JSONSchema6Definition[] | undefined;
/**
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-6.29
*/
not?: JSONSchema6Definition | undefined;
/**
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.1
*/
definitions?: {
[k: string]: JSONSchema6Definition;
} | undefined;
/**
* This attribute is a string that provides a short description of the instance property.
*
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2
*/
title?: string | undefined;
/**
* This attribute is a string that provides a full description of the of purpose the instance property.
*
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.2
*/
description?: string | undefined;
/**
* This keyword can be used to supply a default JSON value associated with a particular schema.
* It is RECOMMENDED that a default value be valid against the associated schema.
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.3
*/
default?: JSONSchema6Type | undefined;
/**
* Array of examples with no validation effect the value of "default" is usable as an example without repeating it under this keyword
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-7.4
*/
examples?: JSONSchema6Type[] | undefined;
/**
* @see https://tools.ietf.org/html/draft-wright-json-schema-validation-01#section-8
*/
format?: string | undefined;
}
// ==================================================================================================
// JSON Schema Draft 07
// ==================================================================================================
// https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
// --------------------------------------------------------------------------------------------------
/**
* Primitive type
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
*/
export type JSONSchema7TypeName =
| "string" //
| "number"
| "integer"
| "boolean"
| "object"
| "array"
| "null";
/**
* Primitive type
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1.1
*/
export type JSONSchema7Type =
| string //
| number
| boolean
| JSONSchema7Object
| JSONSchema7Array
| null;
// Workaround for infinite type recursion
export interface JSONSchema7Object {
[key: string]: JSONSchema7Type;
}
// Workaround for infinite type recursion
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
export interface JSONSchema7Array extends Array<JSONSchema7Type> {}
/**
* Meta schema
*
* Recommended values:
* - 'http://json-schema.org/schema#'
* - 'http://json-schema.org/hyper-schema#'
* - 'http://json-schema.org/draft-07/schema#'
* - 'http://json-schema.org/draft-07/hyper-schema#'
*
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
*/
export type JSONSchema7Version = string;
/**
* JSON Schema v7
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01
*/
export type JSONSchema7Definition = JSONSchema7 | boolean;
export interface JSONSchema7 {
$id?: string | undefined;
$ref?: string | undefined;
$schema?: JSONSchema7Version | undefined;
$comment?: string | undefined;
/**
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
*/
$defs?: {
[key: string]: JSONSchema7Definition;
} | undefined;
/**
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
*/
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
enum?: JSONSchema7Type[] | undefined;
const?: JSONSchema7Type | undefined;
/**
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
*/
multipleOf?: number | undefined;
maximum?: number | undefined;
exclusiveMaximum?: number | undefined;
minimum?: number | undefined;
exclusiveMinimum?: number | undefined;
/**
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
*/
maxLength?: number | undefined;
minLength?: number | undefined;
pattern?: string | undefined;
/**
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
*/
items?: JSONSchema7Definition | JSONSchema7Definition[] | undefined;
additionalItems?: JSONSchema7Definition | undefined;
maxItems?: number | undefined;
minItems?: number | undefined;
uniqueItems?: boolean | undefined;
contains?: JSONSchema7Definition | undefined;
/**
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
*/
maxProperties?: number | undefined;
minProperties?: number | undefined;
required?: string[] | undefined;
properties?: {
[key: string]: JSONSchema7Definition;
} | undefined;
patternProperties?: {
[key: string]: JSONSchema7Definition;
} | undefined;
additionalProperties?: JSONSchema7Definition | undefined;
dependencies?: {
[key: string]: JSONSchema7Definition | string[];
} | undefined;
propertyNames?: JSONSchema7Definition | undefined;
/**
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
*/
if?: JSONSchema7Definition | undefined;
then?: JSONSchema7Definition | undefined;
else?: JSONSchema7Definition | undefined;
/**
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
*/
allOf?: JSONSchema7Definition[] | undefined;
anyOf?: JSONSchema7Definition[] | undefined;
oneOf?: JSONSchema7Definition[] | undefined;
not?: JSONSchema7Definition | undefined;
/**
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
*/
format?: string | undefined;
/**
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
*/
contentMediaType?: string | undefined;
contentEncoding?: string | undefined;
/**
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
*/
definitions?: {
[key: string]: JSONSchema7Definition;
} | undefined;
/**
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
*/
title?: string | undefined;
description?: string | undefined;
default?: JSONSchema7Type | undefined;
readOnly?: boolean | undefined;
writeOnly?: boolean | undefined;
examples?: JSONSchema7Type | undefined;
}
export interface ValidationResult {
valid: boolean;
errors: ValidationError[];
}
export interface ValidationError {
property: string;
message: string;
}
/**
* To use the validator call JSONSchema.validate with an instance object and an optional schema object.
* If a schema is provided, it will be used to validate. If the instance object refers to a schema (self-validating),
* that schema will be used to validate and the schema parameter is not necessary (if both exist,
* both validations will occur).
*/
export function validate(instance: {}, schema: JSONSchema4 | JSONSchema6 | JSONSchema7): ValidationResult;
/**
* The checkPropertyChange method will check to see if an value can legally be in property with the given schema
* This is slightly different than the validate method in that it will fail if the schema is readonly and it will
* not check for self-validation, it is assumed that the passed in value is already internally valid.
*/
export function checkPropertyChange(
value: any,
schema: JSONSchema4 | JSONSchema6 | JSONSchema7,
property: string,
): ValidationResult;
/**
* This checks to ensure that the result is valid and will throw an appropriate error message if it is not.
*/
export function mustBeValid(result: ValidationResult): void;

@ -0,0 +1,65 @@
{
"_from": "@types/json-schema@^7.0.5",
"_id": "@types/json-schema@7.0.15",
"_inBundle": false,
"_integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
"_location": "/@types/json-schema",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@types/json-schema@^7.0.5",
"name": "@types/json-schema",
"escapedName": "@types%2fjson-schema",
"scope": "@types",
"rawSpec": "^7.0.5",
"saveSpec": null,
"fetchSpec": "^7.0.5"
},
"_requiredBy": [
"/schema-utils"
],
"_resolved": "https://registry.npmmirror.com/@types/json-schema/-/json-schema-7.0.15.tgz",
"_shasum": "596a1747233694d50f6ad8a7869fcb6f56cf5841",
"_spec": "@types/json-schema@^7.0.5",
"_where": "D:\\2345Downloads\\eciot-bletool for uni-app\\易加蓝牙助手\\node_modules\\schema-utils",
"bugs": {
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Boris Cherny",
"url": "https://github.com/bcherny"
},
{
"name": "Lucian Buzzo",
"url": "https://github.com/lucianbuzzo"
},
{
"name": "Roland Groza",
"url": "https://github.com/rolandjitsu"
},
{
"name": "Jason Kwok",
"url": "https://github.com/JasonHK"
}
],
"dependencies": {},
"deprecated": false,
"description": "TypeScript definitions for json-schema",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/json-schema",
"license": "MIT",
"main": "",
"name": "@types/json-schema",
"repository": {
"type": "git",
"url": "git+https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/json-schema"
},
"scripts": {},
"typeScriptVersion": "4.5",
"types": "index.d.ts",
"typesPublisherContentHash": "79984fd70cd25c3f7d72b84368778c763c89728ea0073832d745d4691b705257",
"version": "7.0.15"
}

46
node_modules/abbrev/LICENSE generated vendored

@ -0,0 +1,46 @@
This software is dual-licensed under the ISC and MIT licenses.
You may use this software under EITHER of the following licenses.
----------
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
----------
Copyright Isaac Z. Schlueter and Contributors
All rights reserved.
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.

23
node_modules/abbrev/README.md generated vendored

@ -0,0 +1,23 @@
# abbrev-js
Just like [ruby's Abbrev](http://apidock.com/ruby/Abbrev).
Usage:
var abbrev = require("abbrev");
abbrev("foo", "fool", "folding", "flop");
// returns:
{ fl: 'flop'
, flo: 'flop'
, flop: 'flop'
, fol: 'folding'
, fold: 'folding'
, foldi: 'folding'
, foldin: 'folding'
, folding: 'folding'
, foo: 'foo'
, fool: 'fool'
}
This is handy for command-line scripts, or other cases where you want to be able to accept shorthands.

61
node_modules/abbrev/abbrev.js generated vendored

@ -0,0 +1,61 @@
module.exports = exports = abbrev.abbrev = abbrev
abbrev.monkeyPatch = monkeyPatch
function monkeyPatch () {
Object.defineProperty(Array.prototype, 'abbrev', {
value: function () { return abbrev(this) },
enumerable: false, configurable: true, writable: true
})
Object.defineProperty(Object.prototype, 'abbrev', {
value: function () { return abbrev(Object.keys(this)) },
enumerable: false, configurable: true, writable: true
})
}
function abbrev (list) {
if (arguments.length !== 1 || !Array.isArray(list)) {
list = Array.prototype.slice.call(arguments, 0)
}
for (var i = 0, l = list.length, args = [] ; i < l ; i ++) {
args[i] = typeof list[i] === "string" ? list[i] : String(list[i])
}
// sort them lexicographically, so that they're next to their nearest kin
args = args.sort(lexSort)
// walk through each, seeing how much it has in common with the next and previous
var abbrevs = {}
, prev = ""
for (var i = 0, l = args.length ; i < l ; i ++) {
var current = args[i]
, next = args[i + 1] || ""
, nextMatches = true
, prevMatches = true
if (current === next) continue
for (var j = 0, cl = current.length ; j < cl ; j ++) {
var curChar = current.charAt(j)
nextMatches = nextMatches && curChar === next.charAt(j)
prevMatches = prevMatches && curChar === prev.charAt(j)
if (!nextMatches && !prevMatches) {
j ++
break
}
}
prev = current
if (j === cl) {
abbrevs[current] = current
continue
}
for (var a = current.substr(0, j) ; j <= cl ; j ++) {
abbrevs[a] = current
a += current.charAt(j)
}
}
return abbrevs
}
function lexSort (a, b) {
return a === b ? 0 : a > b ? 1 : -1
}

56
node_modules/abbrev/package.json generated vendored

@ -0,0 +1,56 @@
{
"_from": "abbrev@1",
"_id": "abbrev@1.1.1",
"_inBundle": false,
"_integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==",
"_location": "/abbrev",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "abbrev@1",
"name": "abbrev",
"escapedName": "abbrev",
"rawSpec": "1",
"saveSpec": null,
"fetchSpec": "1"
},
"_requiredBy": [
"/nopt"
],
"_resolved": "https://registry.npmmirror.com/abbrev/-/abbrev-1.1.1.tgz",
"_shasum": "f8f2c887ad10bf67f634f005b6987fed3179aac8",
"_spec": "abbrev@1",
"_where": "D:\\2345Downloads\\eciot-bletool for uni-app\\易加蓝牙助手\\node_modules\\nopt",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me"
},
"bugs": {
"url": "https://github.com/isaacs/abbrev-js/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Like ruby's abbrev module, but in js",
"devDependencies": {
"tap": "^10.1"
},
"files": [
"abbrev.js"
],
"homepage": "https://github.com/isaacs/abbrev-js#readme",
"license": "ISC",
"main": "abbrev.js",
"name": "abbrev",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/isaacs/abbrev-js.git"
},
"scripts": {
"postpublish": "git push origin --all; git push origin --tags",
"postversion": "npm publish",
"preversion": "npm test",
"test": "tap test.js --100"
},
"version": "1.1.1"
}

21
node_modules/ajv-keywords/LICENSE generated vendored

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 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.

836
node_modules/ajv-keywords/README.md generated vendored

@ -0,0 +1,836 @@
# ajv-keywords
Custom JSON-Schema keywords for [Ajv](https://github.com/epoberezkin/ajv) validator
[![Build Status](https://travis-ci.org/ajv-validator/ajv-keywords.svg?branch=master)](https://travis-ci.org/ajv-validator/ajv-keywords)
[![npm](https://img.shields.io/npm/v/ajv-keywords.svg)](https://www.npmjs.com/package/ajv-keywords)
[![npm downloads](https://img.shields.io/npm/dm/ajv-keywords.svg)](https://www.npmjs.com/package/ajv-keywords)
[![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv-keywords/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv-keywords?branch=master)
[![Dependabot](https://api.dependabot.com/badges/status?host=github&repo=ajv-validator/ajv-keywords)](https://app.dependabot.com/accounts/ajv-validator/repos/60477053)
[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv)
## Contents
- [Install](#install)
- [Usage](#usage)
- [Keywords](#keywords)
- [Types](#types)
- [typeof](#typeof)
- [instanceof](#instanceof)
- [Keywords for numbers](#keywords-for-numbers)
- [range and exclusiveRange](#range-and-exclusiverange)
- [Keywords for strings](#keywords-for-strings)
- [regexp](#regexp)
- [formatMaximum / formatMinimum and formatExclusiveMaximum / formatExclusiveMinimum](#formatmaximum--formatminimum-and-formatexclusivemaximum--formatexclusiveminimum)
- [transform](#transform)<sup>\*</sup>
- [Keywords for arrays](#keywords-for-arrays)
- [uniqueItemProperties](#uniqueitemproperties)
- [Keywords for objects](#keywords-for-objects)
- [allRequired](#allrequired)
- [anyRequired](#anyrequired)
- [oneRequired](#onerequired)
- [patternRequired](#patternrequired)
- [prohibited](#prohibited)
- [deepProperties](#deepproperties)
- [deepRequired](#deeprequired)
- [Compound keywords](#compound-keywords)
- [switch](#switch) (deprecated)
- [select/selectCases/selectDefault](#selectselectcasesselectdefault) (BETA)
- [Keywords for all types](#keywords-for-all-types)
- [dynamicDefaults](#dynamicdefaults)<sup>\*</sup>
- [Security contact](#security-contact)
- [Open-source software support](#open-source-software-support)
- [License](#license)
<sup>\*</sup> - keywords that modify data
## Install
```
npm install ajv-keywords
```
## Usage
To add all available keywords:
```javascript
var Ajv = require('ajv');
var ajv = new Ajv;
require('ajv-keywords')(ajv);
ajv.validate({ instanceof: 'RegExp' }, /.*/); // true
ajv.validate({ instanceof: 'RegExp' }, '.*'); // false
```
To add a single keyword:
```javascript
require('ajv-keywords')(ajv, 'instanceof');
```
To add multiple keywords:
```javascript
require('ajv-keywords')(ajv, ['typeof', 'instanceof']);
```
To add a single keyword in browser (to avoid adding unused code):
```javascript
require('ajv-keywords/keywords/instanceof')(ajv);
```
## Keywords
### Types
#### `typeof`
Based on JavaScript `typeof` operation.
The value of the keyword should be a string (`"undefined"`, `"string"`, `"number"`, `"object"`, `"function"`, `"boolean"` or `"symbol"`) or array of strings.
To pass validation the result of `typeof` operation on the value should be equal to the string (or one of the strings in the array).
```
ajv.validate({ typeof: 'undefined' }, undefined); // true
ajv.validate({ typeof: 'undefined' }, null); // false
ajv.validate({ typeof: ['undefined', 'object'] }, null); // true
```
#### `instanceof`
Based on JavaScript `instanceof` operation.
The value of the keyword should be a string (`"Object"`, `"Array"`, `"Function"`, `"Number"`, `"String"`, `"Date"`, `"RegExp"`, `"Promise"` or `"Buffer"`) or array of strings.
To pass validation the result of `data instanceof ...` operation on the value should be true:
```
ajv.validate({ instanceof: 'Array' }, []); // true
ajv.validate({ instanceof: 'Array' }, {}); // false
ajv.validate({ instanceof: ['Array', 'Function'] }, function(){}); // true
```
You can add your own constructor function to be recognised by this keyword:
```javascript
function MyClass() {}
var instanceofDefinition = require('ajv-keywords').get('instanceof').definition;
// or require('ajv-keywords/keywords/instanceof').definition;
instanceofDefinition.CONSTRUCTORS.MyClass = MyClass;
ajv.validate({ instanceof: 'MyClass' }, new MyClass); // true
```
### Keywords for numbers
#### `range` and `exclusiveRange`
Syntax sugar for the combination of minimum and maximum keywords, also fails schema compilation if there are no numbers in the range.
The value of this keyword must be the array consisting of two numbers, the second must be greater or equal than the first one.
If the validated value is not a number the validation passes, otherwise to pass validation the value should be greater (or equal) than the first number and smaller (or equal) than the second number in the array. If `exclusiveRange` keyword is present in the same schema and its value is true, the validated value must not be equal to the range boundaries.
```javascript
var schema = { range: [1, 3] };
ajv.validate(schema, 1); // true
ajv.validate(schema, 2); // true
ajv.validate(schema, 3); // true
ajv.validate(schema, 0.99); // false
ajv.validate(schema, 3.01); // false
var schema = { range: [1, 3], exclusiveRange: true };
ajv.validate(schema, 1.01); // true
ajv.validate(schema, 2); // true
ajv.validate(schema, 2.99); // true
ajv.validate(schema, 1); // false
ajv.validate(schema, 3); // false
```
### Keywords for strings
#### `regexp`
This keyword allows to use regular expressions with flags in schemas (the standard `pattern` keyword does not support flags).
This keyword applies only to strings. If the data is not a string, the validation succeeds.
The value of this keyword can be either a string (the result of `regexp.toString()`) or an object with the properties `pattern` and `flags` (the same strings that should be passed to RegExp constructor).
```javascript
var schema = {
type: 'object',
properties: {
foo: { regexp: '/foo/i' },
bar: { regexp: { pattern: 'bar', flags: 'i' } }
}
};
var validData = {
foo: 'Food',
bar: 'Barmen'
};
var invalidData = {
foo: 'fog',
bar: 'bad'
};
```
#### `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum`
These keywords allow to define minimum/maximum constraints when the format keyword defines ordering.
These keywords apply only to strings. If the data is not a string, the validation succeeds.
The value of keyword `formatMaximum` (`formatMinimum`) should be a string. This value is the maximum (minimum) allowed value for the data to be valid as determined by `format` keyword. If `format` is not present schema compilation will throw exception.
When this keyword is added, it defines comparison rules for formats `"date"`, `"time"` and `"date-time"`. Custom formats also can have comparison rules. See [addFormat](https://github.com/epoberezkin/ajv#api-addformat) method.
The value of keyword `formatExclusiveMaximum` (`formatExclusiveMinimum`) should be a boolean value. These keyword cannot be used without `formatMaximum` (`formatMinimum`). If this keyword value is equal to `true`, the data to be valid should not be equal to the value in `formatMaximum` (`formatMinimum`) keyword.
```javascript
require('ajv-keywords')(ajv, ['formatMinimum', 'formatMaximum']);
var schema = {
format: 'date',
formatMinimum: '2016-02-06',
formatMaximum: '2016-12-27',
formatExclusiveMaximum: true
}
var validDataList = ['2016-02-06', '2016-12-26', 1];
var invalidDataList = ['2016-02-05', '2016-12-27', 'abc'];
```
#### `transform`
This keyword allows a string to be modified before validation.
These keywords apply only to strings. If the data is not a string, the transform is skipped.
There are limitation due to how ajv is written:
- a stand alone string cannot be transformed. ie `data = 'a'; ajv.validate(schema, data);`
- currently cannot work with `ajv-pack`
**Supported options:**
- `trim`: remove whitespace from start and end
- `trimLeft`: remove whitespace from start
- `trimRight`: remove whitespace from end
- `toLowerCase`: case string to all lower case
- `toUpperCase`: case string to all upper case
- `toEnumCase`: case string to match case in schema
Options are applied in the order they are listed.
Note: `toEnumCase` requires that all allowed values are unique when case insensitive.
**Example: multiple options**
```javascript
require('ajv-keywords')(ajv, ['transform']);
var schema = {
type: 'array',
items: {
type:'string',
transform:['trim','toLowerCase']
}
};
var data = [' MixCase '];
ajv.validate(schema, data);
console.log(data); // ['mixcase']
```
**Example: `enumcase`**
```javascript
require('ajv-keywords')(ajv, ['transform']);
var schema = {
type: 'array',
items: {
type:'string',
transform:['trim','toEnumCase'],
enum:['pH']
}
};
var data = ['ph',' Ph','PH','pH '];
ajv.validate(schema, data);
console.log(data); // ['pH','pH','pH','pH']
```
### Keywords for arrays
#### `uniqueItemProperties`
The keyword allows to check that some properties in array items are unique.
This keyword applies only to arrays. If the data is not an array, the validation succeeds.
The value of this keyword must be an array of strings - property names that should have unique values across all items.
```javascript
var schema = { uniqueItemProperties: [ "id", "name" ] };
var validData = [
{ id: 1 },
{ id: 2 },
{ id: 3 }
];
var invalidData1 = [
{ id: 1 },
{ id: 1 }, // duplicate "id"
{ id: 3 }
];
var invalidData2 = [
{ id: 1, name: "taco" },
{ id: 2, name: "taco" }, // duplicate "name"
{ id: 3, name: "salsa" }
];
```
This keyword is contributed by [@blainesch](https://github.com/blainesch).
### Keywords for objects
#### `allRequired`
This keyword allows to require the presence of all properties used in `properties` keyword in the same schema object.
This keyword applies only to objects. If the data is not an object, the validation succeeds.
The value of this keyword must be boolean.
If the value of the keyword is `false`, the validation succeeds.
If the value of the keyword is `true`, the validation succeeds if the data contains all properties defined in `properties` keyword (in the same schema object).
If the `properties` keyword is not present in the same schema object, schema compilation will throw exception.
```javascript
var schema = {
properties: {
foo: {type: 'number'},
bar: {type: 'number'}
}
allRequired: true
};
var validData = { foo: 1, bar: 2 };
var alsoValidData = { foo: 1, bar: 2, baz: 3 };
var invalidDataList = [ {}, { foo: 1 }, { bar: 2 } ];
```
#### `anyRequired`
This keyword allows to require the presence of any (at least one) property from the list.
This keyword applies only to objects. If the data is not an object, the validation succeeds.
The value of this keyword must be an array of strings, each string being a property name. For data object to be valid at least one of the properties in this array should be present in the object.
```javascript
var schema = {
anyRequired: ['foo', 'bar']
};
var validData = { foo: 1 };
var alsoValidData = { foo: 1, bar: 2 };
var invalidDataList = [ {}, { baz: 3 } ];
```
#### `oneRequired`
This keyword allows to require the presence of only one property from the list.
This keyword applies only to objects. If the data is not an object, the validation succeeds.
The value of this keyword must be an array of strings, each string being a property name. For data object to be valid exactly one of the properties in this array should be present in the object.
```javascript
var schema = {
oneRequired: ['foo', 'bar']
};
var validData = { foo: 1 };
var alsoValidData = { bar: 2, baz: 3 };
var invalidDataList = [ {}, { baz: 3 }, { foo: 1, bar: 2 } ];
```
#### `patternRequired`
This keyword allows to require the presence of properties that match some pattern(s).
This keyword applies only to objects. If the data is not an object, the validation succeeds.
The value of this keyword should be an array of strings, each string being a regular expression. For data object to be valid each regular expression in this array should match at least one property name in the data object.
If the array contains multiple regular expressions, more than one expression can match the same property name.
```javascript
var schema = { patternRequired: [ 'f.*o', 'b.*r' ] };
var validData = { foo: 1, bar: 2 };
var alsoValidData = { foobar: 3 };
var invalidDataList = [ {}, { foo: 1 }, { bar: 2 } ];
```
#### `prohibited`
This keyword allows to prohibit that any of the properties in the list is present in the object.
This keyword applies only to objects. If the data is not an object, the validation succeeds.
The value of this keyword should be an array of strings, each string being a property name. For data object to be valid none of the properties in this array should be present in the object.
```
var schema = { prohibited: ['foo', 'bar']};
var validData = { baz: 1 };
var alsoValidData = {};
var invalidDataList = [
{ foo: 1 },
{ bar: 2 },
{ foo: 1, bar: 2}
];
```
__Please note__: `{prohibited: ['foo', 'bar']}` is equivalent to `{not: {anyRequired: ['foo', 'bar']}}` (i.e. it has the same validation result for any data).
#### `deepProperties`
This keyword allows to validate deep properties (identified by JSON pointers).
This keyword applies only to objects. If the data is not an object, the validation succeeds.
The value should be an object, where keys are JSON pointers to the data, starting from the current position in data, and the values are JSON schemas. For data object to be valid the value of each JSON pointer should be valid according to the corresponding schema.
```javascript
var schema = {
type: 'object',
deepProperties: {
"/users/1/role": { "enum": ["admin"] }
}
};
var validData = {
users: [
{},
{
id: 123,
role: 'admin'
}
]
};
var alsoValidData = {
users: {
"1": {
id: 123,
role: 'admin'
}
}
};
var invalidData = {
users: [
{},
{
id: 123,
role: 'user'
}
]
};
var alsoInvalidData = {
users: {
"1": {
id: 123,
role: 'user'
}
}
};
```
#### `deepRequired`
This keyword allows to check that some deep properties (identified by JSON pointers) are available.
This keyword applies only to objects. If the data is not an object, the validation succeeds.
The value should be an array of JSON pointers to the data, starting from the current position in data. For data object to be valid each JSON pointer should be some existing part of the data.
```javascript
var schema = {
type: 'object',
deepRequired: ["/users/1/role"]
};
var validData = {
users: [
{},
{
id: 123,
role: 'admin'
}
]
};
var invalidData = {
users: [
{},
{
id: 123
}
]
};
```
See [json-schema-org/json-schema-spec#203](https://github.com/json-schema-org/json-schema-spec/issues/203#issue-197211916) for an example of the equivalent schema without `deepRequired` keyword.
### Compound keywords
#### `switch` (deprecated)
__Please note__: this keyword is provided to preserve backward compatibility with previous versions of Ajv. It is strongly recommended to use `if`/`then`/`else` keywords instead, as they have been added to the draft-07 of JSON Schema specification.
This keyword allows to perform advanced conditional validation.
The value of the keyword is the array of if/then clauses. Each clause is the object with the following properties:
- `if` (optional) - the value is JSON-schema
- `then` (required) - the value is JSON-schema or boolean
- `continue` (optional) - the value is boolean
The validation process is dynamic; all clauses are executed sequentially in the following way:
1. `if`:
1. `if` property is JSON-schema according to which the data is:
1. valid => go to step 2.
2. invalid => go to the NEXT clause, if this was the last clause the validation of `switch` SUCCEEDS.
2. `if` property is absent => go to step 2.
2. `then`:
1. `then` property is `true` or it is JSON-schema according to which the data is valid => go to step 3.
2. `then` property is `false` or it is JSON-schema according to which the data is invalid => the validation of `switch` FAILS.
3. `continue`:
1. `continue` property is `true` => go to the NEXT clause, if this was the last clause the validation of `switch` SUCCEEDS.
2. `continue` property is `false` or absent => validation of `switch` SUCCEEDS.
```javascript
require('ajv-keywords')(ajv, 'switch');
var schema = {
type: 'array',
items: {
type: 'integer',
'switch': [
{ if: { not: { minimum: 1 } }, then: false },
{ if: { maximum: 10 }, then: true },
{ if: { maximum: 100 }, then: { multipleOf: 10 } },
{ if: { maximum: 1000 }, then: { multipleOf: 100 } },
{ then: false }
]
}
};
var validItems = [1, 5, 10, 20, 50, 100, 200, 500, 1000];
var invalidItems = [1, 0, 2000, 11, 57, 123, 'foo'];
```
The above schema is equivalent to (for example):
```javascript
{
type: 'array',
items: {
type: 'integer',
if: { minimum: 1, maximum: 10 },
then: true,
else: {
if: { maximum: 100 },
then: { multipleOf: 10 },
else: {
if: { maximum: 1000 },
then: { multipleOf: 100 },
else: false
}
}
}
}
```
#### `select`/`selectCases`/`selectDefault`
These keywords allow to choose the schema to validate the data based on the value of some property in the validated data.
These keywords must be present in the same schema object (`selectDefault` is optional).
The value of `select` keyword should be a [$data reference](https://github.com/epoberezkin/ajv/tree/5.0.2-beta.0#data-reference) that points to any primitive JSON type (string, number, boolean or null) in the data that is validated. You can also use a constant of primitive type as the value of this keyword (e.g., for debugging purposes).
The value of `selectCases` keyword must be an object where each property name is a possible string representation of the value of `select` keyword and each property value is a corresponding schema (from draft-06 it can be boolean) that must be used to validate the data.
The value of `selectDefault` keyword is a schema (from draft-06 it can be boolean) that must be used to validate the data in case `selectCases` has no key equal to the stringified value of `select` keyword.
The validation succeeds in one of the following cases:
- the validation of data using selected schema succeeds,
- none of the schemas is selected for validation,
- the value of select is undefined (no property in the data that the data reference points to).
If `select` value (in data) is not a primitive type the validation fails.
__Please note__: these keywords require Ajv `$data` option to support [$data reference](https://github.com/epoberezkin/ajv/tree/5.0.2-beta.0#data-reference).
```javascript
require('ajv-keywords')(ajv, 'select');
var schema = {
type: object,
required: ['kind'],
properties: {
kind: { type: 'string' }
},
select: { $data: '0/kind' },
selectCases: {
foo: {
required: ['foo'],
properties: {
kind: {},
foo: { type: 'string' }
},
additionalProperties: false
},
bar: {
required: ['bar'],
properties: {
kind: {},
bar: { type: 'number' }
},
additionalProperties: false
}
},
selectDefault: {
propertyNames: {
not: { enum: ['foo', 'bar'] }
}
}
};
var validDataList = [
{ kind: 'foo', foo: 'any' },
{ kind: 'bar', bar: 1 },
{ kind: 'anything_else', not_bar_or_foo: 'any value' }
];
var invalidDataList = [
{ kind: 'foo' }, // no propery foo
{ kind: 'bar' }, // no propery bar
{ kind: 'foo', foo: 'any', another: 'any value' }, // additional property
{ kind: 'bar', bar: 1, another: 'any value' }, // additional property
{ kind: 'anything_else', foo: 'any' } // property foo not allowed
{ kind: 'anything_else', bar: 1 } // property bar not allowed
];
```
__Please note__: the current implementation is BETA. It does not allow using relative URIs in $ref keywords in schemas in `selectCases` and `selectDefault` that point outside of these schemas. The workaround is to use absolute URIs (that can point to any (sub-)schema added to Ajv, including those inside the current root schema where `select` is used). See [tests](https://github.com/epoberezkin/ajv-keywords/blob/v2.0.0/spec/tests/select.json#L314).
### Keywords for all types
#### `dynamicDefaults`
This keyword allows to assign dynamic defaults to properties, such as timestamps, unique IDs etc.
This keyword only works if `useDefaults` options is used and not inside `anyOf` keywords etc., in the same way as [default keyword treated by Ajv](https://github.com/epoberezkin/ajv#assigning-defaults).
The keyword should be added on the object level. Its value should be an object with each property corresponding to a property name, in the same way as in standard `properties` keyword. The value of each property can be:
- an identifier of default function (a string)
- an object with properties `func` (an identifier) and `args` (an object with parameters that will be passed to this function during schema compilation - see examples).
The properties used in `dynamicDefaults` should not be added to `required` keyword (or validation will fail), because unlike `default` this keyword is processed after validation.
There are several predefined dynamic default functions:
- `"timestamp"` - current timestamp in milliseconds
- `"datetime"` - current date and time as string (ISO, valid according to `date-time` format)
- `"date"` - current date as string (ISO, valid according to `date` format)
- `"time"` - current time as string (ISO, valid according to `time` format)
- `"random"` - pseudo-random number in [0, 1) interval
- `"randomint"` - pseudo-random integer number. If string is used as a property value, the function will randomly return 0 or 1. If object `{ func: 'randomint', args: { max: N } }` is used then the default will be an integer number in [0, N) interval.
- `"seq"` - sequential integer number starting from 0. If string is used as a property value, the default sequence will be used. If object `{ func: 'seq', args: { name: 'foo'} }` is used then the sequence with name `"foo"` will be used. Sequences are global, even if different ajv instances are used.
```javascript
var schema = {
type: 'object',
dynamicDefaults: {
ts: 'datetime',
r: { func: 'randomint', args: { max: 100 } },
id: { func: 'seq', args: { name: 'id' } }
},
properties: {
ts: {
type: 'string',
format: 'date-time'
},
r: {
type: 'integer',
minimum: 0,
exclusiveMaximum: 100
},
id: {
type: 'integer',
minimum: 0
}
}
};
var data = {};
ajv.validate(data); // true
data; // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 }
var data1 = {};
ajv.validate(data1); // true
data1; // { ts: '2016-12-01T22:07:29.832Z', r: 68, id: 1 }
ajv.validate(data1); // true
data1; // didn't change, as all properties were defined
```
When using the `useDefaults` option value `"empty"`, properties and items equal to `null` or `""` (empty string) will be considered missing and assigned defaults. Use the `allOf` [compound keyword](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#compound-keywords) to execute `dynamicDefaults` before validation.
```javascript
var schema = {
allOf: [
{
dynamicDefaults: {
ts: 'datetime',
r: { func: 'randomint', args: { min: 5, max: 100 } },
id: { func: 'seq', args: { name: 'id' } }
}
},
{
type: 'object',
properties: {
ts: {
type: 'string'
},
r: {
type: 'number',
minimum: 5,
exclusiveMaximum: 100
},
id: {
type: 'integer',
minimum: 0
}
}
}
]
};
var data = { ts: '', r: null };
ajv.validate(data); // true
data; // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 }
```
You can add your own dynamic default function to be recognised by this keyword:
```javascript
var uuid = require('uuid');
function uuidV4() { return uuid.v4(); }
var definition = require('ajv-keywords').get('dynamicDefaults').definition;
// or require('ajv-keywords/keywords/dynamicDefaults').definition;
definition.DEFAULTS.uuid = uuidV4;
var schema = {
dynamicDefaults: { id: 'uuid' },
properties: { id: { type: 'string', format: 'uuid' } }
};
var data = {};
ajv.validate(schema, data); // true
data; // { id: 'a1183fbe-697b-4030-9bcc-cfeb282a9150' };
var data1 = {};
ajv.validate(schema, data1); // true
data1; // { id: '5b008de7-1669-467a-a5c6-70fa244d7209' }
```
You also can define dynamic default that accepts parameters, e.g. version of uuid:
```javascript
var uuid = require('uuid');
function getUuid(args) {
var version = 'v' + (arvs && args.v || 4);
return function() {
return uuid[version]();
};
}
var definition = require('ajv-keywords').get('dynamicDefaults').definition;
definition.DEFAULTS.uuid = getUuid;
var schema = {
dynamicDefaults: {
id1: 'uuid', // v4
id2: { func: 'uuid', v: 4 }, // v4
id3: { func: 'uuid', v: 1 } // v1
}
};
```
## Security contact
To report a security vulnerability, please use the
[Tidelift security contact](https://tidelift.com/security).
Tidelift will coordinate the fix and disclosure.
Please do NOT report security vulnerabilities via GitHub issues.
## Open-source software support
Ajv-keywords is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv-keywords?utm_source=npm-ajv-keywords&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers.
## License
[MIT](https://github.com/epoberezkin/ajv-keywords/blob/master/LICENSE)

@ -0,0 +1,7 @@
declare module 'ajv-keywords' {
import { Ajv } from 'ajv';
function keywords(ajv: Ajv, include?: string | string[]): Ajv;
export = keywords;
}

@ -0,0 +1,35 @@
'use strict';
var KEYWORDS = require('./keywords');
module.exports = defineKeywords;
/**
* Defines one or several keywords in ajv instance
* @param {Ajv} ajv validator instance
* @param {String|Array<String>|undefined} keyword keyword(s) to define
* @return {Ajv} ajv instance (for chaining)
*/
function defineKeywords(ajv, keyword) {
if (Array.isArray(keyword)) {
for (var i=0; i<keyword.length; i++)
get(keyword[i])(ajv);
return ajv;
}
if (keyword) {
get(keyword)(ajv);
return ajv;
}
for (keyword in KEYWORDS) get(keyword)(ajv);
return ajv;
}
defineKeywords.get = get;
function get(keyword) {
var defFunc = KEYWORDS[keyword];
if (!defFunc) throw new Error('Unknown keyword ' + keyword);
return defFunc;
}

@ -0,0 +1,101 @@
'use strict';
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i;
var DATE_TIME_SEPARATOR = /t|\s/i;
var COMPARE_FORMATS = {
date: compareDate,
time: compareTime,
'date-time': compareDateTime
};
var $dataMetaSchema = {
type: 'object',
required: [ '$data' ],
properties: {
$data: {
type: 'string',
anyOf: [
{ format: 'relative-json-pointer' },
{ format: 'json-pointer' }
]
}
},
additionalProperties: false
};
module.exports = function (minMax) {
var keyword = 'format' + minMax;
return function defFunc(ajv) {
defFunc.definition = {
type: 'string',
inline: require('./dotjs/_formatLimit'),
statements: true,
errors: 'full',
dependencies: ['format'],
metaSchema: {
anyOf: [
{type: 'string'},
$dataMetaSchema
]
}
};
ajv.addKeyword(keyword, defFunc.definition);
ajv.addKeyword('formatExclusive' + minMax, {
dependencies: ['format' + minMax],
metaSchema: {
anyOf: [
{type: 'boolean'},
$dataMetaSchema
]
}
});
extendFormats(ajv);
return ajv;
};
};
function extendFormats(ajv) {
var formats = ajv._formats;
for (var name in COMPARE_FORMATS) {
var format = formats[name];
// the last condition is needed if it's RegExp from another window
if (typeof format != 'object' || format instanceof RegExp || !format.validate)
format = formats[name] = { validate: format };
if (!format.compare)
format.compare = COMPARE_FORMATS[name];
}
}
function compareDate(d1, d2) {
if (!(d1 && d2)) return;
if (d1 > d2) return 1;
if (d1 < d2) return -1;
if (d1 === d2) return 0;
}
function compareTime(t1, t2) {
if (!(t1 && t2)) return;
t1 = t1.match(TIME);
t2 = t2.match(TIME);
if (!(t1 && t2)) return;
t1 = t1[1] + t1[2] + t1[3] + (t1[4]||'');
t2 = t2[1] + t2[2] + t2[3] + (t2[4]||'');
if (t1 > t2) return 1;
if (t1 < t2) return -1;
if (t1 === t2) return 0;
}
function compareDateTime(dt1, dt2) {
if (!(dt1 && dt2)) return;
dt1 = dt1.split(DATE_TIME_SEPARATOR);
dt2 = dt2.split(DATE_TIME_SEPARATOR);
var res = compareDate(dt1[0], dt2[0]);
if (res === undefined) return;
return res || compareTime(dt1[1], dt2[1]);
}

@ -0,0 +1,15 @@
'use strict';
module.exports = {
metaSchemaRef: metaSchemaRef
};
var META_SCHEMA_ID = 'http://json-schema.org/draft-07/schema';
function metaSchemaRef(ajv) {
var defaultMeta = ajv._opts.defaultMeta;
if (typeof defaultMeta == 'string') return { $ref: defaultMeta };
if (ajv.getSchema(META_SCHEMA_ID)) return { $ref: META_SCHEMA_ID };
console.warn('meta schema not defined');
return {};
}

@ -0,0 +1,18 @@
'use strict';
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
macro: function (schema, parentSchema) {
if (!schema) return true;
var properties = Object.keys(parentSchema.properties);
if (properties.length == 0) return true;
return {required: properties};
},
metaSchema: {type: 'boolean'},
dependencies: ['properties']
};
ajv.addKeyword('allRequired', defFunc.definition);
return ajv;
};

@ -0,0 +1,24 @@
'use strict';
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
macro: function (schema) {
if (schema.length == 0) return true;
if (schema.length == 1) return {required: schema};
var schemas = schema.map(function (prop) {
return {required: [prop]};
});
return {anyOf: schemas};
},
metaSchema: {
type: 'array',
items: {
type: 'string'
}
}
};
ajv.addKeyword('anyRequired', defFunc.definition);
return ajv;
};

@ -0,0 +1,54 @@
'use strict';
var util = require('./_util');
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
macro: function (schema) {
var schemas = [];
for (var pointer in schema)
schemas.push(getSchema(pointer, schema[pointer]));
return {'allOf': schemas};
},
metaSchema: {
type: 'object',
propertyNames: {
type: 'string',
format: 'json-pointer'
},
additionalProperties: util.metaSchemaRef(ajv)
}
};
ajv.addKeyword('deepProperties', defFunc.definition);
return ajv;
};
function getSchema(jsonPointer, schema) {
var segments = jsonPointer.split('/');
var rootSchema = {};
var pointerSchema = rootSchema;
for (var i=1; i<segments.length; i++) {
var segment = segments[i];
var isLast = i == segments.length - 1;
segment = unescapeJsonPointer(segment);
var properties = pointerSchema.properties = {};
var items = undefined;
if (/[0-9]+/.test(segment)) {
var count = +segment;
items = pointerSchema.items = [];
while (count--) items.push({});
}
pointerSchema = isLast ? schema : {};
properties[segment] = pointerSchema;
if (items) items.push(pointerSchema);
}
return rootSchema;
}
function unescapeJsonPointer(str) {
return str.replace(/~1/g, '/').replace(/~0/g, '~');
}

@ -0,0 +1,57 @@
'use strict';
module.exports = function defFunc(ajv) {
defFunc.definition = {
type: 'object',
inline: function (it, keyword, schema) {
var expr = '';
for (var i=0; i<schema.length; i++) {
if (i) expr += ' && ';
expr += '(' + getData(schema[i], it.dataLevel) + ' !== undefined)';
}
return expr;
},
metaSchema: {
type: 'array',
items: {
type: 'string',
format: 'json-pointer'
}
}
};
ajv.addKeyword('deepRequired', defFunc.definition);
return ajv;
};
function getData(jsonPointer, lvl) {
var data = 'data' + (lvl || '');
if (!jsonPointer) return data;
var expr = data;
var segments = jsonPointer.split('/');
for (var i=1; i<segments.length; i++) {
var segment = segments[i];
data += getProperty(unescapeJsonPointer(segment));
expr += ' && ' + data;
}
return expr;
}
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
var INTEGER = /^[0-9]+$/;
var SINGLE_QUOTE = /'|\\/g;
function getProperty(key) {
return INTEGER.test(key)
? '[' + key + ']'
: IDENTIFIER.test(key)
? '.' + key
: "['" + key.replace(SINGLE_QUOTE, '\\$&') + "']";
}
function unescapeJsonPointer(str) {
return str.replace(/~1/g, '/').replace(/~0/g, '~');
}

@ -0,0 +1,116 @@
{{# def.definitions }}
{{# def.errors }}
{{# def.setupKeyword }}
var {{=$valid}} = undefined;
{{## def.skipFormatLimit:
{{=$valid}} = true;
{{ return out; }}
#}}
{{## def.compareFormat:
{{? $isData }}
if ({{=$schemaValue}} === undefined) {{=$valid}} = true;
else if (typeof {{=$schemaValue}} != 'string') {{=$valid}} = false;
else {
{{ $closingBraces += '}'; }}
{{?}}
{{? $isDataFormat }}
if (!{{=$compare}}) {{=$valid}} = true;
else {
{{ $closingBraces += '}'; }}
{{?}}
var {{=$result}} = {{=$compare}}({{=$data}}, {{# def.schemaValueQS }});
if ({{=$result}} === undefined) {{=$valid}} = false;
#}}
{{? it.opts.format === false }}{{# def.skipFormatLimit }}{{?}}
{{
var $schemaFormat = it.schema.format
, $isDataFormat = it.opts.$data && $schemaFormat.$data
, $closingBraces = '';
}}
{{? $isDataFormat }}
{{
var $schemaValueFormat = it.util.getData($schemaFormat.$data, $dataLvl, it.dataPathArr)
, $format = 'format' + $lvl
, $compare = 'compare' + $lvl;
}}
var {{=$format}} = formats[{{=$schemaValueFormat}}]
, {{=$compare}} = {{=$format}} && {{=$format}}.compare;
{{??}}
{{ var $format = it.formats[$schemaFormat]; }}
{{? !($format && $format.compare) }}
{{# def.skipFormatLimit }}
{{?}}
{{ var $compare = 'formats' + it.util.getProperty($schemaFormat) + '.compare'; }}
{{?}}
{{
var $isMax = $keyword == 'formatMaximum'
, $exclusiveKeyword = 'formatExclusive' + ($isMax ? 'Maximum' : 'Minimum')
, $schemaExcl = it.schema[$exclusiveKeyword]
, $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data
, $op = $isMax ? '<' : '>'
, $result = 'result' + $lvl;
}}
{{# def.$data }}
{{? $isDataExcl }}
{{
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
, $exclusive = 'exclusive' + $lvl
, $opExpr = 'op' + $lvl
, $opStr = '\' + ' + $opExpr + ' + \'';
}}
var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
{{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
if (typeof {{=$schemaValueExcl}} != 'boolean' && {{=$schemaValueExcl}} !== undefined) {
{{=$valid}} = false;
{{ var $errorKeyword = $exclusiveKeyword; }}
{{# def.error:'_formatExclusiveLimit' }}
}
{{# def.elseIfValid }}
{{# def.compareFormat }}
var {{=$exclusive}} = {{=$schemaValueExcl}} === true;
if ({{=$valid}} === undefined) {
{{=$valid}} = {{=$exclusive}}
? {{=$result}} {{=$op}} 0
: {{=$result}} {{=$op}}= 0;
}
if (!{{=$valid}}) var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}=';
{{??}}
{{
var $exclusive = $schemaExcl === true
, $opStr = $op; /*used in error*/
if (!$exclusive) $opStr += '=';
var $opExpr = '\'' + $opStr + '\''; /*used in error*/
}}
{{# def.compareFormat }}
if ({{=$valid}} === undefined)
{{=$valid}} = {{=$result}} {{=$op}}{{?!$exclusive}}={{?}} 0;
{{?}}
{{= $closingBraces }}
if (!{{=$valid}}) {
{{ var $errorKeyword = $keyword; }}
{{# def.error:'_formatLimit' }}
}

@ -0,0 +1,33 @@
{{# def.definitions }}
{{# def.errors }}
{{# def.setupKeyword }}
{{
var $key = 'key' + $lvl
, $idx = 'idx' + $lvl
, $matched = 'patternMatched' + $lvl
, $dataProperties = 'dataProperties' + $lvl
, $closingBraces = ''
, $ownProperties = it.opts.ownProperties;
}}
var {{=$valid}} = true;
{{? $ownProperties }}
var {{=$dataProperties}} = undefined;
{{?}}
{{~ $schema:$pProperty }}
var {{=$matched}} = false;
{{# def.iterateProperties }}
{{=$matched}} = {{= it.usePattern($pProperty) }}.test({{=$key}});
if ({{=$matched}}) break;
}
{{ var $missingPattern = it.util.escapeQuotes($pProperty); }}
if (!{{=$matched}}) {
{{=$valid}} = false;
{{# def.addError:'patternRequired' }}
} {{# def.elseIfValid }}
{{~}}
{{= $closingBraces }}

@ -0,0 +1,71 @@
{{# def.definitions }}
{{# def.errors }}
{{# def.setupKeyword }}
{{# def.setupNextLevel }}
{{## def.validateIf:
{{# def.setCompositeRule }}
{{ $it.createErrors = false; }}
{{# def._validateSwitchRule:if }}
{{ $it.createErrors = true; }}
{{# def.resetCompositeRule }}
{{=$ifPassed}} = {{=$nextValid}};
#}}
{{## def.validateThen:
{{? typeof $sch.then == 'boolean' }}
{{? $sch.then === false }}
{{# def.error:'switch' }}
{{?}}
var {{=$nextValid}} = {{= $sch.then }};
{{??}}
{{# def._validateSwitchRule:then }}
{{?}}
#}}
{{## def._validateSwitchRule:_clause:
{{
$it.schema = $sch._clause;
$it.schemaPath = $schemaPath + '[' + $caseIndex + ']._clause';
$it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/_clause';
}}
{{# def.insertSubschemaCode }}
#}}
{{## def.switchCase:
{{? $sch.if && {{# def.nonEmptySchema:$sch.if }} }}
var {{=$errs}} = errors;
{{# def.validateIf }}
if ({{=$ifPassed}}) {
{{# def.validateThen }}
} else {
{{# def.resetErrors }}
}
{{??}}
{{=$ifPassed}} = true;
{{# def.validateThen }}
{{?}}
#}}
{{
var $ifPassed = 'ifPassed' + it.level
, $currentBaseId = $it.baseId
, $shouldContinue;
}}
var {{=$ifPassed}};
{{~ $schema:$sch:$caseIndex }}
{{? $caseIndex && !$shouldContinue }}
if (!{{=$ifPassed}}) {
{{ $closingBraces+= '}'; }}
{{?}}
{{# def.switchCase }}
{{ $shouldContinue = $sch.continue }}
{{~}}
{{= $closingBraces }}
var {{=$valid}} = {{=$nextValid}};

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save