mirror of
https://github.com/scxwhite/hera.git
synced 2025-05-03 00:01:40 +08:00
update 2.4.4 version
This commit is contained in:
parent
a3f0308ec1
commit
912c470636
@ -7,14 +7,13 @@
|
||||
<parent>
|
||||
<groupId>com.dfire.hera</groupId>
|
||||
<artifactId>hera</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<version>2.4.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hera-admin</artifactId>
|
||||
<version>${hera.admin.version}</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>hera-admin</name>
|
||||
<description>hera任务调度系统</description>
|
||||
|
||||
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
@ -60,15 +59,8 @@
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper</artifactId>
|
||||
<version>5.1.2</version>
|
||||
</dependency>
|
||||
<!--
|
||||
使用后会影响dubbo的初始化
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>-->
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
|
@ -6,6 +6,6 @@ ${AnsiColor.BRIGHT_CYAN}
|
||||
|_| |_|\___|_| \__,_| create by: 凌霄 小苏打 生煎 火锅
|
||||
|
||||
${AnsiColor.BRIGHT_YELLOW}
|
||||
::: Spring-Boot ${spring-boot.version} ::: Hera (version:${hera.version})
|
||||
::: Spring-Boot ${spring-boot.version} ::: Hera (version:2.4.4)
|
||||
|
||||
${AnsiColor.DEFAULT}
|
||||
|
@ -28,7 +28,7 @@ druid:
|
||||
username: root #数据库用户名
|
||||
password: moye #数据库密码
|
||||
driver-class-name: com.mysql.jdbc.Driver #数据库驱动
|
||||
url: jdbc:mysql://localhost:3306/hera2.4.2?characterEncoding=utf-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&allowMultiQueries=true&useSSL=false
|
||||
url: jdbc:mysql://localhost:3306/hera?characterEncoding=utf-8&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull&autoReconnect=true&allowMultiQueries=true&useSSL=false
|
||||
initial-size: 5 #初始化连接池数量
|
||||
min-idle: 1 #最小生存连接数
|
||||
max-active: 16 #最大连接池数量
|
||||
@ -79,7 +79,6 @@ hera:
|
||||
env: ${spring.profiles.active}
|
||||
alarmEnv: daily,dev,pre,publish # 设置允许哪些环境开启告警,多个用,分开,默认全部环境
|
||||
sudoUser: false #是否要使用sudo -u 切换账号(即启动多租户功能)
|
||||
version: 2.4.3
|
||||
kerberos:
|
||||
keytabpath: #kerberos认证keytab文件,如果hadoop 集群无需kerberos授权,则不填
|
||||
principal: #kerberos认证principal,如果hadoop 集群无需kerberos授权,则不填
|
||||
|
@ -40,10 +40,10 @@ CREATE TABLE IF NOT EXISTS `hera_action`
|
||||
`down_actions` varchar(16) DEFAULT NULL,
|
||||
`batch_id` varchar(50) DEFAULT NULL COMMENT '批次号',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `ind_action_groupid` (`group_id`),
|
||||
KEY `ind_actionjobid` (`job_id`)
|
||||
KEY `idx_group_id` (`group_id`),
|
||||
KEY `idx_job_id` (`job_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='job版本记录表';
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='job实例记录表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `hera_action_history`
|
||||
(
|
||||
@ -68,11 +68,11 @@ CREATE TABLE IF NOT EXISTS `hera_action_history`
|
||||
batch_id varchar(50) DEFAULT NULL COMMENT '批次号',
|
||||
biz_label varchar(500) DEFAULT NULL COMMENT '标签',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `ind_action_id_job_id` (`action_id`, `job_id`),
|
||||
KEY `ind_job_id` (`job_id`),
|
||||
KEY `ind_gmt_create` (`gmt_create`),
|
||||
KEY `ind_end_time` (`end_time`),
|
||||
KEY `ind_start_time` (`start_time`)
|
||||
KEY `idx_action_id_job_id` (`action_id`, `job_id`),
|
||||
KEY `idx_job_id` (`job_id`),
|
||||
KEY `idx_gmt_create` (`gmt_create`),
|
||||
KEY `idx_end_time` (`end_time`),
|
||||
KEY `idx_start_time` (`start_time`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='Job运行日志表';
|
||||
CREATE TABLE IF NOT EXISTS `hera_advice`
|
||||
@ -150,9 +150,9 @@ CREATE TABLE IF NOT EXISTS `hera_group`
|
||||
`resources` text,
|
||||
`existed` int(11) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `ind_heragroupparent` (`parent`)
|
||||
KEY `idx_parent` (`parent`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4;
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='调度中心目录表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `hera_host_group`
|
||||
(
|
||||
@ -219,9 +219,9 @@ CREATE TABLE IF NOT EXISTS `hera_job`
|
||||
biz_label varchar(500) DEFAULT '',
|
||||
`estimated_end_hour` int(4) NOT NULL DEFAULT '0' COMMENT '预计结束结束时间',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `ind_zeusjobgroupid` (`group_id`)
|
||||
KEY `idx_group_id` (`group_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='hera的job 记录表';
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='调度中心任务记录表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `hera_job_monitor`
|
||||
(
|
||||
@ -229,7 +229,7 @@ CREATE TABLE IF NOT EXISTS `hera_job_monitor`
|
||||
`user_ids` varchar(100) NOT NULL,
|
||||
PRIMARY KEY (`job_id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4;
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='任务关注人列表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `hera_lock`
|
||||
(
|
||||
@ -256,16 +256,7 @@ CREATE TABLE IF NOT EXISTS `hera_permission`
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='任务授权记录表';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `hera_profile`
|
||||
(
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`gmt_create` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`gmt_modified` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`hadoop_conf` varchar(2024) DEFAULT NULL COMMENT 'hadoop配置信息',
|
||||
`uid` varchar(32) DEFAULT NULL COMMENT '用户名称',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='用户配置表';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `hera_user`
|
||||
@ -284,7 +275,7 @@ CREATE TABLE IF NOT EXISTS `hera_user`
|
||||
`description` varchar(256) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4;
|
||||
DEFAULT CHARSET = utf8mb4 comment ='用户组表';
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `hera_sso`
|
||||
@ -317,7 +308,6 @@ CREATE TABLE IF NOT EXISTS `hera_record`
|
||||
`gId` int(11) NOT NULL DEFAULT '-1' COMMENT '组id',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 37
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='日志记录表';
|
||||
|
||||
|
||||
|
@ -1541,7 +1541,7 @@ layui.use(['table'], function () {
|
||||
}, {
|
||||
field: "actionId",
|
||||
title: "版本号",
|
||||
width: "11%",
|
||||
width: "14%",
|
||||
halign: 'center',
|
||||
align: 'center',
|
||||
formatter: function (val) {
|
||||
|
@ -243,7 +243,7 @@
|
||||
|
||||
<#macro commonFooter >
|
||||
<footer class="main-footer">
|
||||
Powered by <b>hera</b> 2.4.3
|
||||
Powered by <b>hera</b> 2.4.4
|
||||
<div class="pull-right hidden-xs">
|
||||
<strong>Copyright © 2018-${.now?string('yyyy')}
|
||||
<a href="https://github.com/scxwhite/hera" target="_blank">github/scx_white</a>
|
||||
|
@ -5,12 +5,13 @@
|
||||
<parent>
|
||||
<groupId>com.dfire.hera</groupId>
|
||||
<artifactId>hera</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<version>2.4.4</version>
|
||||
</parent>
|
||||
|
||||
|
||||
|
||||
<artifactId>hera-common</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>${hera.common.version}</version>
|
||||
<name>hera-common</name>
|
||||
|
||||
<dependencies>
|
||||
|
@ -7,33 +7,16 @@
|
||||
<parent>
|
||||
<groupId>com.dfire.hera</groupId>
|
||||
<artifactId>hera</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<version>2.4.4</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>hera-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>${hera.core.version}</version>
|
||||
<name>hera-core</name>
|
||||
<description>hera project for Spring Boot</description>
|
||||
|
||||
<properties>
|
||||
<quartz.version>2.2.1</quartz.version>
|
||||
<jwt.version>3.3.0</jwt.version>
|
||||
<lang3.version>3.4</lang3.version>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-emr -->
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
<artifactId>aws-java-sdk-emr</artifactId>
|
||||
<version>1.11.513</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
<artifactId>aws-java-sdk-core</artifactId>
|
||||
<version>1.11.513</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.quartz-scheduler</groupId>
|
||||
@ -42,12 +25,18 @@
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
<version>4.3.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-emr</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
<artifactId>aws-java-sdk-emr</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.amazonaws</groupId>
|
||||
<artifactId>aws-java-sdk-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@ -57,9 +46,7 @@
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>${jwt.version}</version>
|
||||
</dependency>
|
||||
<!-- redisson-->
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
@ -76,7 +63,6 @@
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@ -86,7 +72,6 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${lang3.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@ -112,7 +97,6 @@
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -5,17 +5,14 @@
|
||||
<parent>
|
||||
<artifactId>hera</artifactId>
|
||||
<groupId>com.dfire.hera</groupId>
|
||||
<version>2.4.3</version>
|
||||
<version>2.4.4</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>hera-monitor</artifactId>
|
||||
<version>${hera.monitor.version}</version>
|
||||
<name>hera-monitor</name>
|
||||
<url>http://www.example.com</url>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -29,7 +26,6 @@
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
1404
hera-portal/dist/css/theme-colors-0653daff.css
vendored
Normal file
1404
hera-portal/dist/css/theme-colors-0653daff.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
hera-portal/dist/static/dist/static/css/app.007e7641.css
vendored
Normal file
1
hera-portal/dist/static/dist/static/css/app.007e7641.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
hera-portal/dist/static/dist/static/css/chunk-25a9dc80.b7bac25f.css
vendored
Normal file
1
hera-portal/dist/static/dist/static/css/chunk-25a9dc80.b7bac25f.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
hera-portal/dist/static/dist/static/css/chunk-25f2d318.349a72a0.css
vendored
Normal file
1
hera-portal/dist/static/dist/static/css/chunk-25f2d318.349a72a0.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.week-mode[data-v-3f82f6f7]{overflow:hidden;filter:invert(80%)}.beauty-scroll[data-v-3f82f6f7]{scrollbar-color:#1890ff #bae7ff;scrollbar-width:thin;-ms-overflow-style:none;position:relative}.beauty-scroll[data-v-3f82f6f7]::-webkit-scrollbar{width:3px;height:1px}.beauty-scroll[data-v-3f82f6f7]::-webkit-scrollbar-thumb{border-radius:3px;background:#1890ff}.beauty-scroll[data-v-3f82f6f7]::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 1px rgba(0,0,0,0);border-radius:3px;background:#91d5ff}.split-right[data-v-3f82f6f7]:not(:last-child){border-right:1px solid rgba(98,98,98,.2)}.disabled[data-v-3f82f6f7]{cursor:not-allowed;color:rgba(0,0,0,.25);pointer-events:none}.ant-input-affix-wrapper:hover .ant-input[data-v-3f82f6f7]:not(.ant-input-disabled){border-color:#d9d9d9!important}.ant-input[data-v-3f82f6f7]{border-radius:0!important;box-shadow:none!important;font-size:12px}.ant-input[data-v-3f82f6f7]:focus,.ant-input[data-v-3f82f6f7]:hover{box-shadow:none!important;border-color:#d9d9d9!important}.ant-modal-mask[data-v-3f82f6f7]{background-color:rgba(1,1,0,.45)!important}.ant-message-notice-content[data-v-3f82f6f7],.ant-modal-content[data-v-3f82f6f7]{box-shadow:0 4px 12px rgba(1,1,0,.15)!important}.ant-message-notice-content[data-v-3f82f6f7]{padding:6px 10px;font-size:13px}.ant-badge-status-dot[data-v-3f82f6f7]{height:8px!important;width:8px!important}.ant-badge-status-text[data-v-3f82f6f7]{font-size:13px!important}.dashboard-container[data-v-3f82f6f7]{background:#F2F2F2;height:100%;padding:10px}.dashboard-container .count-bar[data-v-3f82f6f7]{border:1px solid #D1D1D1;width:100%;margin-top:10px;display:flex;background:#fff}.dashboard-container .count-bar .count-item[data-v-3f82f6f7]{margin-right:10px;padding:20px;display:flex;flex-direction:column}.dashboard-container .count-bar .count-item[data-v-3f82f6f7]:last-child{margin-right:0}.dashboard-container .count-bar .count-item .title[data-v-3f82f6f7]{cursor:pointer;font-weight:500;margin-bottom:10px;text-decoration:underline}.dashboard-container .count-bar .count-item .value[data-v-3f82f6f7]{font-size:24px}.dashboard-container .list-container[data-v-3f82f6f7]{margin-top:10px;display:flex;flex-wrap:wrap;flex-basis:10px}.dashboard-container .list-container .list-item[data-v-3f82f6f7]{border:1px solid #D1D1D1;flex:1 0 0;margin-right:10px}.dashboard-container .list-container .list-item .title[data-v-3f82f6f7]{border-left:4px solid #3F93C7;padding:2px 6px;background:#F2F2F2}.dashboard-container .list-container .list-item .list[data-v-3f82f6f7]{background:#fff}.dashboard-container .list-container .list-item .list .list-line[data-v-3f82f6f7]{display:flex;padding:4px 8px}.dashboard-container .list-container .list-item .list .list-line>div[data-v-3f82f6f7]{flex:1}
|
1
hera-portal/dist/static/dist/static/css/chunk-2c0a8046.f3e06a79.css
vendored
Normal file
1
hera-portal/dist/static/dist/static/css/chunk-2c0a8046.f3e06a79.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.week-mode{overflow:hidden;filter:invert(80%)}.beauty-scroll{scrollbar-color:#1890ff #bae7ff;scrollbar-width:thin;-ms-overflow-style:none;position:relative}.beauty-scroll::-webkit-scrollbar{width:3px;height:1px}.beauty-scroll::-webkit-scrollbar-thumb{border-radius:3px;background:#1890ff}.beauty-scroll::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 1px rgba(0,0,0,0);border-radius:3px;background:#91d5ff}.split-right:not(:last-child){border-right:1px solid rgba(98,98,98,.2)}.disabled{cursor:not-allowed;color:rgba(0,0,0,.25);pointer-events:none}.ant-input-affix-wrapper:hover .ant-input:not(.ant-input-disabled){border-color:#d9d9d9!important}.ant-input{border-radius:0!important;box-shadow:none!important;font-size:12px}.ant-input:focus,.ant-input:hover{box-shadow:none!important;border-color:#d9d9d9!important}.ant-modal-mask{background-color:rgba(1,1,0,.45)!important}.ant-message-notice-content,.ant-modal-content{box-shadow:0 4px 12px rgba(1,1,0,.15)!important}.ant-message-notice-content{padding:6px 10px;font-size:13px}.ant-badge-status-dot{height:8px!important;width:8px!important}.ant-badge-status-text{font-size:13px!important}.echarts{position:relative;width:100%;height:100%}.week-mode[data-v-063326a6]{overflow:hidden;filter:invert(80%)}.beauty-scroll[data-v-063326a6]{scrollbar-color:#1890ff #bae7ff;scrollbar-width:thin;-ms-overflow-style:none;position:relative}.beauty-scroll[data-v-063326a6]::-webkit-scrollbar{width:3px;height:1px}.beauty-scroll[data-v-063326a6]::-webkit-scrollbar-thumb{border-radius:3px;background:#1890ff}.beauty-scroll[data-v-063326a6]::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 1px rgba(0,0,0,0);border-radius:3px;background:#91d5ff}.split-right[data-v-063326a6]:not(:last-child){border-right:1px solid rgba(98,98,98,.2)}.disabled[data-v-063326a6]{cursor:not-allowed;color:rgba(0,0,0,.25);pointer-events:none}.ant-input-affix-wrapper:hover .ant-input[data-v-063326a6]:not(.ant-input-disabled){border-color:#d9d9d9!important}.ant-input[data-v-063326a6]{border-radius:0!important;box-shadow:none!important;font-size:12px}.ant-input[data-v-063326a6]:focus,.ant-input[data-v-063326a6]:hover{box-shadow:none!important;border-color:#d9d9d9!important}.ant-modal-mask[data-v-063326a6]{background-color:rgba(1,1,0,.45)!important}.ant-message-notice-content[data-v-063326a6],.ant-modal-content[data-v-063326a6]{box-shadow:0 4px 12px rgba(1,1,0,.15)!important}.ant-message-notice-content[data-v-063326a6]{padding:6px 10px;font-size:13px}.ant-badge-status-dot[data-v-063326a6]{height:8px!important;width:8px!important}.ant-badge-status-text[data-v-063326a6]{font-size:13px!important}.dashboard-container[data-v-063326a6]{background-color:#fff;padding:10px}.dashboard-container .infos[data-v-063326a6]{display:flex;flex-direction:column;padding-bottom:0}.dashboard-container .infos .info[data-v-063326a6]{border:1px solid #D1D1D1;background-color:#fff;margin:0 20px 20px 0}.dashboard-container .infos .info .content[data-v-063326a6]{padding:10px;display:flex;align-items:center;justify-content:space-between}.dashboard-container .infos .info .content .texts[data-v-063326a6]{font-size:10px}.dashboard-container .infos .info .content .progress[data-v-063326a6]{border:1px solid #D1D1D1;padding:5px 10px}.dashboard-container .infos .info .content .progress .ant-progress-text[data-v-063326a6]{font-size:9px}.dashboard-container .infos .info .lists .list-tabs[data-v-063326a6]{line-height:25px;height:29px;display:flex;margin-left:10px}.dashboard-container .infos .info .lists .list-tabs .list-tab[data-v-063326a6]{cursor:default;padding:2px 12px;font-size:12px}.dashboard-container .infos .info .lists .list-tabs .list-tab[data-v-063326a6]:hover{background-color:#D9D9D9}.dashboard-container .infos .info .lists .list-tabs .list-tab.active[data-v-063326a6]{border-bottom:2px solid #1890ff!important}.dashboard-container .infos .info .lists .list-content[data-v-063326a6]{padding:10px;text-align:center;display:flex;flex-wrap:wrap;overflow:auto}.dashboard-container .infos .info .lists .list-content .content-item[data-v-063326a6]{font-size:10px;margin:0 10px 10px 0;background-color:#F2F2F2;padding:4px 10px}.dashboard-container .infos .info .title[data-v-063326a6]{padding:4px 6px;background-color:#F2F2F2}.dashboard-container .charts[data-v-063326a6]{height:100%;width:100%;padding-top:0;display:flex;flex-wrap:wrap}.dashboard-container .charts .chart[data-v-063326a6]{margin-right:20px;margin-bottom:20px;border:1px solid #D1D1D1;height:400px;width:100%}.dashboard-container .charts .chart .title[data-v-063326a6]{padding:4px 6px;background-color:#F2F2F2}
|
1
hera-portal/dist/static/dist/static/css/chunk-3fbf594a.872670d8.css
vendored
Normal file
1
hera-portal/dist/static/dist/static/css/chunk-3fbf594a.872670d8.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.week-mode{overflow:hidden;filter:invert(80%)}.beauty-scroll{scrollbar-color:#1890ff #bae7ff;scrollbar-width:thin;-ms-overflow-style:none;position:relative}.beauty-scroll::-webkit-scrollbar{width:3px;height:1px}.beauty-scroll::-webkit-scrollbar-thumb{border-radius:3px;background:#1890ff}.beauty-scroll::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 1px rgba(0,0,0,0);border-radius:3px;background:#91d5ff}.split-right:not(:last-child){border-right:1px solid rgba(98,98,98,.2)}.disabled{cursor:not-allowed;color:rgba(0,0,0,.25);pointer-events:none}.ant-input-affix-wrapper:hover .ant-input:not(.ant-input-disabled){border-color:#d9d9d9!important}.ant-input{border-radius:0!important;box-shadow:none!important;font-size:12px}.ant-input:focus,.ant-input:hover{box-shadow:none!important;border-color:#d9d9d9!important}.ant-modal-mask{background-color:rgba(1,1,0,.45)!important}.ant-message-notice-content,.ant-modal-content{box-shadow:0 4px 12px rgba(1,1,0,.15)!important}.ant-message-notice-content{padding:6px 10px;font-size:13px}.ant-badge-status-dot{height:8px!important;width:8px!important}.ant-badge-status-text{font-size:13px!important}#components-affix-demo-target.scrollable-container{height:100px;overflow-y:scroll}#components-affix-demo-target .background{padding-top:60px;height:300px;background-image:url(https://zos.alipayobjects.com/rmsportal/RmjwQiJorKyobvI.jpg)}.error{color:#D6595D}.hera{color:#1890ff}.console{color:#519B50}.important{color:#f2935e}.clusterize-scroll{max-height:700px;overflow:auto;margin-left:30px}.clusterize-extra-row{margin-top:0!important;margin-bottom:0!important}.clusterize-extra-row.clusterize-keep-parity{display:none}.clusterize-content{outline:0;counter-reset:clusterize-counter}.clusterize-no-data td{text-align:center}
|
1
hera-portal/dist/static/dist/static/css/chunk-479922f1.99564b36.css
vendored
Normal file
1
hera-portal/dist/static/dist/static/css/chunk-479922f1.99564b36.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
hera-portal/dist/static/dist/static/css/chunk-6b04d335.d662f58f.css
vendored
Normal file
1
hera-portal/dist/static/dist/static/css/chunk-6b04d335.d662f58f.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.week-mode{overflow:hidden;filter:invert(80%)}.beauty-scroll{scrollbar-color:#1890ff #bae7ff;scrollbar-width:thin;-ms-overflow-style:none;position:relative}.beauty-scroll::-webkit-scrollbar{width:3px;height:1px}.beauty-scroll::-webkit-scrollbar-thumb{border-radius:3px;background:#1890ff}.beauty-scroll::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 1px rgba(0,0,0,0);border-radius:3px;background:#91d5ff}.split-right:not(:last-child){border-right:1px solid rgba(98,98,98,.2)}.disabled{cursor:not-allowed;color:rgba(0,0,0,.25);pointer-events:none}.ant-input-affix-wrapper:hover .ant-input:not(.ant-input-disabled){border-color:#d9d9d9!important}.ant-input{border-radius:0!important;box-shadow:none!important;font-size:12px}.ant-input:focus,.ant-input:hover{box-shadow:none!important;border-color:#d9d9d9!important}.ant-modal-mask{background-color:rgba(1,1,0,.45)!important}.ant-message-notice-content,.ant-modal-content{box-shadow:0 4px 12px rgba(1,1,0,.15)!important}.ant-message-notice-content{padding:6px 10px;font-size:13px}.ant-badge-status-dot{height:8px!important;width:8px!important}.ant-badge-status-text{font-size:13px!important}.login-container{text-align:center;padding:20px;background:#fff;height:100%}
|
1
hera-portal/dist/static/dist/static/css/chunk-7e62fc8a.14618081.css
vendored
Normal file
1
hera-portal/dist/static/dist/static/css/chunk-7e62fc8a.14618081.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
hera-portal/dist/static/dist/static/css/chunk-8f36fd64.8bf428f3.css
vendored
Normal file
1
hera-portal/dist/static/dist/static/css/chunk-8f36fd64.8bf428f3.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.week-mode{overflow:hidden;filter:invert(80%)}.beauty-scroll{scrollbar-color:#1890ff #bae7ff;scrollbar-width:thin;-ms-overflow-style:none;position:relative}.beauty-scroll::-webkit-scrollbar{width:3px;height:1px}.beauty-scroll::-webkit-scrollbar-thumb{border-radius:3px;background:#1890ff}.beauty-scroll::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 1px rgba(0,0,0,0);border-radius:3px;background:#91d5ff}.split-right:not(:last-child){border-right:1px solid rgba(98,98,98,.2)}.disabled{cursor:not-allowed;color:rgba(0,0,0,.25);pointer-events:none}.ant-input-affix-wrapper:hover .ant-input:not(.ant-input-disabled){border-color:#d9d9d9!important}.ant-input{border-radius:0!important;box-shadow:none!important;font-size:12px}.ant-input:focus,.ant-input:hover{box-shadow:none!important;border-color:#d9d9d9!important}.ant-modal-mask{background-color:rgba(1,1,0,.45)!important}.ant-message-notice-content,.ant-modal-content{box-shadow:0 4px 12px rgba(1,1,0,.15)!important}.ant-message-notice-content{padding:6px 10px;font-size:13px}.ant-badge-status-dot{height:8px!important;width:8px!important}.ant-badge-status-text{font-size:13px!important}.register-container{text-align:center;padding:20px;background:#fff;height:100%}
|
1
hera-portal/dist/static/dist/static/css/chunk-f3d33dcc.6a216b46.css
vendored
Normal file
1
hera-portal/dist/static/dist/static/css/chunk-f3d33dcc.6a216b46.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.week-mode[data-v-74dbfc76]{overflow:hidden;filter:invert(80%)}.beauty-scroll[data-v-74dbfc76]{scrollbar-color:#1890ff #bae7ff;scrollbar-width:thin;-ms-overflow-style:none;position:relative}.beauty-scroll[data-v-74dbfc76]::-webkit-scrollbar{width:3px;height:1px}.beauty-scroll[data-v-74dbfc76]::-webkit-scrollbar-thumb{border-radius:3px;background:#1890ff}.beauty-scroll[data-v-74dbfc76]::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 1px rgba(0,0,0,0);border-radius:3px;background:#91d5ff}.split-right[data-v-74dbfc76]:not(:last-child){border-right:1px solid rgba(98,98,98,.2)}.disabled[data-v-74dbfc76]{cursor:not-allowed;color:rgba(0,0,0,.25);pointer-events:none}.ant-input-affix-wrapper:hover .ant-input[data-v-74dbfc76]:not(.ant-input-disabled){border-color:#d9d9d9!important}.ant-input[data-v-74dbfc76]{border-radius:0!important;box-shadow:none!important;font-size:12px}.ant-input[data-v-74dbfc76]:focus,.ant-input[data-v-74dbfc76]:hover{box-shadow:none!important;border-color:#d9d9d9!important}.ant-modal-mask[data-v-74dbfc76]{background-color:rgba(1,1,0,.45)!important}.ant-message-notice-content[data-v-74dbfc76],.ant-modal-content[data-v-74dbfc76]{box-shadow:0 4px 12px rgba(1,1,0,.15)!important}.ant-message-notice-content[data-v-74dbfc76]{padding:6px 10px;font-size:13px}.ant-badge-status-dot[data-v-74dbfc76]{height:8px!important;width:8px!important}.ant-badge-status-text[data-v-74dbfc76]{font-size:13px!important}.container[data-v-74dbfc76]{display:block!important;height:100%;width:100%}.splitter-pane{padding:0!important;background:#fff}.week-mode{overflow:hidden;filter:invert(80%)}.beauty-scroll{scrollbar-color:#1890ff #bae7ff;scrollbar-width:thin;-ms-overflow-style:none;position:relative}.beauty-scroll::-webkit-scrollbar{width:3px;height:1px}.beauty-scroll::-webkit-scrollbar-thumb{border-radius:3px;background:#1890ff}.beauty-scroll::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 1px rgba(0,0,0,0);border-radius:3px;background:#91d5ff}.split-right:not(:last-child){border-right:1px solid rgba(98,98,98,.2)}.disabled{cursor:not-allowed;color:rgba(0,0,0,.25);pointer-events:none}.ant-input-affix-wrapper:hover .ant-input:not(.ant-input-disabled){border-color:#d9d9d9!important}.ant-input{border-radius:0!important;box-shadow:none!important;font-size:12px}.ant-input:focus,.ant-input:hover{box-shadow:none!important;border-color:#d9d9d9!important}.ant-modal-mask{background-color:rgba(1,1,0,.45)!important}.ant-message-notice-content,.ant-modal-content{box-shadow:0 4px 12px rgba(1,1,0,.15)!important}.ant-message-notice-content{padding:6px 10px;font-size:13px}.ant-badge-status-dot{height:8px!important;width:8px!important}.ant-badge-status-text{font-size:13px!important}.job-trend{height:100%;border:1px solid #D1D1D1;background:#fff;margin-top:10px}.job-trend .title{border-left:4px solid #3F93C7;background:#F2F2F2;margin-bottom:10px;padding:6px 12px}.job-trend .op-container{margin-bottom:6px;display:flex;align-items:center}.job-trend .header{width:100vh;margin-bottom:4px}.job-trend .track-container{border:1px solid #D1D1D1;width:100%;height:calc(100% - 95px)}.job-trend .track-container .track-log{overflow:hidden;background:#fff;height:100%}.job-trend .track-container .track-log .time{padding:0 10px;color:#3F93C7}.job-trend .track-container .track-log .content{border-top:1px solid #D1D1D1;padding-top:0;overflow:auto;height:100%;height:calc(100% - 59px)}.job-trend .track-container .track-log .content .active{background:#F2F2F2;font-weight:600}.job-trend .track-container .track-log .content .log{display:flex;justify-content:flex-start}.job-trend .track-container .track-log .content .log .lines{display:flex;flex-direction:column}.job-trend .track-container .track-graph{background:#fff;height:100%}.job-trend .track-container .track-graph .edgePath path{stroke:#606266;fill:#333;stroke-width:1.5px}.job-trend .track-container .track-graph .node rect{stroke:#606266;stroke-width:1;fill:#fff}
|
1
hera-portal/dist/static/dist/static/js/app.ec796b21.js
vendored
Normal file
1
hera-portal/dist/static/dist/static/js/app.ec796b21.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
hera-portal/dist/static/dist/static/js/chunk-25a9dc80.0bf21b87.js
vendored
Normal file
1
hera-portal/dist/static/dist/static/js/chunk-25a9dc80.0bf21b87.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
hera-portal/dist/static/dist/static/js/chunk-25f2d318.95b8dc79.js
vendored
Normal file
1
hera-portal/dist/static/dist/static/js/chunk-25f2d318.95b8dc79.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
hera-portal/dist/static/dist/static/js/chunk-2c0a8046.a67f9bee.js
vendored
Normal file
1
hera-portal/dist/static/dist/static/js/chunk-2c0a8046.a67f9bee.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
hera-portal/dist/static/dist/static/js/chunk-3fbf594a.3748f5ba.js
vendored
Normal file
1
hera-portal/dist/static/dist/static/js/chunk-3fbf594a.3748f5ba.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
hera-portal/dist/static/dist/static/js/chunk-479922f1.97d5dcbd.js
vendored
Normal file
6
hera-portal/dist/static/dist/static/js/chunk-479922f1.97d5dcbd.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
hera-portal/dist/static/dist/static/js/chunk-6b04d335.46b4346a.js
vendored
Normal file
1
hera-portal/dist/static/dist/static/js/chunk-6b04d335.46b4346a.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-6b04d335"],{"5fee":function(t,e,r){},e383:function(t,e,r){"use strict";r("5fee")},efcf:function(t,e,r){"use strict";r.r(e);var o=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"login-container"},[r("div",{staticStyle:{width:"400px",margin:"16vh auto"}},[r("img",{staticStyle:{height:"100px",margin:"10px"},attrs:{src:t.$store.getters["setting/logo"]}}),r("a-form-model",{attrs:{model:t.form},on:{submit:t.handleSubmit},nativeOn:{submit:function(t){t.preventDefault()}}},[r("a-form-model-item",[r("a-input",{attrs:{placeholder:"用户名"},model:{value:t.form.username,callback:function(e){t.$set(t.form,"username",e)},expression:"form.username"}},[r("a-icon",{staticStyle:{color:"rgba(0,0,0,.25)"},attrs:{slot:"prefix",type:"username"},slot:"prefix"})],1)],1),r("a-form-model-item",[r("a-input",{attrs:{type:"password",placeholder:"密码"},model:{value:t.form.password,callback:function(e){t.$set(t.form,"password",e)},expression:"form.password"}},[r("a-icon",{staticStyle:{color:"rgba(0,0,0,.25)"},attrs:{slot:"prefix",type:"lock"},slot:"prefix"})],1)],1),r("a-form-model-item",[r("a-button",{staticStyle:{"margin-right":"10px"},on:{click:function(e){return t.$router.push({name:"register"})}}},[t._v(" 注册 ")]),r("a-button",{attrs:{type:"primary","html-type":"submit",disabled:""===t.form.username||""===t.form.password}},[t._v(" 登陆 ")])],1)],1)],1)])},a=[],s=r("bfb4"),n={data:function(){return{redirect:null,form:{usernamename:"",password:""}}},created:function(){var t;this.redirect=null===(t=this.$route.params)||void 0===t?void 0:t.redirect},methods:{handleSubmit:function(){var t=this;Object(s["l"])(this.form).then((function(){t.$router.push(t.redirect||{path:"/"})}))}}},i=n,l=(r("e383"),r("2877")),u=Object(l["a"])(i,o,a,!1,null,null,null);e["default"]=u.exports}}]);
|
7
hera-portal/dist/static/dist/static/js/chunk-7e62fc8a.615c43bd.js
vendored
Normal file
7
hera-portal/dist/static/dist/static/js/chunk-7e62fc8a.615c43bd.js
vendored
Normal file
File diff suppressed because one or more lines are too long
10
hera-portal/dist/static/dist/static/js/chunk-8f36fd64.f6e06e91.js
vendored
Normal file
10
hera-portal/dist/static/dist/static/js/chunk-8f36fd64.f6e06e91.js
vendored
Normal file
File diff suppressed because one or more lines are too long
24
hera-portal/dist/static/dist/static/js/chunk-f3d33dcc.0e306798.js
vendored
Normal file
24
hera-portal/dist/static/dist/static/js/chunk-f3d33dcc.0e306798.js
vendored
Normal file
File diff suppressed because one or more lines are too long
307
hera-portal/dist/static/dist/static/js/chunk-vendors.b1976808.js
vendored
Normal file
307
hera-portal/dist/static/dist/static/js/chunk-vendors.b1976808.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
hera-portal/node_modules/.bin/sql-formatter
generated
vendored
Symbolic link
1
hera-portal/node_modules/.bin/sql-formatter
generated
vendored
Symbolic link
@ -0,0 +1 @@
|
||||
../sql-formatter/bin/sqlfmt.js
|
11
hera-portal/node_modules/clusterize.js/LICENSE
generated
vendored
Normal file
11
hera-portal/node_modules/clusterize.js/LICENSE
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
The GPLv3 License (GPLv3)
|
||||
|
||||
Copyright (c) 2015 Denis Lukov
|
||||
|
||||
Commercial license
|
||||
|
||||
If you want to use Clusterize.js to develop commercial sites, themes, projects, and applications, the Commercial license is the appropriate license. With this option, your source code is kept proprietary. Purchase a Clusterize.js Commercial License at uplabs.com/posts/clusterize-js-commercial-license
|
||||
|
||||
Open source license
|
||||
|
||||
If you are creating an open source application under a license compatible with the GNU GPL license v3, you may use this project under the terms of the GPLv3.
|
11
hera-portal/node_modules/clusterize.js/README.md
generated
vendored
Normal file
11
hera-portal/node_modules/clusterize.js/README.md
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# Clusterize.js
|
||||
[](https://www.npmjs.com/package/clusterize.js)
|
||||
[](http://bower.io/search/?q=clusterize)
|
||||
[](http://packagequality.com/#?package=clusterize.js)
|
||||
[](https://gitter.im/NeXTs/Clusterize.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
> Tiny vanilla JS plugin to display large data sets easily
|
||||
|
||||
[Demo, usage, etc…](https://clusterize.js.org/)
|
||||
|
||||
[](https://clusterize.js.org/)
|
19
hera-portal/node_modules/clusterize.js/bower.json
generated
vendored
Normal file
19
hera-portal/node_modules/clusterize.js/bower.json
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "clusterize",
|
||||
"description": "Tiny vanilla JS plugin to display large data sets easily",
|
||||
"main": [
|
||||
"clusterize.js", "clusterize.css"
|
||||
],
|
||||
"ignore": [],
|
||||
"moduleType": [
|
||||
"globals", "amd", "commonjs"
|
||||
],
|
||||
"keywords": [
|
||||
"large", "table", "list", "scroll", "grid", "cluster"
|
||||
],
|
||||
"authors": [
|
||||
"Denis Lukov"
|
||||
],
|
||||
"license": "GPLv3",
|
||||
"homepage": "https://github.com/NeXTs/Clusterize.js"
|
||||
}
|
38
hera-portal/node_modules/clusterize.js/clusterize.css
generated
vendored
Normal file
38
hera-portal/node_modules/clusterize.js/clusterize.css
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
/* max-height - the only parameter in this file that needs to be edited.
|
||||
* Change it to suit your needs. The rest is recommended to leave as is.
|
||||
*/
|
||||
.clusterize-scroll{
|
||||
max-height: 200px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Avoid vertical margins for extra tags
|
||||
* Necessary for correct calculations when rows have nonzero vertical margins
|
||||
*/
|
||||
.clusterize-extra-row{
|
||||
margin-top: 0 !important;
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
/* By default extra tag .clusterize-keep-parity added to keep parity of rows.
|
||||
* Useful when used :nth-child(even/odd)
|
||||
*/
|
||||
.clusterize-extra-row.clusterize-keep-parity{
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* During initialization clusterize adds tabindex to force the browser to keep focus
|
||||
* on the scrolling list, see issue #11
|
||||
* Outline removes default browser's borders for focused elements.
|
||||
*/
|
||||
.clusterize-content{
|
||||
outline: 0;
|
||||
counter-reset: clusterize-counter;
|
||||
}
|
||||
|
||||
/* Centering message that appears when no data provided
|
||||
*/
|
||||
.clusterize-no-data td{
|
||||
text-align: center;
|
||||
}
|
331
hera-portal/node_modules/clusterize.js/clusterize.js
generated
vendored
Normal file
331
hera-portal/node_modules/clusterize.js/clusterize.js
generated
vendored
Normal file
@ -0,0 +1,331 @@
|
||||
/* Clusterize.js - v0.18.1 - 2018-01-02
|
||||
http://NeXTs.github.com/Clusterize.js/
|
||||
Copyright (c) 2015 Denis Lukov; Licensed GPLv3 */
|
||||
|
||||
;(function(name, definition) {
|
||||
if (typeof module != 'undefined') module.exports = definition();
|
||||
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition);
|
||||
else this[name] = definition();
|
||||
}('Clusterize', function() {
|
||||
"use strict"
|
||||
|
||||
// detect ie9 and lower
|
||||
// https://gist.github.com/padolsey/527683#comment-786682
|
||||
var ie = (function(){
|
||||
for( var v = 3,
|
||||
el = document.createElement('b'),
|
||||
all = el.all || [];
|
||||
el.innerHTML = '<!--[if gt IE ' + (++v) + ']><i><![endif]-->',
|
||||
all[0];
|
||||
){}
|
||||
return v > 4 ? v : document.documentMode;
|
||||
}()),
|
||||
is_mac = navigator.platform.toLowerCase().indexOf('mac') + 1;
|
||||
var Clusterize = function(data) {
|
||||
if( ! (this instanceof Clusterize))
|
||||
return new Clusterize(data);
|
||||
var self = this;
|
||||
|
||||
var defaults = {
|
||||
rows_in_block: 50,
|
||||
blocks_in_cluster: 4,
|
||||
tag: null,
|
||||
show_no_data_row: true,
|
||||
no_data_class: 'clusterize-no-data',
|
||||
no_data_text: 'No data',
|
||||
keep_parity: true,
|
||||
callbacks: {}
|
||||
}
|
||||
|
||||
// public parameters
|
||||
self.options = {};
|
||||
var options = ['rows_in_block', 'blocks_in_cluster', 'show_no_data_row', 'no_data_class', 'no_data_text', 'keep_parity', 'tag', 'callbacks'];
|
||||
for(var i = 0, option; option = options[i]; i++) {
|
||||
self.options[option] = typeof data[option] != 'undefined' && data[option] != null
|
||||
? data[option]
|
||||
: defaults[option];
|
||||
}
|
||||
|
||||
var elems = ['scroll', 'content'];
|
||||
for(var i = 0, elem; elem = elems[i]; i++) {
|
||||
self[elem + '_elem'] = data[elem + 'Id']
|
||||
? document.getElementById(data[elem + 'Id'])
|
||||
: data[elem + 'Elem'];
|
||||
if( ! self[elem + '_elem'])
|
||||
throw new Error("Error! Could not find " + elem + " element");
|
||||
}
|
||||
|
||||
// tabindex forces the browser to keep focus on the scrolling list, fixes #11
|
||||
if( ! self.content_elem.hasAttribute('tabindex'))
|
||||
self.content_elem.setAttribute('tabindex', 0);
|
||||
|
||||
// private parameters
|
||||
var rows = isArray(data.rows)
|
||||
? data.rows
|
||||
: self.fetchMarkup(),
|
||||
cache = {},
|
||||
scroll_top = self.scroll_elem.scrollTop;
|
||||
|
||||
// append initial data
|
||||
self.insertToDOM(rows, cache);
|
||||
|
||||
// restore the scroll position
|
||||
self.scroll_elem.scrollTop = scroll_top;
|
||||
|
||||
// adding scroll handler
|
||||
var last_cluster = false,
|
||||
scroll_debounce = 0,
|
||||
pointer_events_set = false,
|
||||
scrollEv = function() {
|
||||
// fixes scrolling issue on Mac #3
|
||||
if (is_mac) {
|
||||
if( ! pointer_events_set) self.content_elem.style.pointerEvents = 'none';
|
||||
pointer_events_set = true;
|
||||
clearTimeout(scroll_debounce);
|
||||
scroll_debounce = setTimeout(function () {
|
||||
self.content_elem.style.pointerEvents = 'auto';
|
||||
pointer_events_set = false;
|
||||
}, 50);
|
||||
}
|
||||
if (last_cluster != (last_cluster = self.getClusterNum()))
|
||||
self.insertToDOM(rows, cache);
|
||||
if (self.options.callbacks.scrollingProgress)
|
||||
self.options.callbacks.scrollingProgress(self.getScrollProgress());
|
||||
},
|
||||
resize_debounce = 0,
|
||||
resizeEv = function() {
|
||||
clearTimeout(resize_debounce);
|
||||
resize_debounce = setTimeout(self.refresh, 100);
|
||||
}
|
||||
on('scroll', self.scroll_elem, scrollEv);
|
||||
on('resize', window, resizeEv);
|
||||
|
||||
// public methods
|
||||
self.destroy = function(clean) {
|
||||
off('scroll', self.scroll_elem, scrollEv);
|
||||
off('resize', window, resizeEv);
|
||||
self.html((clean ? self.generateEmptyRow() : rows).join(''));
|
||||
}
|
||||
self.refresh = function(force) {
|
||||
if(self.getRowsHeight(rows) || force) self.update(rows);
|
||||
}
|
||||
self.update = function(new_rows) {
|
||||
rows = isArray(new_rows)
|
||||
? new_rows
|
||||
: [];
|
||||
var scroll_top = self.scroll_elem.scrollTop;
|
||||
// fixes #39
|
||||
if(rows.length * self.options.item_height < scroll_top) {
|
||||
self.scroll_elem.scrollTop = 0;
|
||||
last_cluster = 0;
|
||||
}
|
||||
self.insertToDOM(rows, cache);
|
||||
self.scroll_elem.scrollTop = scroll_top;
|
||||
}
|
||||
self.clear = function() {
|
||||
self.update([]);
|
||||
}
|
||||
self.getRowsAmount = function() {
|
||||
return rows.length;
|
||||
}
|
||||
self.getScrollProgress = function() {
|
||||
return this.options.scroll_top / (rows.length * this.options.item_height) * 100 || 0;
|
||||
}
|
||||
|
||||
var add = function(where, _new_rows) {
|
||||
var new_rows = isArray(_new_rows)
|
||||
? _new_rows
|
||||
: [];
|
||||
if( ! new_rows.length) return;
|
||||
rows = where == 'append'
|
||||
? rows.concat(new_rows)
|
||||
: new_rows.concat(rows);
|
||||
self.insertToDOM(rows, cache);
|
||||
}
|
||||
self.append = function(rows) {
|
||||
add('append', rows);
|
||||
}
|
||||
self.prepend = function(rows) {
|
||||
add('prepend', rows);
|
||||
}
|
||||
}
|
||||
|
||||
Clusterize.prototype = {
|
||||
constructor: Clusterize,
|
||||
// fetch existing markup
|
||||
fetchMarkup: function() {
|
||||
var rows = [], rows_nodes = this.getChildNodes(this.content_elem);
|
||||
while (rows_nodes.length) {
|
||||
rows.push(rows_nodes.shift().outerHTML);
|
||||
}
|
||||
return rows;
|
||||
},
|
||||
// get tag name, content tag name, tag height, calc cluster height
|
||||
exploreEnvironment: function(rows, cache) {
|
||||
var opts = this.options;
|
||||
opts.content_tag = this.content_elem.tagName.toLowerCase();
|
||||
if( ! rows.length) return;
|
||||
if(ie && ie <= 9 && ! opts.tag) opts.tag = rows[0].match(/<([^>\s/]*)/)[1].toLowerCase();
|
||||
if(this.content_elem.children.length <= 1) cache.data = this.html(rows[0] + rows[0] + rows[0]);
|
||||
if( ! opts.tag) opts.tag = this.content_elem.children[0].tagName.toLowerCase();
|
||||
this.getRowsHeight(rows);
|
||||
},
|
||||
getRowsHeight: function(rows) {
|
||||
var opts = this.options,
|
||||
prev_item_height = opts.item_height;
|
||||
opts.cluster_height = 0;
|
||||
if( ! rows.length) return;
|
||||
var nodes = this.content_elem.children;
|
||||
if( ! nodes.length) return;
|
||||
var node = nodes[Math.floor(nodes.length / 2)];
|
||||
opts.item_height = node.offsetHeight;
|
||||
// consider table's border-spacing
|
||||
if(opts.tag == 'tr' && getStyle('borderCollapse', this.content_elem) != 'collapse')
|
||||
opts.item_height += parseInt(getStyle('borderSpacing', this.content_elem), 10) || 0;
|
||||
// consider margins (and margins collapsing)
|
||||
if(opts.tag != 'tr') {
|
||||
var marginTop = parseInt(getStyle('marginTop', node), 10) || 0;
|
||||
var marginBottom = parseInt(getStyle('marginBottom', node), 10) || 0;
|
||||
opts.item_height += Math.max(marginTop, marginBottom);
|
||||
}
|
||||
opts.block_height = opts.item_height * opts.rows_in_block;
|
||||
opts.rows_in_cluster = opts.blocks_in_cluster * opts.rows_in_block;
|
||||
opts.cluster_height = opts.blocks_in_cluster * opts.block_height;
|
||||
return prev_item_height != opts.item_height;
|
||||
},
|
||||
// get current cluster number
|
||||
getClusterNum: function () {
|
||||
this.options.scroll_top = this.scroll_elem.scrollTop;
|
||||
return Math.floor(this.options.scroll_top / (this.options.cluster_height - this.options.block_height)) || 0;
|
||||
},
|
||||
// generate empty row if no data provided
|
||||
generateEmptyRow: function() {
|
||||
var opts = this.options;
|
||||
if( ! opts.tag || ! opts.show_no_data_row) return [];
|
||||
var empty_row = document.createElement(opts.tag),
|
||||
no_data_content = document.createTextNode(opts.no_data_text), td;
|
||||
empty_row.className = opts.no_data_class;
|
||||
if(opts.tag == 'tr') {
|
||||
td = document.createElement('td');
|
||||
// fixes #53
|
||||
td.colSpan = 100;
|
||||
td.appendChild(no_data_content);
|
||||
}
|
||||
empty_row.appendChild(td || no_data_content);
|
||||
return [empty_row.outerHTML];
|
||||
},
|
||||
// generate cluster for current scroll position
|
||||
generate: function (rows, cluster_num) {
|
||||
var opts = this.options,
|
||||
rows_len = rows.length;
|
||||
if (rows_len < opts.rows_in_block) {
|
||||
return {
|
||||
top_offset: 0,
|
||||
bottom_offset: 0,
|
||||
rows_above: 0,
|
||||
rows: rows_len ? rows : this.generateEmptyRow()
|
||||
}
|
||||
}
|
||||
var items_start = Math.max((opts.rows_in_cluster - opts.rows_in_block) * cluster_num, 0),
|
||||
items_end = items_start + opts.rows_in_cluster,
|
||||
top_offset = Math.max(items_start * opts.item_height, 0),
|
||||
bottom_offset = Math.max((rows_len - items_end) * opts.item_height, 0),
|
||||
this_cluster_rows = [],
|
||||
rows_above = items_start;
|
||||
if(top_offset < 1) {
|
||||
rows_above++;
|
||||
}
|
||||
for (var i = items_start; i < items_end; i++) {
|
||||
rows[i] && this_cluster_rows.push(rows[i]);
|
||||
}
|
||||
return {
|
||||
top_offset: top_offset,
|
||||
bottom_offset: bottom_offset,
|
||||
rows_above: rows_above,
|
||||
rows: this_cluster_rows
|
||||
}
|
||||
},
|
||||
renderExtraTag: function(class_name, height) {
|
||||
var tag = document.createElement(this.options.tag),
|
||||
clusterize_prefix = 'clusterize-';
|
||||
tag.className = [clusterize_prefix + 'extra-row', clusterize_prefix + class_name].join(' ');
|
||||
height && (tag.style.height = height + 'px');
|
||||
return tag.outerHTML;
|
||||
},
|
||||
// if necessary verify data changed and insert to DOM
|
||||
insertToDOM: function(rows, cache) {
|
||||
// explore row's height
|
||||
if( ! this.options.cluster_height) {
|
||||
this.exploreEnvironment(rows, cache);
|
||||
}
|
||||
var data = this.generate(rows, this.getClusterNum()),
|
||||
this_cluster_rows = data.rows.join(''),
|
||||
this_cluster_content_changed = this.checkChanges('data', this_cluster_rows, cache),
|
||||
top_offset_changed = this.checkChanges('top', data.top_offset, cache),
|
||||
only_bottom_offset_changed = this.checkChanges('bottom', data.bottom_offset, cache),
|
||||
callbacks = this.options.callbacks,
|
||||
layout = [];
|
||||
|
||||
if(this_cluster_content_changed || top_offset_changed) {
|
||||
if(data.top_offset) {
|
||||
this.options.keep_parity && layout.push(this.renderExtraTag('keep-parity'));
|
||||
layout.push(this.renderExtraTag('top-space', data.top_offset));
|
||||
}
|
||||
layout.push(this_cluster_rows);
|
||||
data.bottom_offset && layout.push(this.renderExtraTag('bottom-space', data.bottom_offset));
|
||||
callbacks.clusterWillChange && callbacks.clusterWillChange();
|
||||
this.html(layout.join(''));
|
||||
this.options.content_tag == 'ol' && this.content_elem.setAttribute('start', data.rows_above);
|
||||
this.content_elem.style['counter-increment'] = 'clusterize-counter ' + (data.rows_above-1);
|
||||
callbacks.clusterChanged && callbacks.clusterChanged();
|
||||
} else if(only_bottom_offset_changed) {
|
||||
this.content_elem.lastChild.style.height = data.bottom_offset + 'px';
|
||||
}
|
||||
},
|
||||
// unfortunately ie <= 9 does not allow to use innerHTML for table elements, so make a workaround
|
||||
html: function(data) {
|
||||
var content_elem = this.content_elem;
|
||||
if(ie && ie <= 9 && this.options.tag == 'tr') {
|
||||
var div = document.createElement('div'), last;
|
||||
div.innerHTML = '<table><tbody>' + data + '</tbody></table>';
|
||||
while((last = content_elem.lastChild)) {
|
||||
content_elem.removeChild(last);
|
||||
}
|
||||
var rows_nodes = this.getChildNodes(div.firstChild.firstChild);
|
||||
while (rows_nodes.length) {
|
||||
content_elem.appendChild(rows_nodes.shift());
|
||||
}
|
||||
} else {
|
||||
content_elem.innerHTML = data;
|
||||
}
|
||||
},
|
||||
getChildNodes: function(tag) {
|
||||
var child_nodes = tag.children, nodes = [];
|
||||
for (var i = 0, ii = child_nodes.length; i < ii; i++) {
|
||||
nodes.push(child_nodes[i]);
|
||||
}
|
||||
return nodes;
|
||||
},
|
||||
checkChanges: function(type, value, cache) {
|
||||
var changed = value != cache[type];
|
||||
cache[type] = value;
|
||||
return changed;
|
||||
}
|
||||
}
|
||||
|
||||
// support functions
|
||||
function on(evt, element, fnc) {
|
||||
return element.addEventListener ? element.addEventListener(evt, fnc, false) : element.attachEvent("on" + evt, fnc);
|
||||
}
|
||||
function off(evt, element, fnc) {
|
||||
return element.removeEventListener ? element.removeEventListener(evt, fnc, false) : element.detachEvent("on" + evt, fnc);
|
||||
}
|
||||
function isArray(arr) {
|
||||
return Object.prototype.toString.call(arr) === '[object Array]';
|
||||
}
|
||||
function getStyle(prop, elem) {
|
||||
return window.getComputedStyle ? window.getComputedStyle(elem)[prop] : elem.currentStyle[prop];
|
||||
}
|
||||
|
||||
return Clusterize;
|
||||
}));
|
17
hera-portal/node_modules/clusterize.js/clusterize.min.js
generated
vendored
Normal file
17
hera-portal/node_modules/clusterize.js/clusterize.min.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/* Clusterize.js - v0.18.1 - 2018-01-02
|
||||
http://NeXTs.github.com/Clusterize.js/
|
||||
Copyright (c) 2015 Denis Lukov; Licensed GPLv3 */
|
||||
|
||||
;(function(q,n){"undefined"!=typeof module?module.exports=n():"function"==typeof define&&"object"==typeof define.amd?define(n):this[q]=n()})("Clusterize",function(){function q(b,a,c){return a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent("on"+b,c)}function n(b,a,c){return a.removeEventListener?a.removeEventListener(b,c,!1):a.detachEvent("on"+b,c)}function r(b){return"[object Array]"===Object.prototype.toString.call(b)}function m(b,a){return window.getComputedStyle?window.getComputedStyle(a)[b]:
|
||||
a.currentStyle[b]}var l=function(){for(var b=3,a=document.createElement("b"),c=a.all||[];a.innerHTML="\x3c!--[if gt IE "+ ++b+"]><i><![endif]--\x3e",c[0];);return 4<b?b:document.documentMode}(),x=navigator.platform.toLowerCase().indexOf("mac")+1,p=function(b){if(!(this instanceof p))return new p(b);var a=this,c={rows_in_block:50,blocks_in_cluster:4,tag:null,show_no_data_row:!0,no_data_class:"clusterize-no-data",no_data_text:"No data",keep_parity:!0,callbacks:{}};a.options={};for(var d="rows_in_block blocks_in_cluster show_no_data_row no_data_class no_data_text keep_parity tag callbacks".split(" "),
|
||||
f=0,h;h=d[f];f++)a.options[h]="undefined"!=typeof b[h]&&null!=b[h]?b[h]:c[h];c=["scroll","content"];for(f=0;d=c[f];f++)if(a[d+"_elem"]=b[d+"Id"]?document.getElementById(b[d+"Id"]):b[d+"Elem"],!a[d+"_elem"])throw Error("Error! Could not find "+d+" element");a.content_elem.hasAttribute("tabindex")||a.content_elem.setAttribute("tabindex",0);var e=r(b.rows)?b.rows:a.fetchMarkup(),g={};b=a.scroll_elem.scrollTop;a.insertToDOM(e,g);a.scroll_elem.scrollTop=b;var k=!1,m=0,l=!1,t=function(){x&&(l||(a.content_elem.style.pointerEvents=
|
||||
"none"),l=!0,clearTimeout(m),m=setTimeout(function(){a.content_elem.style.pointerEvents="auto";l=!1},50));k!=(k=a.getClusterNum())&&a.insertToDOM(e,g);a.options.callbacks.scrollingProgress&&a.options.callbacks.scrollingProgress(a.getScrollProgress())},u=0,v=function(){clearTimeout(u);u=setTimeout(a.refresh,100)};q("scroll",a.scroll_elem,t);q("resize",window,v);a.destroy=function(b){n("scroll",a.scroll_elem,t);n("resize",window,v);a.html((b?a.generateEmptyRow():e).join(""))};a.refresh=function(b){(a.getRowsHeight(e)||
|
||||
b)&&a.update(e)};a.update=function(b){e=r(b)?b:[];b=a.scroll_elem.scrollTop;e.length*a.options.item_height<b&&(k=a.scroll_elem.scrollTop=0);a.insertToDOM(e,g);a.scroll_elem.scrollTop=b};a.clear=function(){a.update([])};a.getRowsAmount=function(){return e.length};a.getScrollProgress=function(){return this.options.scroll_top/(e.length*this.options.item_height)*100||0};var w=function(b,c){var d=r(c)?c:[];d.length&&(e="append"==b?e.concat(d):d.concat(e),a.insertToDOM(e,g))};a.append=function(a){w("append",
|
||||
a)};a.prepend=function(a){w("prepend",a)}};p.prototype={constructor:p,fetchMarkup:function(){for(var b=[],a=this.getChildNodes(this.content_elem);a.length;)b.push(a.shift().outerHTML);return b},exploreEnvironment:function(b,a){var c=this.options;c.content_tag=this.content_elem.tagName.toLowerCase();b.length&&(l&&9>=l&&!c.tag&&(c.tag=b[0].match(/<([^>\s/]*)/)[1].toLowerCase()),1>=this.content_elem.children.length&&(a.data=this.html(b[0]+b[0]+b[0])),c.tag||(c.tag=this.content_elem.children[0].tagName.toLowerCase()),
|
||||
this.getRowsHeight(b))},getRowsHeight:function(b){var a=this.options,c=a.item_height;a.cluster_height=0;if(b.length&&(b=this.content_elem.children,b.length)){var d=b[Math.floor(b.length/2)];a.item_height=d.offsetHeight;"tr"==a.tag&&"collapse"!=m("borderCollapse",this.content_elem)&&(a.item_height+=parseInt(m("borderSpacing",this.content_elem),10)||0);"tr"!=a.tag&&(b=parseInt(m("marginTop",d),10)||0,d=parseInt(m("marginBottom",d),10)||0,a.item_height+=Math.max(b,d));a.block_height=a.item_height*a.rows_in_block;
|
||||
a.rows_in_cluster=a.blocks_in_cluster*a.rows_in_block;a.cluster_height=a.blocks_in_cluster*a.block_height;return c!=a.item_height}},getClusterNum:function(){this.options.scroll_top=this.scroll_elem.scrollTop;return Math.floor(this.options.scroll_top/(this.options.cluster_height-this.options.block_height))||0},generateEmptyRow:function(){var b=this.options;if(!b.tag||!b.show_no_data_row)return[];var a=document.createElement(b.tag),c=document.createTextNode(b.no_data_text);a.className=b.no_data_class;
|
||||
if("tr"==b.tag){var d=document.createElement("td");d.colSpan=100;d.appendChild(c)}a.appendChild(d||c);return[a.outerHTML]},generate:function(b,a){var c=this.options,d=b.length;if(d<c.rows_in_block)return{top_offset:0,bottom_offset:0,rows_above:0,rows:d?b:this.generateEmptyRow()};var f=Math.max((c.rows_in_cluster-c.rows_in_block)*a,0),h=f+c.rows_in_cluster,e=Math.max(f*c.item_height,0);c=Math.max((d-h)*c.item_height,0);d=[];var g=f;for(1>e&&g++;f<h;f++)b[f]&&d.push(b[f]);return{top_offset:e,bottom_offset:c,
|
||||
rows_above:g,rows:d}},renderExtraTag:function(b,a){var c=document.createElement(this.options.tag);c.className=["clusterize-extra-row","clusterize-"+b].join(" ");a&&(c.style.height=a+"px");return c.outerHTML},insertToDOM:function(b,a){this.options.cluster_height||this.exploreEnvironment(b,a);var c=this.generate(b,this.getClusterNum()),d=c.rows.join(""),f=this.checkChanges("data",d,a),h=this.checkChanges("top",c.top_offset,a),e=this.checkChanges("bottom",c.bottom_offset,a),g=this.options.callbacks,
|
||||
k=[];f||h?(c.top_offset&&(this.options.keep_parity&&k.push(this.renderExtraTag("keep-parity")),k.push(this.renderExtraTag("top-space",c.top_offset))),k.push(d),c.bottom_offset&&k.push(this.renderExtraTag("bottom-space",c.bottom_offset)),g.clusterWillChange&&g.clusterWillChange(),this.html(k.join("")),"ol"==this.options.content_tag&&this.content_elem.setAttribute("start",c.rows_above),this.content_elem.style["counter-increment"]="clusterize-counter "+(c.rows_above-1),g.clusterChanged&&g.clusterChanged()):
|
||||
e&&(this.content_elem.lastChild.style.height=c.bottom_offset+"px")},html:function(b){var a=this.content_elem;if(l&&9>=l&&"tr"==this.options.tag){var c=document.createElement("div");for(c.innerHTML="<table><tbody>"+b+"</tbody></table>";b=a.lastChild;)a.removeChild(b);for(c=this.getChildNodes(c.firstChild.firstChild);c.length;)a.appendChild(c.shift())}else a.innerHTML=b},getChildNodes:function(b){b=b.children;for(var a=[],c=0,d=b.length;c<d;c++)a.push(b[c]);return a},checkChanges:function(b,a,c){var d=
|
||||
a!=c[b];c[b]=a;return d}};return p});
|
30
hera-portal/node_modules/clusterize.js/externs.js
generated
vendored
Normal file
30
hera-portal/node_modules/clusterize.js/externs.js
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @fileoverview Closure Compiler externs for Clusterize.js 0.16.0.
|
||||
* @see https://developers.google.com/closure/compiler/docs/api-tutorial3
|
||||
* @externs
|
||||
*/
|
||||
|
||||
var Clusterize = {
|
||||
"scroll_elem": {},
|
||||
"content_elem": {},
|
||||
"tag": {},
|
||||
"rows_in_block": {},
|
||||
"blocks_in_cluster": {},
|
||||
"show_no_data_row": {},
|
||||
"no_data_text": {},
|
||||
"no_data_class": {},
|
||||
"keep_parity": {},
|
||||
"callbacks": {
|
||||
"clusterWillChange": function() {},
|
||||
"clusterChanged": function() {},
|
||||
"scrollingProgress": function() {}
|
||||
},
|
||||
"update": function() {},
|
||||
"append": function() {},
|
||||
"prepend": function() {},
|
||||
"refresh": function() {},
|
||||
"getRowsAmount": function() {},
|
||||
"getScrollProgress": function() {},
|
||||
"clear": function() {},
|
||||
"destroy": function() {}
|
||||
}
|
55
hera-portal/node_modules/clusterize.js/package.json
generated
vendored
Normal file
55
hera-portal/node_modules/clusterize.js/package.json
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
"_from": "clusterize.js",
|
||||
"_id": "clusterize.js@0.18.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-UsLhW2lG3TaTnE8LI7ninvovua3FLrlsbksb9uzx0fVzzV2WFScO5FU/4yFwdM8RW8iuYVWFraBpDjsosReFlg==",
|
||||
"_location": "/clusterize.js",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "clusterize.js",
|
||||
"name": "clusterize.js",
|
||||
"escapedName": "clusterize.js",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/clusterize.js/-/clusterize.js-0.18.1.tgz",
|
||||
"_shasum": "a286a9749bd1fa9c2fe21b7fabd8780a590dd836",
|
||||
"_spec": "clusterize.js",
|
||||
"_where": "/Users/scx/work/git/person/hera_tuya/hera-portal",
|
||||
"author": {
|
||||
"name": "Denis Lukov"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/NeXTs/Clusterize.js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Tiny vanilla JS plugin to display large data sets easily",
|
||||
"homepage": "https://github.com/NeXTs/Clusterize.js",
|
||||
"keywords": [
|
||||
"large",
|
||||
"vanillajs",
|
||||
"table",
|
||||
"grid",
|
||||
"list",
|
||||
"scroll",
|
||||
"cluster"
|
||||
],
|
||||
"license": "GPLv3",
|
||||
"main": "clusterize.js",
|
||||
"name": "clusterize.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/NeXTs/Clusterize.js.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"style": "clusterize.css",
|
||||
"version": "0.18.1"
|
||||
}
|
101
hera-portal/node_modules/js-md5/CHANGELOG.md
generated
vendored
Normal file
101
hera-portal/node_modules/js-md5/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
# Change Log
|
||||
|
||||
## v0.7.3 / 2017-12-18
|
||||
### Fixed
|
||||
- incorrect result when first bit is 1 of bytes. #18
|
||||
|
||||
## v0.7.2 / 2017-10-31
|
||||
### Improved
|
||||
- performance of hBytes increment.
|
||||
|
||||
## v0.7.1 / 2017-10-29
|
||||
### Fixed
|
||||
- incorrect result when file size >= 4G.
|
||||
|
||||
## v0.7.0 / 2017-10-29
|
||||
### Fixed
|
||||
- incorrect result when file size >= 512M.
|
||||
|
||||
## v0.6.1 / 2017-10-07
|
||||
### Fixed
|
||||
- ArrayBuffer.isView issue in IE10.
|
||||
|
||||
### Improved
|
||||
- performance of input check.
|
||||
|
||||
## v0.6.0 / 2017-07-28
|
||||
### Added
|
||||
- support base64 string output.
|
||||
|
||||
## v0.5.0 / 2017-07-14
|
||||
### Added
|
||||
- support for web worker. #11
|
||||
|
||||
### Changed
|
||||
- throw error if input type is incorrect.
|
||||
- prevent webpack to require dependencies.
|
||||
|
||||
## v0.4.2 / 2017-01-18
|
||||
### Fixed
|
||||
- `root` is undefined in some special environment. #7
|
||||
|
||||
## v0.4.1 / 2016-03-31
|
||||
### Removed
|
||||
- length detection in node.js.
|
||||
### Deprecated
|
||||
- `buffer` and replace by `arrayBuffer`.
|
||||
|
||||
## v0.4.0 / 2015-12-28
|
||||
### Added
|
||||
- support for update hash.
|
||||
- support for bytes array output.
|
||||
- support for ArrayBuffer output.
|
||||
- support for AMD.
|
||||
|
||||
## v0.3.0 / 2015-03-07
|
||||
### Added
|
||||
- support byte Array, Uint8Array and ArrayBuffer input.
|
||||
|
||||
## v0.2.2 / 2015-02-01
|
||||
### Fixed
|
||||
- bug when special length.
|
||||
### Improve
|
||||
- performance for node.js.
|
||||
|
||||
## v0.2.1 / 2015-01-13
|
||||
### Improve
|
||||
- performance.
|
||||
|
||||
## v0.2.0 / 2015-01-12
|
||||
### Removed
|
||||
- ascii parameter.
|
||||
### Improve
|
||||
- performance.
|
||||
|
||||
## v0.1.4 / 2015-01-11
|
||||
### Improve
|
||||
- performance.
|
||||
### Added
|
||||
- test cases.
|
||||
|
||||
## v0.1.3 / 2015-01-05
|
||||
### Added
|
||||
- bower package.
|
||||
- travis.
|
||||
- coveralls.
|
||||
### Improved
|
||||
- performance.
|
||||
### Fixed
|
||||
- JSHint warnings.
|
||||
|
||||
## v0.1.2 / 2014-07-27
|
||||
### Fixed
|
||||
- accents bug
|
||||
|
||||
## v0.1.1 / 2014-01-05
|
||||
### Changed
|
||||
- license
|
||||
|
||||
## v0.1.0 / 2014-01-04
|
||||
### Added
|
||||
- initial release
|
20
hera-portal/node_modules/js-md5/LICENSE.txt
generated
vendored
Normal file
20
hera-portal/node_modules/js-md5/LICENSE.txt
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
Copyright 2014-2017 Chen, Yi-Cyuan
|
||||
|
||||
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.
|
76
hera-portal/node_modules/js-md5/README.md
generated
vendored
Normal file
76
hera-portal/node_modules/js-md5/README.md
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
# js-md5
|
||||
[](https://travis-ci.org/emn178/js-md5)
|
||||
[](https://coveralls.io/r/emn178/js-md5?branch=master)
|
||||
[](https://nodei.co/npm/js-md5/)
|
||||
|
||||
A simple MD5 hash function for JavaScript supports UTF-8 encoding.
|
||||
|
||||
## Demo
|
||||
[MD5 Online](http://emn178.github.io/online-tools/md5.html)
|
||||
[MD5 File Checksum Online](http://emn178.github.io/online-tools/md5_checksum.html)
|
||||
|
||||
## Download
|
||||
[Compress](https://raw.github.com/emn178/js-md5/master/build/md5.min.js)
|
||||
[Uncompress](https://raw.github.com/emn178/js-md5/master/src/md5.js)
|
||||
|
||||
## Installation
|
||||
You can also install js-md5 by using Bower.
|
||||
|
||||
bower install md5
|
||||
|
||||
For node.js, you can use this command to install:
|
||||
|
||||
npm install js-md5
|
||||
|
||||
## Notice
|
||||
`buffer` method is deprecated. This maybe confuse with Buffer in node.js. Please use `arrayBuffer` instead.
|
||||
|
||||
## Usage
|
||||
You could use like this:
|
||||
```JavaScript
|
||||
md5('Message to hash');
|
||||
var hash = md5.create();
|
||||
hash.update('Message to hash');
|
||||
hash.hex();
|
||||
```
|
||||
If you use node.js, you should require the module first:
|
||||
```JavaScript
|
||||
md5 = require('js-md5');
|
||||
```
|
||||
It supports AMD:
|
||||
```JavaScript
|
||||
require(['your/path/md5.js'], function(md5) {
|
||||
// ...
|
||||
});
|
||||
```
|
||||
[See document](https://emn178.github.com/js-md5/doc/)
|
||||
|
||||
## Example
|
||||
```JavaScript
|
||||
md5(''); // d41d8cd98f00b204e9800998ecf8427e
|
||||
md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6
|
||||
md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0
|
||||
|
||||
// It also supports UTF-8 encoding
|
||||
md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07
|
||||
|
||||
// It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
|
||||
md5([]); // d41d8cd98f00b204e9800998ecf8427e
|
||||
md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e
|
||||
|
||||
// Different output
|
||||
md5(''); // d41d8cd98f00b204e9800998ecf8427e
|
||||
md5.hex(''); // d41d8cd98f00b204e9800998ecf8427e
|
||||
md5.array(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
|
||||
md5.digest(''); // [212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66, 126]
|
||||
md5.arrayBuffer(''); // ArrayBuffer
|
||||
md5.buffer(''); // ArrayBuffer, deprecated, This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
|
||||
md5.base64(''); // 1B2M2Y8AsgTpgAmY7PhCfg==
|
||||
```
|
||||
|
||||
## License
|
||||
The project is released under the [MIT license](http://www.opensource.org/licenses/MIT).
|
||||
|
||||
## Contact
|
||||
The project's website is located at https://github.com/emn178/js-md5
|
||||
Author: Chen, Yi-Cyuan (emn178@gmail.com)
|
10
hera-portal/node_modules/js-md5/build/md5.min.js
generated
vendored
Normal file
10
hera-portal/node_modules/js-md5/build/md5.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
73
hera-portal/node_modules/js-md5/package.json
generated
vendored
Normal file
73
hera-portal/node_modules/js-md5/package.json
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
{
|
||||
"_from": "js-md5@^0.7.3",
|
||||
"_id": "js-md5@0.7.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ZC41vPSTLKGwIRjqDh8DfXoCrdQIyBgspJVPXHBGu4nZlAEvG3nf+jO9avM9RmLiGakg7vz974ms99nEV0tmTQ==",
|
||||
"_location": "/js-md5",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "js-md5@^0.7.3",
|
||||
"name": "js-md5",
|
||||
"escapedName": "js-md5",
|
||||
"rawSpec": "^0.7.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.7.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/js-md5/-/js-md5-0.7.3.tgz",
|
||||
"_shasum": "b4f2fbb0b327455f598d6727e38ec272cd09c3f2",
|
||||
"_spec": "js-md5@^0.7.3",
|
||||
"_where": "/Users/scx/work/git/person/hera_tuya/hera-portal",
|
||||
"author": {
|
||||
"name": "Chen, Yi-Cyuan",
|
||||
"email": "emn178@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/emn178/js-md5/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "A simple MD5 hash function for JavaScript supports UTF-8 encoding.",
|
||||
"devDependencies": {
|
||||
"expect.js": "~0.3.1",
|
||||
"jsdoc": "^3.4.0",
|
||||
"mocha": "~2.3.4",
|
||||
"nyc": "^11.3.0",
|
||||
"requirejs": "^2.1.22",
|
||||
"uglify-js": "^3.1.9",
|
||||
"webworker-threads": "^0.7.11"
|
||||
},
|
||||
"homepage": "https://github.com/emn178/js-md5",
|
||||
"keywords": [
|
||||
"md5",
|
||||
"hash",
|
||||
"encryption",
|
||||
"cryptography",
|
||||
"HMAC"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "src/md5.js",
|
||||
"name": "js-md5",
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"tests"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/emn178/js-md5.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run-script compress;npm run-script doc",
|
||||
"compress": "uglifyjs src/md5.js -c -m eval --comments --output build/md5.min.js",
|
||||
"coveralls": "nyc report --reporter=text-lcov | coveralls",
|
||||
"doc": "rm -rf doc;jsdoc src README.md -d doc",
|
||||
"report": "nyc --reporter=html --reporter=text mocha tests/node-test.js",
|
||||
"test": "nyc mocha tests/node-test.js"
|
||||
},
|
||||
"version": "0.7.3"
|
||||
}
|
683
hera-portal/node_modules/js-md5/src/md5.js
generated
vendored
Normal file
683
hera-portal/node_modules/js-md5/src/md5.js
generated
vendored
Normal file
@ -0,0 +1,683 @@
|
||||
/**
|
||||
* [js-md5]{@link https://github.com/emn178/js-md5}
|
||||
*
|
||||
* @namespace md5
|
||||
* @version 0.7.3
|
||||
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
||||
* @copyright Chen, Yi-Cyuan 2014-2017
|
||||
* @license MIT
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
var ERROR = 'input is invalid type';
|
||||
var WINDOW = typeof window === 'object';
|
||||
var root = WINDOW ? window : {};
|
||||
if (root.JS_MD5_NO_WINDOW) {
|
||||
WINDOW = false;
|
||||
}
|
||||
var WEB_WORKER = !WINDOW && typeof self === 'object';
|
||||
var NODE_JS = !root.JS_MD5_NO_NODE_JS && typeof process === 'object' && process.versions && process.versions.node;
|
||||
if (NODE_JS) {
|
||||
root = global;
|
||||
} else if (WEB_WORKER) {
|
||||
root = self;
|
||||
}
|
||||
var COMMON_JS = !root.JS_MD5_NO_COMMON_JS && typeof module === 'object' && module.exports;
|
||||
var AMD = typeof define === 'function' && define.amd;
|
||||
var ARRAY_BUFFER = !root.JS_MD5_NO_ARRAY_BUFFER && typeof ArrayBuffer !== 'undefined';
|
||||
var HEX_CHARS = '0123456789abcdef'.split('');
|
||||
var EXTRA = [128, 32768, 8388608, -2147483648];
|
||||
var SHIFT = [0, 8, 16, 24];
|
||||
var OUTPUT_TYPES = ['hex', 'array', 'digest', 'buffer', 'arrayBuffer', 'base64'];
|
||||
var BASE64_ENCODE_CHAR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
|
||||
|
||||
var blocks = [], buffer8;
|
||||
if (ARRAY_BUFFER) {
|
||||
var buffer = new ArrayBuffer(68);
|
||||
buffer8 = new Uint8Array(buffer);
|
||||
blocks = new Uint32Array(buffer);
|
||||
}
|
||||
|
||||
if (root.JS_MD5_NO_NODE_JS || !Array.isArray) {
|
||||
Array.isArray = function (obj) {
|
||||
return Object.prototype.toString.call(obj) === '[object Array]';
|
||||
};
|
||||
}
|
||||
|
||||
if (ARRAY_BUFFER && (root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW || !ArrayBuffer.isView)) {
|
||||
ArrayBuffer.isView = function (obj) {
|
||||
return typeof obj === 'object' && obj.buffer && obj.buffer.constructor === ArrayBuffer;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @method hex
|
||||
* @memberof md5
|
||||
* @description Output hash as hex string
|
||||
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
|
||||
* @returns {String} Hex string
|
||||
* @example
|
||||
* md5.hex('The quick brown fox jumps over the lazy dog');
|
||||
* // equal to
|
||||
* md5('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
/**
|
||||
* @method digest
|
||||
* @memberof md5
|
||||
* @description Output hash as bytes array
|
||||
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
|
||||
* @returns {Array} Bytes array
|
||||
* @example
|
||||
* md5.digest('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
/**
|
||||
* @method array
|
||||
* @memberof md5
|
||||
* @description Output hash as bytes array
|
||||
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
|
||||
* @returns {Array} Bytes array
|
||||
* @example
|
||||
* md5.array('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
/**
|
||||
* @method arrayBuffer
|
||||
* @memberof md5
|
||||
* @description Output hash as ArrayBuffer
|
||||
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
|
||||
* @returns {ArrayBuffer} ArrayBuffer
|
||||
* @example
|
||||
* md5.arrayBuffer('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
/**
|
||||
* @method buffer
|
||||
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
|
||||
* @memberof md5
|
||||
* @description Output hash as ArrayBuffer
|
||||
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
|
||||
* @returns {ArrayBuffer} ArrayBuffer
|
||||
* @example
|
||||
* md5.buffer('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
/**
|
||||
* @method base64
|
||||
* @memberof md5
|
||||
* @description Output hash as base64 string
|
||||
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
|
||||
* @returns {String} base64 string
|
||||
* @example
|
||||
* md5.base64('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
var createOutputMethod = function (outputType) {
|
||||
return function (message) {
|
||||
return new Md5(true).update(message)[outputType]();
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* @method create
|
||||
* @memberof md5
|
||||
* @description Create Md5 object
|
||||
* @returns {Md5} Md5 object.
|
||||
* @example
|
||||
* var hash = md5.create();
|
||||
*/
|
||||
/**
|
||||
* @method update
|
||||
* @memberof md5
|
||||
* @description Create and update Md5 object
|
||||
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
|
||||
* @returns {Md5} Md5 object.
|
||||
* @example
|
||||
* var hash = md5.update('The quick brown fox jumps over the lazy dog');
|
||||
* // equal to
|
||||
* var hash = md5.create();
|
||||
* hash.update('The quick brown fox jumps over the lazy dog');
|
||||
*/
|
||||
var createMethod = function () {
|
||||
var method = createOutputMethod('hex');
|
||||
if (NODE_JS) {
|
||||
method = nodeWrap(method);
|
||||
}
|
||||
method.create = function () {
|
||||
return new Md5();
|
||||
};
|
||||
method.update = function (message) {
|
||||
return method.create().update(message);
|
||||
};
|
||||
for (var i = 0; i < OUTPUT_TYPES.length; ++i) {
|
||||
var type = OUTPUT_TYPES[i];
|
||||
method[type] = createOutputMethod(type);
|
||||
}
|
||||
return method;
|
||||
};
|
||||
|
||||
var nodeWrap = function (method) {
|
||||
var crypto = eval("require('crypto')");
|
||||
var Buffer = eval("require('buffer').Buffer");
|
||||
var nodeMethod = function (message) {
|
||||
if (typeof message === 'string') {
|
||||
return crypto.createHash('md5').update(message, 'utf8').digest('hex');
|
||||
} else {
|
||||
if (message === null || message === undefined) {
|
||||
throw ERROR;
|
||||
} else if (message.constructor === ArrayBuffer) {
|
||||
message = new Uint8Array(message);
|
||||
}
|
||||
}
|
||||
if (Array.isArray(message) || ArrayBuffer.isView(message) ||
|
||||
message.constructor === Buffer) {
|
||||
return crypto.createHash('md5').update(new Buffer(message)).digest('hex');
|
||||
} else {
|
||||
return method(message);
|
||||
}
|
||||
};
|
||||
return nodeMethod;
|
||||
};
|
||||
|
||||
/**
|
||||
* Md5 class
|
||||
* @class Md5
|
||||
* @description This is internal class.
|
||||
* @see {@link md5.create}
|
||||
*/
|
||||
function Md5(sharedMemory) {
|
||||
if (sharedMemory) {
|
||||
blocks[0] = blocks[16] = blocks[1] = blocks[2] = blocks[3] =
|
||||
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
|
||||
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
|
||||
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
||||
this.blocks = blocks;
|
||||
this.buffer8 = buffer8;
|
||||
} else {
|
||||
if (ARRAY_BUFFER) {
|
||||
var buffer = new ArrayBuffer(68);
|
||||
this.buffer8 = new Uint8Array(buffer);
|
||||
this.blocks = new Uint32Array(buffer);
|
||||
} else {
|
||||
this.blocks = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
|
||||
}
|
||||
}
|
||||
this.h0 = this.h1 = this.h2 = this.h3 = this.start = this.bytes = this.hBytes = 0;
|
||||
this.finalized = this.hashed = false;
|
||||
this.first = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @method update
|
||||
* @memberof Md5
|
||||
* @instance
|
||||
* @description Update hash
|
||||
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
|
||||
* @returns {Md5} Md5 object.
|
||||
* @see {@link md5.update}
|
||||
*/
|
||||
Md5.prototype.update = function (message) {
|
||||
if (this.finalized) {
|
||||
return;
|
||||
}
|
||||
|
||||
var notString, type = typeof message;
|
||||
if (type !== 'string') {
|
||||
if (type === 'object') {
|
||||
if (message === null) {
|
||||
throw ERROR;
|
||||
} else if (ARRAY_BUFFER && message.constructor === ArrayBuffer) {
|
||||
message = new Uint8Array(message);
|
||||
} else if (!Array.isArray(message)) {
|
||||
if (!ARRAY_BUFFER || !ArrayBuffer.isView(message)) {
|
||||
throw ERROR;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw ERROR;
|
||||
}
|
||||
notString = true;
|
||||
}
|
||||
var code, index = 0, i, length = message.length, blocks = this.blocks;
|
||||
var buffer8 = this.buffer8;
|
||||
|
||||
while (index < length) {
|
||||
if (this.hashed) {
|
||||
this.hashed = false;
|
||||
blocks[0] = blocks[16];
|
||||
blocks[16] = blocks[1] = blocks[2] = blocks[3] =
|
||||
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
|
||||
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
|
||||
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
||||
}
|
||||
|
||||
if (notString) {
|
||||
if (ARRAY_BUFFER) {
|
||||
for (i = this.start; index < length && i < 64; ++index) {
|
||||
buffer8[i++] = message[index];
|
||||
}
|
||||
} else {
|
||||
for (i = this.start; index < length && i < 64; ++index) {
|
||||
blocks[i >> 2] |= message[index] << SHIFT[i++ & 3];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ARRAY_BUFFER) {
|
||||
for (i = this.start; index < length && i < 64; ++index) {
|
||||
code = message.charCodeAt(index);
|
||||
if (code < 0x80) {
|
||||
buffer8[i++] = code;
|
||||
} else if (code < 0x800) {
|
||||
buffer8[i++] = 0xc0 | (code >> 6);
|
||||
buffer8[i++] = 0x80 | (code & 0x3f);
|
||||
} else if (code < 0xd800 || code >= 0xe000) {
|
||||
buffer8[i++] = 0xe0 | (code >> 12);
|
||||
buffer8[i++] = 0x80 | ((code >> 6) & 0x3f);
|
||||
buffer8[i++] = 0x80 | (code & 0x3f);
|
||||
} else {
|
||||
code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
|
||||
buffer8[i++] = 0xf0 | (code >> 18);
|
||||
buffer8[i++] = 0x80 | ((code >> 12) & 0x3f);
|
||||
buffer8[i++] = 0x80 | ((code >> 6) & 0x3f);
|
||||
buffer8[i++] = 0x80 | (code & 0x3f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = this.start; index < length && i < 64; ++index) {
|
||||
code = message.charCodeAt(index);
|
||||
if (code < 0x80) {
|
||||
blocks[i >> 2] |= code << SHIFT[i++ & 3];
|
||||
} else if (code < 0x800) {
|
||||
blocks[i >> 2] |= (0xc0 | (code >> 6)) << SHIFT[i++ & 3];
|
||||
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
|
||||
} else if (code < 0xd800 || code >= 0xe000) {
|
||||
blocks[i >> 2] |= (0xe0 | (code >> 12)) << SHIFT[i++ & 3];
|
||||
blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
|
||||
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
|
||||
} else {
|
||||
code = 0x10000 + (((code & 0x3ff) << 10) | (message.charCodeAt(++index) & 0x3ff));
|
||||
blocks[i >> 2] |= (0xf0 | (code >> 18)) << SHIFT[i++ & 3];
|
||||
blocks[i >> 2] |= (0x80 | ((code >> 12) & 0x3f)) << SHIFT[i++ & 3];
|
||||
blocks[i >> 2] |= (0x80 | ((code >> 6) & 0x3f)) << SHIFT[i++ & 3];
|
||||
blocks[i >> 2] |= (0x80 | (code & 0x3f)) << SHIFT[i++ & 3];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.lastByteIndex = i;
|
||||
this.bytes += i - this.start;
|
||||
if (i >= 64) {
|
||||
this.start = i - 64;
|
||||
this.hash();
|
||||
this.hashed = true;
|
||||
} else {
|
||||
this.start = i;
|
||||
}
|
||||
}
|
||||
if (this.bytes > 4294967295) {
|
||||
this.hBytes += this.bytes / 4294967296 << 0;
|
||||
this.bytes = this.bytes % 4294967296;
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
Md5.prototype.finalize = function () {
|
||||
if (this.finalized) {
|
||||
return;
|
||||
}
|
||||
this.finalized = true;
|
||||
var blocks = this.blocks, i = this.lastByteIndex;
|
||||
blocks[i >> 2] |= EXTRA[i & 3];
|
||||
if (i >= 56) {
|
||||
if (!this.hashed) {
|
||||
this.hash();
|
||||
}
|
||||
blocks[0] = blocks[16];
|
||||
blocks[16] = blocks[1] = blocks[2] = blocks[3] =
|
||||
blocks[4] = blocks[5] = blocks[6] = blocks[7] =
|
||||
blocks[8] = blocks[9] = blocks[10] = blocks[11] =
|
||||
blocks[12] = blocks[13] = blocks[14] = blocks[15] = 0;
|
||||
}
|
||||
blocks[14] = this.bytes << 3;
|
||||
blocks[15] = this.hBytes << 3 | this.bytes >>> 29;
|
||||
this.hash();
|
||||
};
|
||||
|
||||
Md5.prototype.hash = function () {
|
||||
var a, b, c, d, bc, da, blocks = this.blocks;
|
||||
|
||||
if (this.first) {
|
||||
a = blocks[0] - 680876937;
|
||||
a = (a << 7 | a >>> 25) - 271733879 << 0;
|
||||
d = (-1732584194 ^ a & 2004318071) + blocks[1] - 117830708;
|
||||
d = (d << 12 | d >>> 20) + a << 0;
|
||||
c = (-271733879 ^ (d & (a ^ -271733879))) + blocks[2] - 1126478375;
|
||||
c = (c << 17 | c >>> 15) + d << 0;
|
||||
b = (a ^ (c & (d ^ a))) + blocks[3] - 1316259209;
|
||||
b = (b << 22 | b >>> 10) + c << 0;
|
||||
} else {
|
||||
a = this.h0;
|
||||
b = this.h1;
|
||||
c = this.h2;
|
||||
d = this.h3;
|
||||
a += (d ^ (b & (c ^ d))) + blocks[0] - 680876936;
|
||||
a = (a << 7 | a >>> 25) + b << 0;
|
||||
d += (c ^ (a & (b ^ c))) + blocks[1] - 389564586;
|
||||
d = (d << 12 | d >>> 20) + a << 0;
|
||||
c += (b ^ (d & (a ^ b))) + blocks[2] + 606105819;
|
||||
c = (c << 17 | c >>> 15) + d << 0;
|
||||
b += (a ^ (c & (d ^ a))) + blocks[3] - 1044525330;
|
||||
b = (b << 22 | b >>> 10) + c << 0;
|
||||
}
|
||||
|
||||
a += (d ^ (b & (c ^ d))) + blocks[4] - 176418897;
|
||||
a = (a << 7 | a >>> 25) + b << 0;
|
||||
d += (c ^ (a & (b ^ c))) + blocks[5] + 1200080426;
|
||||
d = (d << 12 | d >>> 20) + a << 0;
|
||||
c += (b ^ (d & (a ^ b))) + blocks[6] - 1473231341;
|
||||
c = (c << 17 | c >>> 15) + d << 0;
|
||||
b += (a ^ (c & (d ^ a))) + blocks[7] - 45705983;
|
||||
b = (b << 22 | b >>> 10) + c << 0;
|
||||
a += (d ^ (b & (c ^ d))) + blocks[8] + 1770035416;
|
||||
a = (a << 7 | a >>> 25) + b << 0;
|
||||
d += (c ^ (a & (b ^ c))) + blocks[9] - 1958414417;
|
||||
d = (d << 12 | d >>> 20) + a << 0;
|
||||
c += (b ^ (d & (a ^ b))) + blocks[10] - 42063;
|
||||
c = (c << 17 | c >>> 15) + d << 0;
|
||||
b += (a ^ (c & (d ^ a))) + blocks[11] - 1990404162;
|
||||
b = (b << 22 | b >>> 10) + c << 0;
|
||||
a += (d ^ (b & (c ^ d))) + blocks[12] + 1804603682;
|
||||
a = (a << 7 | a >>> 25) + b << 0;
|
||||
d += (c ^ (a & (b ^ c))) + blocks[13] - 40341101;
|
||||
d = (d << 12 | d >>> 20) + a << 0;
|
||||
c += (b ^ (d & (a ^ b))) + blocks[14] - 1502002290;
|
||||
c = (c << 17 | c >>> 15) + d << 0;
|
||||
b += (a ^ (c & (d ^ a))) + blocks[15] + 1236535329;
|
||||
b = (b << 22 | b >>> 10) + c << 0;
|
||||
a += (c ^ (d & (b ^ c))) + blocks[1] - 165796510;
|
||||
a = (a << 5 | a >>> 27) + b << 0;
|
||||
d += (b ^ (c & (a ^ b))) + blocks[6] - 1069501632;
|
||||
d = (d << 9 | d >>> 23) + a << 0;
|
||||
c += (a ^ (b & (d ^ a))) + blocks[11] + 643717713;
|
||||
c = (c << 14 | c >>> 18) + d << 0;
|
||||
b += (d ^ (a & (c ^ d))) + blocks[0] - 373897302;
|
||||
b = (b << 20 | b >>> 12) + c << 0;
|
||||
a += (c ^ (d & (b ^ c))) + blocks[5] - 701558691;
|
||||
a = (a << 5 | a >>> 27) + b << 0;
|
||||
d += (b ^ (c & (a ^ b))) + blocks[10] + 38016083;
|
||||
d = (d << 9 | d >>> 23) + a << 0;
|
||||
c += (a ^ (b & (d ^ a))) + blocks[15] - 660478335;
|
||||
c = (c << 14 | c >>> 18) + d << 0;
|
||||
b += (d ^ (a & (c ^ d))) + blocks[4] - 405537848;
|
||||
b = (b << 20 | b >>> 12) + c << 0;
|
||||
a += (c ^ (d & (b ^ c))) + blocks[9] + 568446438;
|
||||
a = (a << 5 | a >>> 27) + b << 0;
|
||||
d += (b ^ (c & (a ^ b))) + blocks[14] - 1019803690;
|
||||
d = (d << 9 | d >>> 23) + a << 0;
|
||||
c += (a ^ (b & (d ^ a))) + blocks[3] - 187363961;
|
||||
c = (c << 14 | c >>> 18) + d << 0;
|
||||
b += (d ^ (a & (c ^ d))) + blocks[8] + 1163531501;
|
||||
b = (b << 20 | b >>> 12) + c << 0;
|
||||
a += (c ^ (d & (b ^ c))) + blocks[13] - 1444681467;
|
||||
a = (a << 5 | a >>> 27) + b << 0;
|
||||
d += (b ^ (c & (a ^ b))) + blocks[2] - 51403784;
|
||||
d = (d << 9 | d >>> 23) + a << 0;
|
||||
c += (a ^ (b & (d ^ a))) + blocks[7] + 1735328473;
|
||||
c = (c << 14 | c >>> 18) + d << 0;
|
||||
b += (d ^ (a & (c ^ d))) + blocks[12] - 1926607734;
|
||||
b = (b << 20 | b >>> 12) + c << 0;
|
||||
bc = b ^ c;
|
||||
a += (bc ^ d) + blocks[5] - 378558;
|
||||
a = (a << 4 | a >>> 28) + b << 0;
|
||||
d += (bc ^ a) + blocks[8] - 2022574463;
|
||||
d = (d << 11 | d >>> 21) + a << 0;
|
||||
da = d ^ a;
|
||||
c += (da ^ b) + blocks[11] + 1839030562;
|
||||
c = (c << 16 | c >>> 16) + d << 0;
|
||||
b += (da ^ c) + blocks[14] - 35309556;
|
||||
b = (b << 23 | b >>> 9) + c << 0;
|
||||
bc = b ^ c;
|
||||
a += (bc ^ d) + blocks[1] - 1530992060;
|
||||
a = (a << 4 | a >>> 28) + b << 0;
|
||||
d += (bc ^ a) + blocks[4] + 1272893353;
|
||||
d = (d << 11 | d >>> 21) + a << 0;
|
||||
da = d ^ a;
|
||||
c += (da ^ b) + blocks[7] - 155497632;
|
||||
c = (c << 16 | c >>> 16) + d << 0;
|
||||
b += (da ^ c) + blocks[10] - 1094730640;
|
||||
b = (b << 23 | b >>> 9) + c << 0;
|
||||
bc = b ^ c;
|
||||
a += (bc ^ d) + blocks[13] + 681279174;
|
||||
a = (a << 4 | a >>> 28) + b << 0;
|
||||
d += (bc ^ a) + blocks[0] - 358537222;
|
||||
d = (d << 11 | d >>> 21) + a << 0;
|
||||
da = d ^ a;
|
||||
c += (da ^ b) + blocks[3] - 722521979;
|
||||
c = (c << 16 | c >>> 16) + d << 0;
|
||||
b += (da ^ c) + blocks[6] + 76029189;
|
||||
b = (b << 23 | b >>> 9) + c << 0;
|
||||
bc = b ^ c;
|
||||
a += (bc ^ d) + blocks[9] - 640364487;
|
||||
a = (a << 4 | a >>> 28) + b << 0;
|
||||
d += (bc ^ a) + blocks[12] - 421815835;
|
||||
d = (d << 11 | d >>> 21) + a << 0;
|
||||
da = d ^ a;
|
||||
c += (da ^ b) + blocks[15] + 530742520;
|
||||
c = (c << 16 | c >>> 16) + d << 0;
|
||||
b += (da ^ c) + blocks[2] - 995338651;
|
||||
b = (b << 23 | b >>> 9) + c << 0;
|
||||
a += (c ^ (b | ~d)) + blocks[0] - 198630844;
|
||||
a = (a << 6 | a >>> 26) + b << 0;
|
||||
d += (b ^ (a | ~c)) + blocks[7] + 1126891415;
|
||||
d = (d << 10 | d >>> 22) + a << 0;
|
||||
c += (a ^ (d | ~b)) + blocks[14] - 1416354905;
|
||||
c = (c << 15 | c >>> 17) + d << 0;
|
||||
b += (d ^ (c | ~a)) + blocks[5] - 57434055;
|
||||
b = (b << 21 | b >>> 11) + c << 0;
|
||||
a += (c ^ (b | ~d)) + blocks[12] + 1700485571;
|
||||
a = (a << 6 | a >>> 26) + b << 0;
|
||||
d += (b ^ (a | ~c)) + blocks[3] - 1894986606;
|
||||
d = (d << 10 | d >>> 22) + a << 0;
|
||||
c += (a ^ (d | ~b)) + blocks[10] - 1051523;
|
||||
c = (c << 15 | c >>> 17) + d << 0;
|
||||
b += (d ^ (c | ~a)) + blocks[1] - 2054922799;
|
||||
b = (b << 21 | b >>> 11) + c << 0;
|
||||
a += (c ^ (b | ~d)) + blocks[8] + 1873313359;
|
||||
a = (a << 6 | a >>> 26) + b << 0;
|
||||
d += (b ^ (a | ~c)) + blocks[15] - 30611744;
|
||||
d = (d << 10 | d >>> 22) + a << 0;
|
||||
c += (a ^ (d | ~b)) + blocks[6] - 1560198380;
|
||||
c = (c << 15 | c >>> 17) + d << 0;
|
||||
b += (d ^ (c | ~a)) + blocks[13] + 1309151649;
|
||||
b = (b << 21 | b >>> 11) + c << 0;
|
||||
a += (c ^ (b | ~d)) + blocks[4] - 145523070;
|
||||
a = (a << 6 | a >>> 26) + b << 0;
|
||||
d += (b ^ (a | ~c)) + blocks[11] - 1120210379;
|
||||
d = (d << 10 | d >>> 22) + a << 0;
|
||||
c += (a ^ (d | ~b)) + blocks[2] + 718787259;
|
||||
c = (c << 15 | c >>> 17) + d << 0;
|
||||
b += (d ^ (c | ~a)) + blocks[9] - 343485551;
|
||||
b = (b << 21 | b >>> 11) + c << 0;
|
||||
|
||||
if (this.first) {
|
||||
this.h0 = a + 1732584193 << 0;
|
||||
this.h1 = b - 271733879 << 0;
|
||||
this.h2 = c - 1732584194 << 0;
|
||||
this.h3 = d + 271733878 << 0;
|
||||
this.first = false;
|
||||
} else {
|
||||
this.h0 = this.h0 + a << 0;
|
||||
this.h1 = this.h1 + b << 0;
|
||||
this.h2 = this.h2 + c << 0;
|
||||
this.h3 = this.h3 + d << 0;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @method hex
|
||||
* @memberof Md5
|
||||
* @instance
|
||||
* @description Output hash as hex string
|
||||
* @returns {String} Hex string
|
||||
* @see {@link md5.hex}
|
||||
* @example
|
||||
* hash.hex();
|
||||
*/
|
||||
Md5.prototype.hex = function () {
|
||||
this.finalize();
|
||||
|
||||
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
|
||||
|
||||
return HEX_CHARS[(h0 >> 4) & 0x0F] + HEX_CHARS[h0 & 0x0F] +
|
||||
HEX_CHARS[(h0 >> 12) & 0x0F] + HEX_CHARS[(h0 >> 8) & 0x0F] +
|
||||
HEX_CHARS[(h0 >> 20) & 0x0F] + HEX_CHARS[(h0 >> 16) & 0x0F] +
|
||||
HEX_CHARS[(h0 >> 28) & 0x0F] + HEX_CHARS[(h0 >> 24) & 0x0F] +
|
||||
HEX_CHARS[(h1 >> 4) & 0x0F] + HEX_CHARS[h1 & 0x0F] +
|
||||
HEX_CHARS[(h1 >> 12) & 0x0F] + HEX_CHARS[(h1 >> 8) & 0x0F] +
|
||||
HEX_CHARS[(h1 >> 20) & 0x0F] + HEX_CHARS[(h1 >> 16) & 0x0F] +
|
||||
HEX_CHARS[(h1 >> 28) & 0x0F] + HEX_CHARS[(h1 >> 24) & 0x0F] +
|
||||
HEX_CHARS[(h2 >> 4) & 0x0F] + HEX_CHARS[h2 & 0x0F] +
|
||||
HEX_CHARS[(h2 >> 12) & 0x0F] + HEX_CHARS[(h2 >> 8) & 0x0F] +
|
||||
HEX_CHARS[(h2 >> 20) & 0x0F] + HEX_CHARS[(h2 >> 16) & 0x0F] +
|
||||
HEX_CHARS[(h2 >> 28) & 0x0F] + HEX_CHARS[(h2 >> 24) & 0x0F] +
|
||||
HEX_CHARS[(h3 >> 4) & 0x0F] + HEX_CHARS[h3 & 0x0F] +
|
||||
HEX_CHARS[(h3 >> 12) & 0x0F] + HEX_CHARS[(h3 >> 8) & 0x0F] +
|
||||
HEX_CHARS[(h3 >> 20) & 0x0F] + HEX_CHARS[(h3 >> 16) & 0x0F] +
|
||||
HEX_CHARS[(h3 >> 28) & 0x0F] + HEX_CHARS[(h3 >> 24) & 0x0F];
|
||||
};
|
||||
|
||||
/**
|
||||
* @method toString
|
||||
* @memberof Md5
|
||||
* @instance
|
||||
* @description Output hash as hex string
|
||||
* @returns {String} Hex string
|
||||
* @see {@link md5.hex}
|
||||
* @example
|
||||
* hash.toString();
|
||||
*/
|
||||
Md5.prototype.toString = Md5.prototype.hex;
|
||||
|
||||
/**
|
||||
* @method digest
|
||||
* @memberof Md5
|
||||
* @instance
|
||||
* @description Output hash as bytes array
|
||||
* @returns {Array} Bytes array
|
||||
* @see {@link md5.digest}
|
||||
* @example
|
||||
* hash.digest();
|
||||
*/
|
||||
Md5.prototype.digest = function () {
|
||||
this.finalize();
|
||||
|
||||
var h0 = this.h0, h1 = this.h1, h2 = this.h2, h3 = this.h3;
|
||||
return [
|
||||
h0 & 0xFF, (h0 >> 8) & 0xFF, (h0 >> 16) & 0xFF, (h0 >> 24) & 0xFF,
|
||||
h1 & 0xFF, (h1 >> 8) & 0xFF, (h1 >> 16) & 0xFF, (h1 >> 24) & 0xFF,
|
||||
h2 & 0xFF, (h2 >> 8) & 0xFF, (h2 >> 16) & 0xFF, (h2 >> 24) & 0xFF,
|
||||
h3 & 0xFF, (h3 >> 8) & 0xFF, (h3 >> 16) & 0xFF, (h3 >> 24) & 0xFF
|
||||
];
|
||||
};
|
||||
|
||||
/**
|
||||
* @method array
|
||||
* @memberof Md5
|
||||
* @instance
|
||||
* @description Output hash as bytes array
|
||||
* @returns {Array} Bytes array
|
||||
* @see {@link md5.array}
|
||||
* @example
|
||||
* hash.array();
|
||||
*/
|
||||
Md5.prototype.array = Md5.prototype.digest;
|
||||
|
||||
/**
|
||||
* @method arrayBuffer
|
||||
* @memberof Md5
|
||||
* @instance
|
||||
* @description Output hash as ArrayBuffer
|
||||
* @returns {ArrayBuffer} ArrayBuffer
|
||||
* @see {@link md5.arrayBuffer}
|
||||
* @example
|
||||
* hash.arrayBuffer();
|
||||
*/
|
||||
Md5.prototype.arrayBuffer = function () {
|
||||
this.finalize();
|
||||
|
||||
var buffer = new ArrayBuffer(16);
|
||||
var blocks = new Uint32Array(buffer);
|
||||
blocks[0] = this.h0;
|
||||
blocks[1] = this.h1;
|
||||
blocks[2] = this.h2;
|
||||
blocks[3] = this.h3;
|
||||
return buffer;
|
||||
};
|
||||
|
||||
/**
|
||||
* @method buffer
|
||||
* @deprecated This maybe confuse with Buffer in node.js. Please use arrayBuffer instead.
|
||||
* @memberof Md5
|
||||
* @instance
|
||||
* @description Output hash as ArrayBuffer
|
||||
* @returns {ArrayBuffer} ArrayBuffer
|
||||
* @see {@link md5.buffer}
|
||||
* @example
|
||||
* hash.buffer();
|
||||
*/
|
||||
Md5.prototype.buffer = Md5.prototype.arrayBuffer;
|
||||
|
||||
/**
|
||||
* @method base64
|
||||
* @memberof Md5
|
||||
* @instance
|
||||
* @description Output hash as base64 string
|
||||
* @returns {String} base64 string
|
||||
* @see {@link md5.base64}
|
||||
* @example
|
||||
* hash.base64();
|
||||
*/
|
||||
Md5.prototype.base64 = function () {
|
||||
var v1, v2, v3, base64Str = '', bytes = this.array();
|
||||
for (var i = 0; i < 15;) {
|
||||
v1 = bytes[i++];
|
||||
v2 = bytes[i++];
|
||||
v3 = bytes[i++];
|
||||
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
|
||||
BASE64_ENCODE_CHAR[(v1 << 4 | v2 >>> 4) & 63] +
|
||||
BASE64_ENCODE_CHAR[(v2 << 2 | v3 >>> 6) & 63] +
|
||||
BASE64_ENCODE_CHAR[v3 & 63];
|
||||
}
|
||||
v1 = bytes[i];
|
||||
base64Str += BASE64_ENCODE_CHAR[v1 >>> 2] +
|
||||
BASE64_ENCODE_CHAR[(v1 << 4) & 63] +
|
||||
'==';
|
||||
return base64Str;
|
||||
};
|
||||
|
||||
var exports = createMethod();
|
||||
|
||||
if (COMMON_JS) {
|
||||
module.exports = exports;
|
||||
} else {
|
||||
/**
|
||||
* @method md5
|
||||
* @description Md5 hash function, export to global in browsers.
|
||||
* @param {String|Array|Uint8Array|ArrayBuffer} message message to hash
|
||||
* @returns {String} md5 hashes
|
||||
* @example
|
||||
* md5(''); // d41d8cd98f00b204e9800998ecf8427e
|
||||
* md5('The quick brown fox jumps over the lazy dog'); // 9e107d9d372bb6826bd81d3542a419d6
|
||||
* md5('The quick brown fox jumps over the lazy dog.'); // e4d909c290d0fb1ca068ffaddf22cbd0
|
||||
*
|
||||
* // It also supports UTF-8 encoding
|
||||
* md5('中文'); // a7bac2239fcdcb3a067903d8077c4a07
|
||||
*
|
||||
* // It also supports byte `Array`, `Uint8Array`, `ArrayBuffer`
|
||||
* md5([]); // d41d8cd98f00b204e9800998ecf8427e
|
||||
* md5(new Uint8Array([])); // d41d8cd98f00b204e9800998ecf8427e
|
||||
*/
|
||||
root.md5 = exports;
|
||||
if (AMD) {
|
||||
define(function () {
|
||||
return exports;
|
||||
});
|
||||
}
|
||||
}
|
||||
})();
|
1
hera-portal/node_modules/path/.npmignore
generated
vendored
Normal file
1
hera-portal/node_modules/path/.npmignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
node_modules
|
18
hera-portal/node_modules/path/LICENSE
generated
vendored
Normal file
18
hera-portal/node_modules/path/LICENSE
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
Copyright Joyent, Inc. and other Node 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.
|
15
hera-portal/node_modules/path/README.md
generated
vendored
Normal file
15
hera-portal/node_modules/path/README.md
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# path
|
||||
|
||||
This is an exact copy of the NodeJS ’path’ module published to the NPM registry.
|
||||
|
||||
[Documentation](http://nodejs.org/docs/latest/api/path.html)
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save path
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
16
hera-portal/node_modules/path/node_modules/inherits/LICENSE
generated
vendored
Normal file
16
hera-portal/node_modules/path/node_modules/inherits/LICENSE
generated
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter
|
||||
|
||||
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.
|
||||
|
42
hera-portal/node_modules/path/node_modules/inherits/README.md
generated
vendored
Normal file
42
hera-portal/node_modules/path/node_modules/inherits/README.md
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
Browser-friendly inheritance fully compatible with standard node.js
|
||||
[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).
|
||||
|
||||
This package exports standard `inherits` from node.js `util` module in
|
||||
node environment, but also provides alternative browser-friendly
|
||||
implementation through [browser
|
||||
field](https://gist.github.com/shtylman/4339901). Alternative
|
||||
implementation is a literal copy of standard one located in standalone
|
||||
module to avoid requiring of `util`. It also has a shim for old
|
||||
browsers with no `Object.create` support.
|
||||
|
||||
While keeping you sure you are using standard `inherits`
|
||||
implementation in node.js environment, it allows bundlers such as
|
||||
[browserify](https://github.com/substack/node-browserify) to not
|
||||
include full `util` package to your client code if all you need is
|
||||
just `inherits` function. It worth, because browser shim for `util`
|
||||
package is large and `inherits` is often the single function you need
|
||||
from it.
|
||||
|
||||
It's recommended to use this package instead of
|
||||
`require('util').inherits` for any code that has chances to be used
|
||||
not only in node.js but in browser too.
|
||||
|
||||
## usage
|
||||
|
||||
```js
|
||||
var inherits = require('inherits');
|
||||
// then use exactly as the standard one
|
||||
```
|
||||
|
||||
## note on version ~1.0
|
||||
|
||||
Version ~1.0 had completely different motivation and is not compatible
|
||||
neither with 2.0 nor with standard node.js `inherits`.
|
||||
|
||||
If you are using version ~1.0 and planning to switch to ~2.0, be
|
||||
careful:
|
||||
|
||||
* new version uses `super_` instead of `super` for referencing
|
||||
superclass
|
||||
* new version overwrites current prototype while old one preserves any
|
||||
existing fields on it
|
7
hera-portal/node_modules/path/node_modules/inherits/inherits.js
generated
vendored
Normal file
7
hera-portal/node_modules/path/node_modules/inherits/inherits.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
try {
|
||||
var util = require('util');
|
||||
if (typeof util.inherits !== 'function') throw '';
|
||||
module.exports = util.inherits;
|
||||
} catch (e) {
|
||||
module.exports = require('./inherits_browser.js');
|
||||
}
|
23
hera-portal/node_modules/path/node_modules/inherits/inherits_browser.js
generated
vendored
Normal file
23
hera-portal/node_modules/path/node_modules/inherits/inherits_browser.js
generated
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
if (typeof Object.create === 'function') {
|
||||
// implementation from standard node.js 'util' module
|
||||
module.exports = function inherits(ctor, superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
ctor.prototype = Object.create(superCtor.prototype, {
|
||||
constructor: {
|
||||
value: ctor,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
};
|
||||
} else {
|
||||
// old school shim for old browsers
|
||||
module.exports = function inherits(ctor, superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
var TempCtor = function () {}
|
||||
TempCtor.prototype = superCtor.prototype
|
||||
ctor.prototype = new TempCtor()
|
||||
ctor.prototype.constructor = ctor
|
||||
}
|
||||
}
|
61
hera-portal/node_modules/path/node_modules/inherits/package.json
generated
vendored
Normal file
61
hera-portal/node_modules/path/node_modules/inherits/package.json
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"_from": "inherits@2.0.3",
|
||||
"_id": "inherits@2.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=",
|
||||
"_location": "/path/inherits",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "inherits@2.0.3",
|
||||
"name": "inherits",
|
||||
"escapedName": "inherits",
|
||||
"rawSpec": "2.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "2.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/path/util"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"_shasum": "633c2c83e3da42a502f52466022480f4208261de",
|
||||
"_spec": "inherits@2.0.3",
|
||||
"_where": "/Users/scx/work/git/person/hera_tuya/hera-portal/node_modules/path/node_modules/util",
|
||||
"browser": "./inherits_browser.js",
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/inherits/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Browser-friendly inheritance fully compatible with standard node.js inherits()",
|
||||
"devDependencies": {
|
||||
"tap": "^7.1.0"
|
||||
},
|
||||
"files": [
|
||||
"inherits.js",
|
||||
"inherits_browser.js"
|
||||
],
|
||||
"homepage": "https://github.com/isaacs/inherits#readme",
|
||||
"keywords": [
|
||||
"inheritance",
|
||||
"class",
|
||||
"klass",
|
||||
"oop",
|
||||
"object-oriented",
|
||||
"inherits",
|
||||
"browser",
|
||||
"browserify"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "./inherits.js",
|
||||
"name": "inherits",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/inherits.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test"
|
||||
},
|
||||
"version": "2.0.3"
|
||||
}
|
18
hera-portal/node_modules/path/node_modules/util/LICENSE
generated
vendored
Normal file
18
hera-portal/node_modules/path/node_modules/util/LICENSE
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
Copyright Joyent, Inc. and other Node 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.
|
15
hera-portal/node_modules/path/node_modules/util/README.md
generated
vendored
Normal file
15
hera-portal/node_modules/path/node_modules/util/README.md
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
# util
|
||||
|
||||
[](https://travis-ci.org/defunctzombie/node-util)
|
||||
|
||||
node.js [util](http://nodejs.org/api/util.html) module as a module
|
||||
|
||||
## install via [npm](npmjs.org)
|
||||
|
||||
```shell
|
||||
npm install util
|
||||
```
|
||||
|
||||
## browser support
|
||||
|
||||
This module also works in modern browsers. If you need legacy browser support you will need to polyfill ES5 features.
|
63
hera-portal/node_modules/path/node_modules/util/package.json
generated
vendored
Normal file
63
hera-portal/node_modules/path/node_modules/util/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "util@^0.10.3",
|
||||
"_id": "util@0.10.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
|
||||
"_location": "/path/util",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "util@^0.10.3",
|
||||
"name": "util",
|
||||
"escapedName": "util",
|
||||
"rawSpec": "^0.10.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.10.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/path"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
|
||||
"_shasum": "3aa0125bfe668a4672de58857d3ace27ecb76901",
|
||||
"_spec": "util@^0.10.3",
|
||||
"_where": "/Users/scx/work/git/person/hera_tuya/hera-portal/node_modules/path",
|
||||
"author": {
|
||||
"name": "Joyent",
|
||||
"url": "http://www.joyent.com"
|
||||
},
|
||||
"browser": {
|
||||
"./support/isBuffer.js": "./support/isBufferBrowser.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/defunctzombie/node-util/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"inherits": "2.0.3"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Node.JS util module",
|
||||
"devDependencies": {
|
||||
"zuul": "~1.0.9"
|
||||
},
|
||||
"files": [
|
||||
"util.js",
|
||||
"support"
|
||||
],
|
||||
"homepage": "https://github.com/defunctzombie/node-util",
|
||||
"keywords": [
|
||||
"util"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./util.js",
|
||||
"name": "util",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/defunctzombie/node-util.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/node/*.js && zuul test/browser/*.js"
|
||||
},
|
||||
"version": "0.10.4"
|
||||
}
|
3
hera-portal/node_modules/path/node_modules/util/support/isBuffer.js
generated
vendored
Normal file
3
hera-portal/node_modules/path/node_modules/util/support/isBuffer.js
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = function isBuffer(arg) {
|
||||
return arg instanceof Buffer;
|
||||
}
|
6
hera-portal/node_modules/path/node_modules/util/support/isBufferBrowser.js
generated
vendored
Normal file
6
hera-portal/node_modules/path/node_modules/util/support/isBufferBrowser.js
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = function isBuffer(arg) {
|
||||
return arg && typeof arg === 'object'
|
||||
&& typeof arg.copy === 'function'
|
||||
&& typeof arg.fill === 'function'
|
||||
&& typeof arg.readUInt8 === 'function';
|
||||
}
|
586
hera-portal/node_modules/path/node_modules/util/util.js
generated
vendored
Normal file
586
hera-portal/node_modules/path/node_modules/util/util.js
generated
vendored
Normal file
@ -0,0 +1,586 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
var formatRegExp = /%[sdj%]/g;
|
||||
exports.format = function(f) {
|
||||
if (!isString(f)) {
|
||||
var objects = [];
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
objects.push(inspect(arguments[i]));
|
||||
}
|
||||
return objects.join(' ');
|
||||
}
|
||||
|
||||
var i = 1;
|
||||
var args = arguments;
|
||||
var len = args.length;
|
||||
var str = String(f).replace(formatRegExp, function(x) {
|
||||
if (x === '%%') return '%';
|
||||
if (i >= len) return x;
|
||||
switch (x) {
|
||||
case '%s': return String(args[i++]);
|
||||
case '%d': return Number(args[i++]);
|
||||
case '%j':
|
||||
try {
|
||||
return JSON.stringify(args[i++]);
|
||||
} catch (_) {
|
||||
return '[Circular]';
|
||||
}
|
||||
default:
|
||||
return x;
|
||||
}
|
||||
});
|
||||
for (var x = args[i]; i < len; x = args[++i]) {
|
||||
if (isNull(x) || !isObject(x)) {
|
||||
str += ' ' + x;
|
||||
} else {
|
||||
str += ' ' + inspect(x);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
};
|
||||
|
||||
|
||||
// Mark that a method should not be used.
|
||||
// Returns a modified function which warns once by default.
|
||||
// If --no-deprecation is set, then it is a no-op.
|
||||
exports.deprecate = function(fn, msg) {
|
||||
// Allow for deprecating things in the process of starting up.
|
||||
if (isUndefined(global.process)) {
|
||||
return function() {
|
||||
return exports.deprecate(fn, msg).apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
if (process.noDeprecation === true) {
|
||||
return fn;
|
||||
}
|
||||
|
||||
var warned = false;
|
||||
function deprecated() {
|
||||
if (!warned) {
|
||||
if (process.throwDeprecation) {
|
||||
throw new Error(msg);
|
||||
} else if (process.traceDeprecation) {
|
||||
console.trace(msg);
|
||||
} else {
|
||||
console.error(msg);
|
||||
}
|
||||
warned = true;
|
||||
}
|
||||
return fn.apply(this, arguments);
|
||||
}
|
||||
|
||||
return deprecated;
|
||||
};
|
||||
|
||||
|
||||
var debugs = {};
|
||||
var debugEnviron;
|
||||
exports.debuglog = function(set) {
|
||||
if (isUndefined(debugEnviron))
|
||||
debugEnviron = process.env.NODE_DEBUG || '';
|
||||
set = set.toUpperCase();
|
||||
if (!debugs[set]) {
|
||||
if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) {
|
||||
var pid = process.pid;
|
||||
debugs[set] = function() {
|
||||
var msg = exports.format.apply(exports, arguments);
|
||||
console.error('%s %d: %s', set, pid, msg);
|
||||
};
|
||||
} else {
|
||||
debugs[set] = function() {};
|
||||
}
|
||||
}
|
||||
return debugs[set];
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Echos the value of a value. Trys to print the value out
|
||||
* in the best way possible given the different types.
|
||||
*
|
||||
* @param {Object} obj The object to print out.
|
||||
* @param {Object} opts Optional options object that alters the output.
|
||||
*/
|
||||
/* legacy: obj, showHidden, depth, colors*/
|
||||
function inspect(obj, opts) {
|
||||
// default options
|
||||
var ctx = {
|
||||
seen: [],
|
||||
stylize: stylizeNoColor
|
||||
};
|
||||
// legacy...
|
||||
if (arguments.length >= 3) ctx.depth = arguments[2];
|
||||
if (arguments.length >= 4) ctx.colors = arguments[3];
|
||||
if (isBoolean(opts)) {
|
||||
// legacy...
|
||||
ctx.showHidden = opts;
|
||||
} else if (opts) {
|
||||
// got an "options" object
|
||||
exports._extend(ctx, opts);
|
||||
}
|
||||
// set default options
|
||||
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
|
||||
if (isUndefined(ctx.depth)) ctx.depth = 2;
|
||||
if (isUndefined(ctx.colors)) ctx.colors = false;
|
||||
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
|
||||
if (ctx.colors) ctx.stylize = stylizeWithColor;
|
||||
return formatValue(ctx, obj, ctx.depth);
|
||||
}
|
||||
exports.inspect = inspect;
|
||||
|
||||
|
||||
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
|
||||
inspect.colors = {
|
||||
'bold' : [1, 22],
|
||||
'italic' : [3, 23],
|
||||
'underline' : [4, 24],
|
||||
'inverse' : [7, 27],
|
||||
'white' : [37, 39],
|
||||
'grey' : [90, 39],
|
||||
'black' : [30, 39],
|
||||
'blue' : [34, 39],
|
||||
'cyan' : [36, 39],
|
||||
'green' : [32, 39],
|
||||
'magenta' : [35, 39],
|
||||
'red' : [31, 39],
|
||||
'yellow' : [33, 39]
|
||||
};
|
||||
|
||||
// Don't use 'blue' not visible on cmd.exe
|
||||
inspect.styles = {
|
||||
'special': 'cyan',
|
||||
'number': 'yellow',
|
||||
'boolean': 'yellow',
|
||||
'undefined': 'grey',
|
||||
'null': 'bold',
|
||||
'string': 'green',
|
||||
'date': 'magenta',
|
||||
// "name": intentionally not styling
|
||||
'regexp': 'red'
|
||||
};
|
||||
|
||||
|
||||
function stylizeWithColor(str, styleType) {
|
||||
var style = inspect.styles[styleType];
|
||||
|
||||
if (style) {
|
||||
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
|
||||
'\u001b[' + inspect.colors[style][1] + 'm';
|
||||
} else {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function stylizeNoColor(str, styleType) {
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
function arrayToHash(array) {
|
||||
var hash = {};
|
||||
|
||||
array.forEach(function(val, idx) {
|
||||
hash[val] = true;
|
||||
});
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
||||
|
||||
function formatValue(ctx, value, recurseTimes) {
|
||||
// Provide a hook for user-specified inspect functions.
|
||||
// Check that value is an object with an inspect function on it
|
||||
if (ctx.customInspect &&
|
||||
value &&
|
||||
isFunction(value.inspect) &&
|
||||
// Filter out the util module, it's inspect function is special
|
||||
value.inspect !== exports.inspect &&
|
||||
// Also filter out any prototype objects using the circular check.
|
||||
!(value.constructor && value.constructor.prototype === value)) {
|
||||
var ret = value.inspect(recurseTimes, ctx);
|
||||
if (!isString(ret)) {
|
||||
ret = formatValue(ctx, ret, recurseTimes);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Primitive types cannot have properties
|
||||
var primitive = formatPrimitive(ctx, value);
|
||||
if (primitive) {
|
||||
return primitive;
|
||||
}
|
||||
|
||||
// Look up the keys of the object.
|
||||
var keys = Object.keys(value);
|
||||
var visibleKeys = arrayToHash(keys);
|
||||
|
||||
if (ctx.showHidden) {
|
||||
keys = Object.getOwnPropertyNames(value);
|
||||
}
|
||||
|
||||
// IE doesn't make error fields non-enumerable
|
||||
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
|
||||
if (isError(value)
|
||||
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
|
||||
return formatError(value);
|
||||
}
|
||||
|
||||
// Some type of object without properties can be shortcutted.
|
||||
if (keys.length === 0) {
|
||||
if (isFunction(value)) {
|
||||
var name = value.name ? ': ' + value.name : '';
|
||||
return ctx.stylize('[Function' + name + ']', 'special');
|
||||
}
|
||||
if (isRegExp(value)) {
|
||||
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
}
|
||||
if (isDate(value)) {
|
||||
return ctx.stylize(Date.prototype.toString.call(value), 'date');
|
||||
}
|
||||
if (isError(value)) {
|
||||
return formatError(value);
|
||||
}
|
||||
}
|
||||
|
||||
var base = '', array = false, braces = ['{', '}'];
|
||||
|
||||
// Make Array say that they are Array
|
||||
if (isArray(value)) {
|
||||
array = true;
|
||||
braces = ['[', ']'];
|
||||
}
|
||||
|
||||
// Make functions say that they are functions
|
||||
if (isFunction(value)) {
|
||||
var n = value.name ? ': ' + value.name : '';
|
||||
base = ' [Function' + n + ']';
|
||||
}
|
||||
|
||||
// Make RegExps say that they are RegExps
|
||||
if (isRegExp(value)) {
|
||||
base = ' ' + RegExp.prototype.toString.call(value);
|
||||
}
|
||||
|
||||
// Make dates with properties first say the date
|
||||
if (isDate(value)) {
|
||||
base = ' ' + Date.prototype.toUTCString.call(value);
|
||||
}
|
||||
|
||||
// Make error with message first say the error
|
||||
if (isError(value)) {
|
||||
base = ' ' + formatError(value);
|
||||
}
|
||||
|
||||
if (keys.length === 0 && (!array || value.length == 0)) {
|
||||
return braces[0] + base + braces[1];
|
||||
}
|
||||
|
||||
if (recurseTimes < 0) {
|
||||
if (isRegExp(value)) {
|
||||
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
|
||||
} else {
|
||||
return ctx.stylize('[Object]', 'special');
|
||||
}
|
||||
}
|
||||
|
||||
ctx.seen.push(value);
|
||||
|
||||
var output;
|
||||
if (array) {
|
||||
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
|
||||
} else {
|
||||
output = keys.map(function(key) {
|
||||
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
|
||||
});
|
||||
}
|
||||
|
||||
ctx.seen.pop();
|
||||
|
||||
return reduceToSingleString(output, base, braces);
|
||||
}
|
||||
|
||||
|
||||
function formatPrimitive(ctx, value) {
|
||||
if (isUndefined(value))
|
||||
return ctx.stylize('undefined', 'undefined');
|
||||
if (isString(value)) {
|
||||
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
|
||||
.replace(/'/g, "\\'")
|
||||
.replace(/\\"/g, '"') + '\'';
|
||||
return ctx.stylize(simple, 'string');
|
||||
}
|
||||
if (isNumber(value))
|
||||
return ctx.stylize('' + value, 'number');
|
||||
if (isBoolean(value))
|
||||
return ctx.stylize('' + value, 'boolean');
|
||||
// For some reason typeof null is "object", so special case here.
|
||||
if (isNull(value))
|
||||
return ctx.stylize('null', 'null');
|
||||
}
|
||||
|
||||
|
||||
function formatError(value) {
|
||||
return '[' + Error.prototype.toString.call(value) + ']';
|
||||
}
|
||||
|
||||
|
||||
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
|
||||
var output = [];
|
||||
for (var i = 0, l = value.length; i < l; ++i) {
|
||||
if (hasOwnProperty(value, String(i))) {
|
||||
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
String(i), true));
|
||||
} else {
|
||||
output.push('');
|
||||
}
|
||||
}
|
||||
keys.forEach(function(key) {
|
||||
if (!key.match(/^\d+$/)) {
|
||||
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
|
||||
key, true));
|
||||
}
|
||||
});
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
|
||||
var name, str, desc;
|
||||
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
|
||||
if (desc.get) {
|
||||
if (desc.set) {
|
||||
str = ctx.stylize('[Getter/Setter]', 'special');
|
||||
} else {
|
||||
str = ctx.stylize('[Getter]', 'special');
|
||||
}
|
||||
} else {
|
||||
if (desc.set) {
|
||||
str = ctx.stylize('[Setter]', 'special');
|
||||
}
|
||||
}
|
||||
if (!hasOwnProperty(visibleKeys, key)) {
|
||||
name = '[' + key + ']';
|
||||
}
|
||||
if (!str) {
|
||||
if (ctx.seen.indexOf(desc.value) < 0) {
|
||||
if (isNull(recurseTimes)) {
|
||||
str = formatValue(ctx, desc.value, null);
|
||||
} else {
|
||||
str = formatValue(ctx, desc.value, recurseTimes - 1);
|
||||
}
|
||||
if (str.indexOf('\n') > -1) {
|
||||
if (array) {
|
||||
str = str.split('\n').map(function(line) {
|
||||
return ' ' + line;
|
||||
}).join('\n').substr(2);
|
||||
} else {
|
||||
str = '\n' + str.split('\n').map(function(line) {
|
||||
return ' ' + line;
|
||||
}).join('\n');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
str = ctx.stylize('[Circular]', 'special');
|
||||
}
|
||||
}
|
||||
if (isUndefined(name)) {
|
||||
if (array && key.match(/^\d+$/)) {
|
||||
return str;
|
||||
}
|
||||
name = JSON.stringify('' + key);
|
||||
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
|
||||
name = name.substr(1, name.length - 2);
|
||||
name = ctx.stylize(name, 'name');
|
||||
} else {
|
||||
name = name.replace(/'/g, "\\'")
|
||||
.replace(/\\"/g, '"')
|
||||
.replace(/(^"|"$)/g, "'");
|
||||
name = ctx.stylize(name, 'string');
|
||||
}
|
||||
}
|
||||
|
||||
return name + ': ' + str;
|
||||
}
|
||||
|
||||
|
||||
function reduceToSingleString(output, base, braces) {
|
||||
var numLinesEst = 0;
|
||||
var length = output.reduce(function(prev, cur) {
|
||||
numLinesEst++;
|
||||
if (cur.indexOf('\n') >= 0) numLinesEst++;
|
||||
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
|
||||
}, 0);
|
||||
|
||||
if (length > 60) {
|
||||
return braces[0] +
|
||||
(base === '' ? '' : base + '\n ') +
|
||||
' ' +
|
||||
output.join(',\n ') +
|
||||
' ' +
|
||||
braces[1];
|
||||
}
|
||||
|
||||
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
|
||||
}
|
||||
|
||||
|
||||
// NOTE: These type checking functions intentionally don't use `instanceof`
|
||||
// because it is fragile and can be easily faked with `Object.create()`.
|
||||
function isArray(ar) {
|
||||
return Array.isArray(ar);
|
||||
}
|
||||
exports.isArray = isArray;
|
||||
|
||||
function isBoolean(arg) {
|
||||
return typeof arg === 'boolean';
|
||||
}
|
||||
exports.isBoolean = isBoolean;
|
||||
|
||||
function isNull(arg) {
|
||||
return arg === null;
|
||||
}
|
||||
exports.isNull = isNull;
|
||||
|
||||
function isNullOrUndefined(arg) {
|
||||
return arg == null;
|
||||
}
|
||||
exports.isNullOrUndefined = isNullOrUndefined;
|
||||
|
||||
function isNumber(arg) {
|
||||
return typeof arg === 'number';
|
||||
}
|
||||
exports.isNumber = isNumber;
|
||||
|
||||
function isString(arg) {
|
||||
return typeof arg === 'string';
|
||||
}
|
||||
exports.isString = isString;
|
||||
|
||||
function isSymbol(arg) {
|
||||
return typeof arg === 'symbol';
|
||||
}
|
||||
exports.isSymbol = isSymbol;
|
||||
|
||||
function isUndefined(arg) {
|
||||
return arg === void 0;
|
||||
}
|
||||
exports.isUndefined = isUndefined;
|
||||
|
||||
function isRegExp(re) {
|
||||
return isObject(re) && objectToString(re) === '[object RegExp]';
|
||||
}
|
||||
exports.isRegExp = isRegExp;
|
||||
|
||||
function isObject(arg) {
|
||||
return typeof arg === 'object' && arg !== null;
|
||||
}
|
||||
exports.isObject = isObject;
|
||||
|
||||
function isDate(d) {
|
||||
return isObject(d) && objectToString(d) === '[object Date]';
|
||||
}
|
||||
exports.isDate = isDate;
|
||||
|
||||
function isError(e) {
|
||||
return isObject(e) &&
|
||||
(objectToString(e) === '[object Error]' || e instanceof Error);
|
||||
}
|
||||
exports.isError = isError;
|
||||
|
||||
function isFunction(arg) {
|
||||
return typeof arg === 'function';
|
||||
}
|
||||
exports.isFunction = isFunction;
|
||||
|
||||
function isPrimitive(arg) {
|
||||
return arg === null ||
|
||||
typeof arg === 'boolean' ||
|
||||
typeof arg === 'number' ||
|
||||
typeof arg === 'string' ||
|
||||
typeof arg === 'symbol' || // ES6 symbol
|
||||
typeof arg === 'undefined';
|
||||
}
|
||||
exports.isPrimitive = isPrimitive;
|
||||
|
||||
exports.isBuffer = require('./support/isBuffer');
|
||||
|
||||
function objectToString(o) {
|
||||
return Object.prototype.toString.call(o);
|
||||
}
|
||||
|
||||
|
||||
function pad(n) {
|
||||
return n < 10 ? '0' + n.toString(10) : n.toString(10);
|
||||
}
|
||||
|
||||
|
||||
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
||||
'Oct', 'Nov', 'Dec'];
|
||||
|
||||
// 26 Feb 16:19:34
|
||||
function timestamp() {
|
||||
var d = new Date();
|
||||
var time = [pad(d.getHours()),
|
||||
pad(d.getMinutes()),
|
||||
pad(d.getSeconds())].join(':');
|
||||
return [d.getDate(), months[d.getMonth()], time].join(' ');
|
||||
}
|
||||
|
||||
|
||||
// log is just a thin wrapper to console.log that prepends a timestamp
|
||||
exports.log = function() {
|
||||
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Inherit the prototype methods from one constructor into another.
|
||||
*
|
||||
* The Function.prototype.inherits from lang.js rewritten as a standalone
|
||||
* function (not on Function.prototype). NOTE: If this file is to be loaded
|
||||
* during bootstrapping this function needs to be rewritten using some native
|
||||
* functions as prototype setup using normal JavaScript does not work as
|
||||
* expected during bootstrapping (see mirror.js in r114903).
|
||||
*
|
||||
* @param {function} ctor Constructor function which needs to inherit the
|
||||
* prototype.
|
||||
* @param {function} superCtor Constructor function to inherit prototype from.
|
||||
*/
|
||||
exports.inherits = require('inherits');
|
||||
|
||||
exports._extend = function(origin, add) {
|
||||
// Don't do anything if add isn't an object
|
||||
if (!add || !isObject(add)) return origin;
|
||||
|
||||
var keys = Object.keys(add);
|
||||
var i = keys.length;
|
||||
while (i--) {
|
||||
origin[keys[i]] = add[keys[i]];
|
||||
}
|
||||
return origin;
|
||||
};
|
||||
|
||||
function hasOwnProperty(obj, prop) {
|
||||
return Object.prototype.hasOwnProperty.call(obj, prop);
|
||||
}
|
53
hera-portal/node_modules/path/package.json
generated
vendored
Normal file
53
hera-portal/node_modules/path/package.json
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"_from": "path",
|
||||
"_id": "path@0.12.7",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=",
|
||||
"_location": "/path",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "tag",
|
||||
"registry": true,
|
||||
"raw": "path",
|
||||
"name": "path",
|
||||
"escapedName": "path",
|
||||
"rawSpec": "",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "latest"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"#USER",
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
|
||||
"_shasum": "d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f",
|
||||
"_spec": "path",
|
||||
"_where": "/Users/scx/work/git/person/hera_tuya/hera-portal",
|
||||
"author": {
|
||||
"name": "Joyent",
|
||||
"url": "http://www.joyent.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jinder/path/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"process": "^0.11.1",
|
||||
"util": "^0.10.3"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Node.JS path module",
|
||||
"homepage": "http://nodejs.org/docs/latest/api/path.html",
|
||||
"keywords": [
|
||||
"ender",
|
||||
"path"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./path.js",
|
||||
"name": "path",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jinder/path.git"
|
||||
},
|
||||
"version": "0.12.7"
|
||||
}
|
628
hera-portal/node_modules/path/path.js
generated
vendored
Normal file
628
hera-portal/node_modules/path/path.js
generated
vendored
Normal file
@ -0,0 +1,628 @@
|
||||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// 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.
|
||||
|
||||
'use strict';
|
||||
|
||||
|
||||
var isWindows = process.platform === 'win32';
|
||||
var util = require('util');
|
||||
|
||||
|
||||
// resolves . and .. elements in a path array with directory names there
|
||||
// must be no slashes or device names (c:\) in the array
|
||||
// (so also no leading and trailing slashes - it does not distinguish
|
||||
// relative and absolute paths)
|
||||
function normalizeArray(parts, allowAboveRoot) {
|
||||
var res = [];
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
var p = parts[i];
|
||||
|
||||
// ignore empty parts
|
||||
if (!p || p === '.')
|
||||
continue;
|
||||
|
||||
if (p === '..') {
|
||||
if (res.length && res[res.length - 1] !== '..') {
|
||||
res.pop();
|
||||
} else if (allowAboveRoot) {
|
||||
res.push('..');
|
||||
}
|
||||
} else {
|
||||
res.push(p);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
// returns an array with empty elements removed from either end of the input
|
||||
// array or the original array if no elements need to be removed
|
||||
function trimArray(arr) {
|
||||
var lastIndex = arr.length - 1;
|
||||
var start = 0;
|
||||
for (; start <= lastIndex; start++) {
|
||||
if (arr[start])
|
||||
break;
|
||||
}
|
||||
|
||||
var end = lastIndex;
|
||||
for (; end >= 0; end--) {
|
||||
if (arr[end])
|
||||
break;
|
||||
}
|
||||
|
||||
if (start === 0 && end === lastIndex)
|
||||
return arr;
|
||||
if (start > end)
|
||||
return [];
|
||||
return arr.slice(start, end + 1);
|
||||
}
|
||||
|
||||
// Regex to split a windows path into three parts: [*, device, slash,
|
||||
// tail] windows-only
|
||||
var splitDeviceRe =
|
||||
/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
|
||||
|
||||
// Regex to split the tail part of the above into [*, dir, basename, ext]
|
||||
var splitTailRe =
|
||||
/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/;
|
||||
|
||||
var win32 = {};
|
||||
|
||||
// Function to split a filename into [root, dir, basename, ext]
|
||||
function win32SplitPath(filename) {
|
||||
// Separate device+slash from tail
|
||||
var result = splitDeviceRe.exec(filename),
|
||||
device = (result[1] || '') + (result[2] || ''),
|
||||
tail = result[3] || '';
|
||||
// Split the tail into dir, basename and extension
|
||||
var result2 = splitTailRe.exec(tail),
|
||||
dir = result2[1],
|
||||
basename = result2[2],
|
||||
ext = result2[3];
|
||||
return [device, dir, basename, ext];
|
||||
}
|
||||
|
||||
function win32StatPath(path) {
|
||||
var result = splitDeviceRe.exec(path),
|
||||
device = result[1] || '',
|
||||
isUnc = !!device && device[1] !== ':';
|
||||
return {
|
||||
device: device,
|
||||
isUnc: isUnc,
|
||||
isAbsolute: isUnc || !!result[2], // UNC paths are always absolute
|
||||
tail: result[3]
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeUNCRoot(device) {
|
||||
return '\\\\' + device.replace(/^[\\\/]+/, '').replace(/[\\\/]+/g, '\\');
|
||||
}
|
||||
|
||||
// path.resolve([from ...], to)
|
||||
win32.resolve = function() {
|
||||
var resolvedDevice = '',
|
||||
resolvedTail = '',
|
||||
resolvedAbsolute = false;
|
||||
|
||||
for (var i = arguments.length - 1; i >= -1; i--) {
|
||||
var path;
|
||||
if (i >= 0) {
|
||||
path = arguments[i];
|
||||
} else if (!resolvedDevice) {
|
||||
path = process.cwd();
|
||||
} else {
|
||||
// Windows has the concept of drive-specific current working
|
||||
// directories. If we've resolved a drive letter but not yet an
|
||||
// absolute path, get cwd for that drive. We're sure the device is not
|
||||
// an unc path at this points, because unc paths are always absolute.
|
||||
path = process.env['=' + resolvedDevice];
|
||||
// Verify that a drive-local cwd was found and that it actually points
|
||||
// to our drive. If not, default to the drive's root.
|
||||
if (!path || path.substr(0, 3).toLowerCase() !==
|
||||
resolvedDevice.toLowerCase() + '\\') {
|
||||
path = resolvedDevice + '\\';
|
||||
}
|
||||
}
|
||||
|
||||
// Skip empty and invalid entries
|
||||
if (!util.isString(path)) {
|
||||
throw new TypeError('Arguments to path.resolve must be strings');
|
||||
} else if (!path) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var result = win32StatPath(path),
|
||||
device = result.device,
|
||||
isUnc = result.isUnc,
|
||||
isAbsolute = result.isAbsolute,
|
||||
tail = result.tail;
|
||||
|
||||
if (device &&
|
||||
resolvedDevice &&
|
||||
device.toLowerCase() !== resolvedDevice.toLowerCase()) {
|
||||
// This path points to another device so it is not applicable
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!resolvedDevice) {
|
||||
resolvedDevice = device;
|
||||
}
|
||||
if (!resolvedAbsolute) {
|
||||
resolvedTail = tail + '\\' + resolvedTail;
|
||||
resolvedAbsolute = isAbsolute;
|
||||
}
|
||||
|
||||
if (resolvedDevice && resolvedAbsolute) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert slashes to backslashes when `resolvedDevice` points to an UNC
|
||||
// root. Also squash multiple slashes into a single one where appropriate.
|
||||
if (isUnc) {
|
||||
resolvedDevice = normalizeUNCRoot(resolvedDevice);
|
||||
}
|
||||
|
||||
// At this point the path should be resolved to a full absolute path,
|
||||
// but handle relative paths to be safe (might happen when process.cwd()
|
||||
// fails)
|
||||
|
||||
// Normalize the tail path
|
||||
resolvedTail = normalizeArray(resolvedTail.split(/[\\\/]+/),
|
||||
!resolvedAbsolute).join('\\');
|
||||
|
||||
return (resolvedDevice + (resolvedAbsolute ? '\\' : '') + resolvedTail) ||
|
||||
'.';
|
||||
};
|
||||
|
||||
|
||||
win32.normalize = function(path) {
|
||||
var result = win32StatPath(path),
|
||||
device = result.device,
|
||||
isUnc = result.isUnc,
|
||||
isAbsolute = result.isAbsolute,
|
||||
tail = result.tail,
|
||||
trailingSlash = /[\\\/]$/.test(tail);
|
||||
|
||||
// Normalize the tail path
|
||||
tail = normalizeArray(tail.split(/[\\\/]+/), !isAbsolute).join('\\');
|
||||
|
||||
if (!tail && !isAbsolute) {
|
||||
tail = '.';
|
||||
}
|
||||
if (tail && trailingSlash) {
|
||||
tail += '\\';
|
||||
}
|
||||
|
||||
// Convert slashes to backslashes when `device` points to an UNC root.
|
||||
// Also squash multiple slashes into a single one where appropriate.
|
||||
if (isUnc) {
|
||||
device = normalizeUNCRoot(device);
|
||||
}
|
||||
|
||||
return device + (isAbsolute ? '\\' : '') + tail;
|
||||
};
|
||||
|
||||
|
||||
win32.isAbsolute = function(path) {
|
||||
return win32StatPath(path).isAbsolute;
|
||||
};
|
||||
|
||||
win32.join = function() {
|
||||
var paths = [];
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var arg = arguments[i];
|
||||
if (!util.isString(arg)) {
|
||||
throw new TypeError('Arguments to path.join must be strings');
|
||||
}
|
||||
if (arg) {
|
||||
paths.push(arg);
|
||||
}
|
||||
}
|
||||
|
||||
var joined = paths.join('\\');
|
||||
|
||||
// Make sure that the joined path doesn't start with two slashes, because
|
||||
// normalize() will mistake it for an UNC path then.
|
||||
//
|
||||
// This step is skipped when it is very clear that the user actually
|
||||
// intended to point at an UNC path. This is assumed when the first
|
||||
// non-empty string arguments starts with exactly two slashes followed by
|
||||
// at least one more non-slash character.
|
||||
//
|
||||
// Note that for normalize() to treat a path as an UNC path it needs to
|
||||
// have at least 2 components, so we don't filter for that here.
|
||||
// This means that the user can use join to construct UNC paths from
|
||||
// a server name and a share name; for example:
|
||||
// path.join('//server', 'share') -> '\\\\server\\share\')
|
||||
if (!/^[\\\/]{2}[^\\\/]/.test(paths[0])) {
|
||||
joined = joined.replace(/^[\\\/]{2,}/, '\\');
|
||||
}
|
||||
|
||||
return win32.normalize(joined);
|
||||
};
|
||||
|
||||
|
||||
// path.relative(from, to)
|
||||
// it will solve the relative path from 'from' to 'to', for instance:
|
||||
// from = 'C:\\orandea\\test\\aaa'
|
||||
// to = 'C:\\orandea\\impl\\bbb'
|
||||
// The output of the function should be: '..\\..\\impl\\bbb'
|
||||
win32.relative = function(from, to) {
|
||||
from = win32.resolve(from);
|
||||
to = win32.resolve(to);
|
||||
|
||||
// windows is not case sensitive
|
||||
var lowerFrom = from.toLowerCase();
|
||||
var lowerTo = to.toLowerCase();
|
||||
|
||||
var toParts = trimArray(to.split('\\'));
|
||||
|
||||
var lowerFromParts = trimArray(lowerFrom.split('\\'));
|
||||
var lowerToParts = trimArray(lowerTo.split('\\'));
|
||||
|
||||
var length = Math.min(lowerFromParts.length, lowerToParts.length);
|
||||
var samePartsLength = length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (lowerFromParts[i] !== lowerToParts[i]) {
|
||||
samePartsLength = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (samePartsLength == 0) {
|
||||
return to;
|
||||
}
|
||||
|
||||
var outputParts = [];
|
||||
for (var i = samePartsLength; i < lowerFromParts.length; i++) {
|
||||
outputParts.push('..');
|
||||
}
|
||||
|
||||
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
||||
|
||||
return outputParts.join('\\');
|
||||
};
|
||||
|
||||
|
||||
win32._makeLong = function(path) {
|
||||
// Note: this will *probably* throw somewhere.
|
||||
if (!util.isString(path))
|
||||
return path;
|
||||
|
||||
if (!path) {
|
||||
return '';
|
||||
}
|
||||
|
||||
var resolvedPath = win32.resolve(path);
|
||||
|
||||
if (/^[a-zA-Z]\:\\/.test(resolvedPath)) {
|
||||
// path is local filesystem path, which needs to be converted
|
||||
// to long UNC path.
|
||||
return '\\\\?\\' + resolvedPath;
|
||||
} else if (/^\\\\[^?.]/.test(resolvedPath)) {
|
||||
// path is network UNC path, which needs to be converted
|
||||
// to long UNC path.
|
||||
return '\\\\?\\UNC\\' + resolvedPath.substring(2);
|
||||
}
|
||||
|
||||
return path;
|
||||
};
|
||||
|
||||
|
||||
win32.dirname = function(path) {
|
||||
var result = win32SplitPath(path),
|
||||
root = result[0],
|
||||
dir = result[1];
|
||||
|
||||
if (!root && !dir) {
|
||||
// No dirname whatsoever
|
||||
return '.';
|
||||
}
|
||||
|
||||
if (dir) {
|
||||
// It has a dirname, strip trailing slash
|
||||
dir = dir.substr(0, dir.length - 1);
|
||||
}
|
||||
|
||||
return root + dir;
|
||||
};
|
||||
|
||||
|
||||
win32.basename = function(path, ext) {
|
||||
var f = win32SplitPath(path)[2];
|
||||
// TODO: make this comparison case-insensitive on windows?
|
||||
if (ext && f.substr(-1 * ext.length) === ext) {
|
||||
f = f.substr(0, f.length - ext.length);
|
||||
}
|
||||
return f;
|
||||
};
|
||||
|
||||
|
||||
win32.extname = function(path) {
|
||||
return win32SplitPath(path)[3];
|
||||
};
|
||||
|
||||
|
||||
win32.format = function(pathObject) {
|
||||
if (!util.isObject(pathObject)) {
|
||||
throw new TypeError(
|
||||
"Parameter 'pathObject' must be an object, not " + typeof pathObject
|
||||
);
|
||||
}
|
||||
|
||||
var root = pathObject.root || '';
|
||||
|
||||
if (!util.isString(root)) {
|
||||
throw new TypeError(
|
||||
"'pathObject.root' must be a string or undefined, not " +
|
||||
typeof pathObject.root
|
||||
);
|
||||
}
|
||||
|
||||
var dir = pathObject.dir;
|
||||
var base = pathObject.base || '';
|
||||
if (!dir) {
|
||||
return base;
|
||||
}
|
||||
if (dir[dir.length - 1] === win32.sep) {
|
||||
return dir + base;
|
||||
}
|
||||
return dir + win32.sep + base;
|
||||
};
|
||||
|
||||
|
||||
win32.parse = function(pathString) {
|
||||
if (!util.isString(pathString)) {
|
||||
throw new TypeError(
|
||||
"Parameter 'pathString' must be a string, not " + typeof pathString
|
||||
);
|
||||
}
|
||||
var allParts = win32SplitPath(pathString);
|
||||
if (!allParts || allParts.length !== 4) {
|
||||
throw new TypeError("Invalid path '" + pathString + "'");
|
||||
}
|
||||
return {
|
||||
root: allParts[0],
|
||||
dir: allParts[0] + allParts[1].slice(0, -1),
|
||||
base: allParts[2],
|
||||
ext: allParts[3],
|
||||
name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
win32.sep = '\\';
|
||||
win32.delimiter = ';';
|
||||
|
||||
|
||||
// Split a filename into [root, dir, basename, ext], unix version
|
||||
// 'root' is just a slash, or nothing.
|
||||
var splitPathRe =
|
||||
/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
|
||||
var posix = {};
|
||||
|
||||
|
||||
function posixSplitPath(filename) {
|
||||
return splitPathRe.exec(filename).slice(1);
|
||||
}
|
||||
|
||||
|
||||
// path.resolve([from ...], to)
|
||||
// posix version
|
||||
posix.resolve = function() {
|
||||
var resolvedPath = '',
|
||||
resolvedAbsolute = false;
|
||||
|
||||
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
||||
var path = (i >= 0) ? arguments[i] : process.cwd();
|
||||
|
||||
// Skip empty and invalid entries
|
||||
if (!util.isString(path)) {
|
||||
throw new TypeError('Arguments to path.resolve must be strings');
|
||||
} else if (!path) {
|
||||
continue;
|
||||
}
|
||||
|
||||
resolvedPath = path + '/' + resolvedPath;
|
||||
resolvedAbsolute = path[0] === '/';
|
||||
}
|
||||
|
||||
// At this point the path should be resolved to a full absolute path, but
|
||||
// handle relative paths to be safe (might happen when process.cwd() fails)
|
||||
|
||||
// Normalize the path
|
||||
resolvedPath = normalizeArray(resolvedPath.split('/'),
|
||||
!resolvedAbsolute).join('/');
|
||||
|
||||
return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
|
||||
};
|
||||
|
||||
// path.normalize(path)
|
||||
// posix version
|
||||
posix.normalize = function(path) {
|
||||
var isAbsolute = posix.isAbsolute(path),
|
||||
trailingSlash = path && path[path.length - 1] === '/';
|
||||
|
||||
// Normalize the path
|
||||
path = normalizeArray(path.split('/'), !isAbsolute).join('/');
|
||||
|
||||
if (!path && !isAbsolute) {
|
||||
path = '.';
|
||||
}
|
||||
if (path && trailingSlash) {
|
||||
path += '/';
|
||||
}
|
||||
|
||||
return (isAbsolute ? '/' : '') + path;
|
||||
};
|
||||
|
||||
// posix version
|
||||
posix.isAbsolute = function(path) {
|
||||
return path.charAt(0) === '/';
|
||||
};
|
||||
|
||||
// posix version
|
||||
posix.join = function() {
|
||||
var path = '';
|
||||
for (var i = 0; i < arguments.length; i++) {
|
||||
var segment = arguments[i];
|
||||
if (!util.isString(segment)) {
|
||||
throw new TypeError('Arguments to path.join must be strings');
|
||||
}
|
||||
if (segment) {
|
||||
if (!path) {
|
||||
path += segment;
|
||||
} else {
|
||||
path += '/' + segment;
|
||||
}
|
||||
}
|
||||
}
|
||||
return posix.normalize(path);
|
||||
};
|
||||
|
||||
|
||||
// path.relative(from, to)
|
||||
// posix version
|
||||
posix.relative = function(from, to) {
|
||||
from = posix.resolve(from).substr(1);
|
||||
to = posix.resolve(to).substr(1);
|
||||
|
||||
var fromParts = trimArray(from.split('/'));
|
||||
var toParts = trimArray(to.split('/'));
|
||||
|
||||
var length = Math.min(fromParts.length, toParts.length);
|
||||
var samePartsLength = length;
|
||||
for (var i = 0; i < length; i++) {
|
||||
if (fromParts[i] !== toParts[i]) {
|
||||
samePartsLength = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var outputParts = [];
|
||||
for (var i = samePartsLength; i < fromParts.length; i++) {
|
||||
outputParts.push('..');
|
||||
}
|
||||
|
||||
outputParts = outputParts.concat(toParts.slice(samePartsLength));
|
||||
|
||||
return outputParts.join('/');
|
||||
};
|
||||
|
||||
|
||||
posix._makeLong = function(path) {
|
||||
return path;
|
||||
};
|
||||
|
||||
|
||||
posix.dirname = function(path) {
|
||||
var result = posixSplitPath(path),
|
||||
root = result[0],
|
||||
dir = result[1];
|
||||
|
||||
if (!root && !dir) {
|
||||
// No dirname whatsoever
|
||||
return '.';
|
||||
}
|
||||
|
||||
if (dir) {
|
||||
// It has a dirname, strip trailing slash
|
||||
dir = dir.substr(0, dir.length - 1);
|
||||
}
|
||||
|
||||
return root + dir;
|
||||
};
|
||||
|
||||
|
||||
posix.basename = function(path, ext) {
|
||||
var f = posixSplitPath(path)[2];
|
||||
// TODO: make this comparison case-insensitive on windows?
|
||||
if (ext && f.substr(-1 * ext.length) === ext) {
|
||||
f = f.substr(0, f.length - ext.length);
|
||||
}
|
||||
return f;
|
||||
};
|
||||
|
||||
|
||||
posix.extname = function(path) {
|
||||
return posixSplitPath(path)[3];
|
||||
};
|
||||
|
||||
|
||||
posix.format = function(pathObject) {
|
||||
if (!util.isObject(pathObject)) {
|
||||
throw new TypeError(
|
||||
"Parameter 'pathObject' must be an object, not " + typeof pathObject
|
||||
);
|
||||
}
|
||||
|
||||
var root = pathObject.root || '';
|
||||
|
||||
if (!util.isString(root)) {
|
||||
throw new TypeError(
|
||||
"'pathObject.root' must be a string or undefined, not " +
|
||||
typeof pathObject.root
|
||||
);
|
||||
}
|
||||
|
||||
var dir = pathObject.dir ? pathObject.dir + posix.sep : '';
|
||||
var base = pathObject.base || '';
|
||||
return dir + base;
|
||||
};
|
||||
|
||||
|
||||
posix.parse = function(pathString) {
|
||||
if (!util.isString(pathString)) {
|
||||
throw new TypeError(
|
||||
"Parameter 'pathString' must be a string, not " + typeof pathString
|
||||
);
|
||||
}
|
||||
var allParts = posixSplitPath(pathString);
|
||||
if (!allParts || allParts.length !== 4) {
|
||||
throw new TypeError("Invalid path '" + pathString + "'");
|
||||
}
|
||||
allParts[1] = allParts[1] || '';
|
||||
allParts[2] = allParts[2] || '';
|
||||
allParts[3] = allParts[3] || '';
|
||||
|
||||
return {
|
||||
root: allParts[0],
|
||||
dir: allParts[0] + allParts[1].slice(0, -1),
|
||||
base: allParts[2],
|
||||
ext: allParts[3],
|
||||
name: allParts[2].slice(0, allParts[2].length - allParts[3].length)
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
posix.sep = '/';
|
||||
posix.delimiter = ':';
|
||||
|
||||
|
||||
if (isWindows)
|
||||
module.exports = win32;
|
||||
else /* posix */
|
||||
module.exports = posix;
|
||||
|
||||
module.exports.posix = posix;
|
||||
module.exports.win32 = win32;
|
22
hera-portal/node_modules/sql-formatter/LICENSE
generated
vendored
Normal file
22
hera-portal/node_modules/sql-formatter/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016-2020 ZeroTurnaround LLC
|
||||
Copyright (c) 2020-present George Leslie-Waksman and other contributors
|
||||
|
||||
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.
|
165
hera-portal/node_modules/sql-formatter/README.md
generated
vendored
Normal file
165
hera-portal/node_modules/sql-formatter/README.md
generated
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
# SQL Formatter [](https://npmjs.com/package/sql-formatter) [](https://travis-ci.org/zeroturnaround/sql-formatter) [](https://coveralls.io/github/zeroturnaround/sql-formatter?branch=master)
|
||||
|
||||
**SQL Formatter** is a JavaScript library for pretty-printing SQL queries.
|
||||
It started as a port of a [PHP Library][], but has since considerably diverged.
|
||||
|
||||
SQL formatter supports the following dialects:
|
||||
|
||||
- **sql** - [Standard SQL][]
|
||||
- **mariadb** - [MariaDB][]
|
||||
- **mysql** - [MySQL][]
|
||||
- **postgresql** - [PostgreSQL][]
|
||||
- **db2** - [IBM DB2][]
|
||||
- **plsql** - [Oracle PL/SQL][]
|
||||
- **n1ql** - [Couchbase N1QL][]
|
||||
- **redshift** - [Amazon Redshift][]
|
||||
- **spark** - [Spark][]
|
||||
- **tsql** - [SQL Server Transact-SQL][tsql]
|
||||
|
||||
It does not support:
|
||||
|
||||
- Stored procedures.
|
||||
- Changing of the delimiter type to something else than `;`.
|
||||
|
||||
→ [Try the demo.](https://zeroturnaround.github.io/sql-formatter/)
|
||||
|
||||
## Install
|
||||
|
||||
Get the latest version from NPM:
|
||||
|
||||
```sh
|
||||
npm install sql-formatter
|
||||
```
|
||||
|
||||
## Usage as library
|
||||
|
||||
```js
|
||||
import { format } from 'sql-formatter';
|
||||
|
||||
console.log(format('SELECT * FROM tbl'));
|
||||
```
|
||||
|
||||
This will output:
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
tbl
|
||||
```
|
||||
|
||||
You can also pass in configuration options:
|
||||
|
||||
```js
|
||||
format('SELECT * FROM tbl', {
|
||||
language: 'spark', // Defaults to "sql" (see the above list of supported dialects)
|
||||
indent: ' ', // Defaults to two spaces
|
||||
uppercase: bool, // Defaults to false
|
||||
linesBetweenQueries: 2, // Defaults to 1
|
||||
});
|
||||
```
|
||||
|
||||
### Placeholders replacement
|
||||
|
||||
```js
|
||||
// Named placeholders
|
||||
format("SELECT * FROM tbl WHERE foo = @foo", {
|
||||
params: {foo: "'bar'"}
|
||||
}));
|
||||
|
||||
// Indexed placeholders
|
||||
format("SELECT * FROM tbl WHERE foo = ?", {
|
||||
params: ["'bar'"]
|
||||
}));
|
||||
```
|
||||
|
||||
Both result in:
|
||||
|
||||
```
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
tbl
|
||||
WHERE
|
||||
foo = 'bar'
|
||||
```
|
||||
|
||||
## Usage from command line
|
||||
|
||||
The CLI tool will be installed under `sql-formatter`
|
||||
and may be invoked via `npx sql-formatter`:
|
||||
|
||||
```sh
|
||||
sql-formatter -h
|
||||
```
|
||||
|
||||
```
|
||||
usage: sql-formatter [-h] [-o OUTPUT] [-l {db2,mariadb,mysql,n1ql,plsql,postgresql,redshift,spark,sql,tsql}]
|
||||
[-i N | -t] [-u] [--lines-between-queries N] [--version] [FILE]
|
||||
|
||||
SQL Formatter
|
||||
|
||||
positional arguments:
|
||||
FILE Input SQL file (defaults to stdin)
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-o OUTPUT, --output OUTPUT
|
||||
File to write SQL output (defaults to stdout)
|
||||
-l {db2,mariadb,mysql,n1ql,plsql,postgresql,redshift,spark,sql,tsql},
|
||||
--language {db2,mariadb,mysql,n1ql,plsql,postgresql,redshift,spark,sql,tsql}
|
||||
SQL Formatter dialect (defaults to basic sql)
|
||||
-i N, --indent N Number of spaces to indent query blocks (defaults to 2)
|
||||
-t, --tab-indent Indent query blocks with tabs instead of spaces
|
||||
-u, --uppercase Capitalize language keywords
|
||||
--lines-between-queries N
|
||||
How many newlines to insert between queries (separated by ";")
|
||||
--version show program's version number and exit
|
||||
```
|
||||
|
||||
By default, the tool takes queries from stdin and processes them to stdout but
|
||||
one can also name an input file name or use the `--output` option.
|
||||
|
||||
```sh
|
||||
echo 'select * from tbl where id = 3' | sql-formatter -u
|
||||
```
|
||||
|
||||
```sql
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
tbl
|
||||
WHERE
|
||||
id = 3
|
||||
```
|
||||
|
||||
## Usage without NPM
|
||||
|
||||
If you don't use a module bundler, clone the repository, run `npm install` and grab a file from `/dist` directory to use inside a `<script>` tag.
|
||||
This makes SQL Formatter available as a global variable `window.sqlFormatter`.
|
||||
|
||||
## Contributing
|
||||
|
||||
Make sure to run all checks:
|
||||
|
||||
```sh
|
||||
npm run check
|
||||
```
|
||||
|
||||
...and you're ready to poke us with a pull request.
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/zeroturnaround/sql-formatter/blob/master/LICENSE)
|
||||
|
||||
[php library]: https://github.com/jdorn/sql-formatter
|
||||
[standard sql]: https://en.wikipedia.org/wiki/SQL:2011
|
||||
[couchbase n1ql]: http://www.couchbase.com/n1ql
|
||||
[ibm db2]: https://www.ibm.com/analytics/us/en/technology/db2/
|
||||
[oracle pl/sql]: http://www.oracle.com/technetwork/database/features/plsql/index.html
|
||||
[amazon redshift]: https://docs.aws.amazon.com/redshift/latest/dg/cm_chap_SQLCommandRef.html
|
||||
[spark]: https://spark.apache.org/docs/latest/api/sql/index.html
|
||||
[postgresql]: https://www.postgresql.org/
|
||||
[mariadb]: https://mariadb.com/
|
||||
[mysql]: https://www.mysql.com/
|
||||
[tsql]: https://docs.microsoft.com/en-us/sql/sql-server/
|
103
hera-portal/node_modules/sql-formatter/bin/sqlfmt.js
generated
vendored
Executable file
103
hera-portal/node_modules/sql-formatter/bin/sqlfmt.js
generated
vendored
Executable file
@ -0,0 +1,103 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
'use strict';
|
||||
|
||||
const { format, supportedDialects } = require('../lib/sqlFormatter');
|
||||
const fs = require('fs');
|
||||
const { version } = require('../package.json');
|
||||
const { ArgumentParser } = require('argparse');
|
||||
|
||||
function getArgs() {
|
||||
const parser = new ArgumentParser({
|
||||
add_help: true,
|
||||
description: 'SQL Formatter',
|
||||
});
|
||||
|
||||
parser.add_argument('file', {
|
||||
metavar: 'FILE',
|
||||
nargs: '?',
|
||||
help: 'Input SQL file (defaults to stdin)',
|
||||
});
|
||||
|
||||
parser.add_argument('-o', '--output', {
|
||||
help: 'File to write SQL output (defaults to stdout)',
|
||||
});
|
||||
|
||||
parser.add_argument('-l', '--language', {
|
||||
help: 'SQL Formatter dialect (defaults to basic sql)',
|
||||
choices: supportedDialects,
|
||||
default: 'sql',
|
||||
});
|
||||
|
||||
const indentationGroup = parser.add_mutually_exclusive_group();
|
||||
indentationGroup.add_argument('-i', '--indent', {
|
||||
help: 'Number of spaces to indent query blocks (defaults to 2)',
|
||||
metavar: 'N',
|
||||
type: 'int',
|
||||
default: 2,
|
||||
});
|
||||
indentationGroup.add_argument('-t', '--tab-indent', {
|
||||
help: 'Indent query blocks with tabs instead of spaces',
|
||||
action: 'store_true',
|
||||
});
|
||||
|
||||
parser.add_argument('-u', '--uppercase', {
|
||||
help: 'Capitalize language keywords',
|
||||
action: 'store_true',
|
||||
});
|
||||
|
||||
parser.add_argument('--lines-between-queries', {
|
||||
help: 'How many newlines to insert between queries (separated by ";")',
|
||||
metavar: 'N',
|
||||
type: 'int',
|
||||
default: 1,
|
||||
});
|
||||
|
||||
parser.add_argument('--version', {
|
||||
action: 'version',
|
||||
version,
|
||||
});
|
||||
|
||||
return parser.parse_args();
|
||||
}
|
||||
|
||||
function configFromArgs(args) {
|
||||
return {
|
||||
language: args.language,
|
||||
indent: args.tab_indent ? '\t' : ' '.repeat(args.indent),
|
||||
uppercase: args.uppercase,
|
||||
linesBetweenQueries: args.lines_between_queries,
|
||||
};
|
||||
}
|
||||
|
||||
function getInput(file) {
|
||||
const infile = file || process.stdin.fd;
|
||||
try {
|
||||
return fs.readFileSync(infile, 'utf-8');
|
||||
} catch (e) {
|
||||
if (e.code === 'EAGAIN') {
|
||||
console.error('Error: no file specified and no data in stdin');
|
||||
process.exit(1);
|
||||
}
|
||||
if (e.code === 'ENOENT') {
|
||||
console.error(`Error: could not open file ${infile}`);
|
||||
process.exit(1);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
function writeOutput(file, query) {
|
||||
if (!file) {
|
||||
// No output file, write to console
|
||||
console.log(query);
|
||||
} else {
|
||||
fs.writeFileSync(file, query);
|
||||
}
|
||||
}
|
||||
|
||||
const args = getArgs();
|
||||
const cfg = configFromArgs(args);
|
||||
const query = getInput(args.file);
|
||||
const formattedQuery = format(query, cfg).trim() + '\n';
|
||||
writeOutput(args.output, formattedQuery);
|
2169
hera-portal/node_modules/sql-formatter/dist/sql-formatter.js
generated
vendored
Normal file
2169
hera-portal/node_modules/sql-formatter/dist/sql-formatter.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2
hera-portal/node_modules/sql-formatter/dist/sql-formatter.min.js
generated
vendored
Normal file
2
hera-portal/node_modules/sql-formatter/dist/sql-formatter.min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
hera-portal/node_modules/sql-formatter/dist/sql-formatter.min.js.map
generated
vendored
Normal file
1
hera-portal/node_modules/sql-formatter/dist/sql-formatter.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
301
hera-portal/node_modules/sql-formatter/lib/core/Formatter.js
generated
vendored
Normal file
301
hera-portal/node_modules/sql-formatter/lib/core/Formatter.js
generated
vendored
Normal file
@ -0,0 +1,301 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _tokenTypes = _interopRequireDefault(require("./tokenTypes"));
|
||||
|
||||
var _Indentation = _interopRequireDefault(require("./Indentation"));
|
||||
|
||||
var _InlineBlock = _interopRequireDefault(require("./InlineBlock"));
|
||||
|
||||
var _Params = _interopRequireDefault(require("./Params"));
|
||||
|
||||
var _utils = require("../utils");
|
||||
|
||||
var _token = require("./token");
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
var Formatter = /*#__PURE__*/function () {
|
||||
/**
|
||||
* @param {Object} cfg
|
||||
* @param {String} cfg.language
|
||||
* @param {String} cfg.indent
|
||||
* @param {Boolean} cfg.uppercase
|
||||
* @param {Integer} cfg.linesBetweenQueries
|
||||
* @param {Object} cfg.params
|
||||
*/
|
||||
function Formatter(cfg) {
|
||||
_classCallCheck(this, Formatter);
|
||||
|
||||
this.cfg = cfg;
|
||||
this.indentation = new _Indentation["default"](this.cfg.indent);
|
||||
this.inlineBlock = new _InlineBlock["default"]();
|
||||
this.params = new _Params["default"](this.cfg.params);
|
||||
this.previousReservedToken = {};
|
||||
this.tokens = [];
|
||||
this.index = 0;
|
||||
}
|
||||
/**
|
||||
* SQL Tokenizer for this formatter, provided by subclasses.
|
||||
*/
|
||||
|
||||
|
||||
_createClass(Formatter, [{
|
||||
key: "tokenizer",
|
||||
value: function tokenizer() {
|
||||
throw new Error('tokenizer() not implemented by subclass');
|
||||
}
|
||||
/**
|
||||
* Reprocess and modify a token based on parsed context.
|
||||
*
|
||||
* @param {Object} token The token to modify
|
||||
* @param {String} token.type
|
||||
* @param {String} token.value
|
||||
* @return {Object} new token or the original
|
||||
* @return {String} token.type
|
||||
* @return {String} token.value
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "tokenOverride",
|
||||
value: function tokenOverride(token) {
|
||||
// subclasses can override this to modify tokens during formatting
|
||||
return token;
|
||||
}
|
||||
/**
|
||||
* Formats whitespace in a SQL string to make it easier to read.
|
||||
*
|
||||
* @param {String} query The SQL query string
|
||||
* @return {String} formatted query
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "format",
|
||||
value: function format(query) {
|
||||
this.tokens = this.tokenizer().tokenize(query);
|
||||
var formattedQuery = this.getFormattedQueryFromTokens();
|
||||
return formattedQuery.trim();
|
||||
}
|
||||
}, {
|
||||
key: "getFormattedQueryFromTokens",
|
||||
value: function getFormattedQueryFromTokens() {
|
||||
var _this = this;
|
||||
|
||||
var formattedQuery = '';
|
||||
this.tokens.forEach(function (token, index) {
|
||||
_this.index = index;
|
||||
token = _this.tokenOverride(token);
|
||||
|
||||
if (token.type === _tokenTypes["default"].LINE_COMMENT) {
|
||||
formattedQuery = _this.formatLineComment(token, formattedQuery);
|
||||
} else if (token.type === _tokenTypes["default"].BLOCK_COMMENT) {
|
||||
formattedQuery = _this.formatBlockComment(token, formattedQuery);
|
||||
} else if (token.type === _tokenTypes["default"].RESERVED_TOP_LEVEL) {
|
||||
formattedQuery = _this.formatTopLevelReservedWord(token, formattedQuery);
|
||||
_this.previousReservedToken = token;
|
||||
} else if (token.type === _tokenTypes["default"].RESERVED_TOP_LEVEL_NO_INDENT) {
|
||||
formattedQuery = _this.formatTopLevelReservedWordNoIndent(token, formattedQuery);
|
||||
_this.previousReservedToken = token;
|
||||
} else if (token.type === _tokenTypes["default"].RESERVED_NEWLINE) {
|
||||
formattedQuery = _this.formatNewlineReservedWord(token, formattedQuery);
|
||||
_this.previousReservedToken = token;
|
||||
} else if (token.type === _tokenTypes["default"].RESERVED) {
|
||||
formattedQuery = _this.formatWithSpaces(token, formattedQuery);
|
||||
_this.previousReservedToken = token;
|
||||
} else if (token.type === _tokenTypes["default"].OPEN_PAREN) {
|
||||
formattedQuery = _this.formatOpeningParentheses(token, formattedQuery);
|
||||
} else if (token.type === _tokenTypes["default"].CLOSE_PAREN) {
|
||||
formattedQuery = _this.formatClosingParentheses(token, formattedQuery);
|
||||
} else if (token.type === _tokenTypes["default"].PLACEHOLDER) {
|
||||
formattedQuery = _this.formatPlaceholder(token, formattedQuery);
|
||||
} else if (token.value === ',') {
|
||||
formattedQuery = _this.formatComma(token, formattedQuery);
|
||||
} else if (token.value === ':') {
|
||||
formattedQuery = _this.formatWithSpaceAfter(token, formattedQuery);
|
||||
} else if (token.value === '.') {
|
||||
formattedQuery = _this.formatWithoutSpaces(token, formattedQuery);
|
||||
} else if (token.value === ';') {
|
||||
formattedQuery = _this.formatQuerySeparator(token, formattedQuery);
|
||||
} else {
|
||||
formattedQuery = _this.formatWithSpaces(token, formattedQuery);
|
||||
}
|
||||
});
|
||||
return formattedQuery;
|
||||
}
|
||||
}, {
|
||||
key: "formatLineComment",
|
||||
value: function formatLineComment(token, query) {
|
||||
return this.addNewline(query + this.show(token));
|
||||
}
|
||||
}, {
|
||||
key: "formatBlockComment",
|
||||
value: function formatBlockComment(token, query) {
|
||||
return this.addNewline(this.addNewline(query) + this.indentComment(token.value));
|
||||
}
|
||||
}, {
|
||||
key: "indentComment",
|
||||
value: function indentComment(comment) {
|
||||
return comment.replace(/\n[\t ]*/g, '\n' + this.indentation.getIndent() + ' ');
|
||||
}
|
||||
}, {
|
||||
key: "formatTopLevelReservedWordNoIndent",
|
||||
value: function formatTopLevelReservedWordNoIndent(token, query) {
|
||||
this.indentation.decreaseTopLevel();
|
||||
query = this.addNewline(query) + this.equalizeWhitespace(this.show(token));
|
||||
return this.addNewline(query);
|
||||
}
|
||||
}, {
|
||||
key: "formatTopLevelReservedWord",
|
||||
value: function formatTopLevelReservedWord(token, query) {
|
||||
this.indentation.decreaseTopLevel();
|
||||
query = this.addNewline(query);
|
||||
this.indentation.increaseTopLevel();
|
||||
query += this.equalizeWhitespace(this.show(token));
|
||||
return this.addNewline(query);
|
||||
}
|
||||
}, {
|
||||
key: "formatNewlineReservedWord",
|
||||
value: function formatNewlineReservedWord(token, query) {
|
||||
if ((0, _token.isAnd)(token) && (0, _token.isBetween)(this.tokenLookBehind(2))) {
|
||||
return this.formatWithSpaces(token, query);
|
||||
}
|
||||
|
||||
return this.addNewline(query) + this.equalizeWhitespace(this.show(token)) + ' ';
|
||||
} // Replace any sequence of whitespace characters with single space
|
||||
|
||||
}, {
|
||||
key: "equalizeWhitespace",
|
||||
value: function equalizeWhitespace(string) {
|
||||
return string.replace(/[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+/g, ' ');
|
||||
} // Opening parentheses increase the block indent level and start a new line
|
||||
|
||||
}, {
|
||||
key: "formatOpeningParentheses",
|
||||
value: function formatOpeningParentheses(token, query) {
|
||||
var _preserveWhitespaceFo, _this$tokenLookBehind;
|
||||
|
||||
// Take out the preceding space unless there was whitespace there in the original query
|
||||
// or another opening parens or line comment
|
||||
var preserveWhitespaceFor = (_preserveWhitespaceFo = {}, _defineProperty(_preserveWhitespaceFo, _tokenTypes["default"].OPEN_PAREN, true), _defineProperty(_preserveWhitespaceFo, _tokenTypes["default"].LINE_COMMENT, true), _defineProperty(_preserveWhitespaceFo, _tokenTypes["default"].OPERATOR, true), _preserveWhitespaceFo);
|
||||
|
||||
if (token.whitespaceBefore.length === 0 && !preserveWhitespaceFor[(_this$tokenLookBehind = this.tokenLookBehind()) === null || _this$tokenLookBehind === void 0 ? void 0 : _this$tokenLookBehind.type]) {
|
||||
query = (0, _utils.trimSpacesEnd)(query);
|
||||
}
|
||||
|
||||
query += this.show(token);
|
||||
this.inlineBlock.beginIfPossible(this.tokens, this.index);
|
||||
|
||||
if (!this.inlineBlock.isActive()) {
|
||||
this.indentation.increaseBlockLevel();
|
||||
query = this.addNewline(query);
|
||||
}
|
||||
|
||||
return query;
|
||||
} // Closing parentheses decrease the block indent level
|
||||
|
||||
}, {
|
||||
key: "formatClosingParentheses",
|
||||
value: function formatClosingParentheses(token, query) {
|
||||
if (this.inlineBlock.isActive()) {
|
||||
this.inlineBlock.end();
|
||||
return this.formatWithSpaceAfter(token, query);
|
||||
} else {
|
||||
this.indentation.decreaseBlockLevel();
|
||||
return this.formatWithSpaces(token, this.addNewline(query));
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "formatPlaceholder",
|
||||
value: function formatPlaceholder(token, query) {
|
||||
return query + this.params.get(token) + ' ';
|
||||
} // Commas start a new line (unless within inline parentheses or SQL "LIMIT" clause)
|
||||
|
||||
}, {
|
||||
key: "formatComma",
|
||||
value: function formatComma(token, query) {
|
||||
query = (0, _utils.trimSpacesEnd)(query) + this.show(token) + ' ';
|
||||
|
||||
if (this.inlineBlock.isActive()) {
|
||||
return query;
|
||||
} else if ((0, _token.isLimit)(this.previousReservedToken)) {
|
||||
return query;
|
||||
} else {
|
||||
return this.addNewline(query);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "formatWithSpaceAfter",
|
||||
value: function formatWithSpaceAfter(token, query) {
|
||||
return (0, _utils.trimSpacesEnd)(query) + this.show(token) + ' ';
|
||||
}
|
||||
}, {
|
||||
key: "formatWithoutSpaces",
|
||||
value: function formatWithoutSpaces(token, query) {
|
||||
return (0, _utils.trimSpacesEnd)(query) + this.show(token);
|
||||
}
|
||||
}, {
|
||||
key: "formatWithSpaces",
|
||||
value: function formatWithSpaces(token, query) {
|
||||
return query + this.show(token) + ' ';
|
||||
}
|
||||
}, {
|
||||
key: "formatQuerySeparator",
|
||||
value: function formatQuerySeparator(token, query) {
|
||||
this.indentation.resetIndentation();
|
||||
return (0, _utils.trimSpacesEnd)(query) + this.show(token) + '\n'.repeat(this.cfg.linesBetweenQueries || 1);
|
||||
} // Converts token to string (uppercasing it if needed)
|
||||
|
||||
}, {
|
||||
key: "show",
|
||||
value: function show(_ref) {
|
||||
var type = _ref.type,
|
||||
value = _ref.value;
|
||||
|
||||
if (this.cfg.uppercase && (type === _tokenTypes["default"].RESERVED || type === _tokenTypes["default"].RESERVED_TOP_LEVEL || type === _tokenTypes["default"].RESERVED_TOP_LEVEL_NO_INDENT || type === _tokenTypes["default"].RESERVED_NEWLINE || type === _tokenTypes["default"].OPEN_PAREN || type === _tokenTypes["default"].CLOSE_PAREN)) {
|
||||
return value.toUpperCase();
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "addNewline",
|
||||
value: function addNewline(query) {
|
||||
query = (0, _utils.trimSpacesEnd)(query);
|
||||
|
||||
if (!query.endsWith('\n')) {
|
||||
query += '\n';
|
||||
}
|
||||
|
||||
return query + this.indentation.getIndent();
|
||||
}
|
||||
}, {
|
||||
key: "tokenLookBehind",
|
||||
value: function tokenLookBehind() {
|
||||
var n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
||||
return this.tokens[this.index - n];
|
||||
}
|
||||
}, {
|
||||
key: "tokenLookAhead",
|
||||
value: function tokenLookAhead() {
|
||||
var n = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
|
||||
return this.tokens[this.index + n];
|
||||
}
|
||||
}]);
|
||||
|
||||
return Formatter;
|
||||
}();
|
||||
|
||||
exports["default"] = Formatter;
|
||||
module.exports = exports.default;
|
106
hera-portal/node_modules/sql-formatter/lib/core/Indentation.js
generated
vendored
Normal file
106
hera-portal/node_modules/sql-formatter/lib/core/Indentation.js
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _utils = require("../utils");
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
var INDENT_TYPE_TOP_LEVEL = 'top-level';
|
||||
var INDENT_TYPE_BLOCK_LEVEL = 'block-level';
|
||||
/**
|
||||
* Manages indentation levels.
|
||||
*
|
||||
* There are two types of indentation levels:
|
||||
*
|
||||
* - BLOCK_LEVEL : increased by open-parenthesis
|
||||
* - TOP_LEVEL : increased by RESERVED_TOP_LEVEL words
|
||||
*/
|
||||
|
||||
var Indentation = /*#__PURE__*/function () {
|
||||
/**
|
||||
* @param {String} indent Indent value, default is " " (2 spaces)
|
||||
*/
|
||||
function Indentation(indent) {
|
||||
_classCallCheck(this, Indentation);
|
||||
|
||||
this.indent = indent || ' ';
|
||||
this.indentTypes = [];
|
||||
}
|
||||
/**
|
||||
* Returns current indentation string.
|
||||
* @return {String}
|
||||
*/
|
||||
|
||||
|
||||
_createClass(Indentation, [{
|
||||
key: "getIndent",
|
||||
value: function getIndent() {
|
||||
return this.indent.repeat(this.indentTypes.length);
|
||||
}
|
||||
/**
|
||||
* Increases indentation by one top-level indent.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "increaseTopLevel",
|
||||
value: function increaseTopLevel() {
|
||||
this.indentTypes.push(INDENT_TYPE_TOP_LEVEL);
|
||||
}
|
||||
/**
|
||||
* Increases indentation by one block-level indent.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "increaseBlockLevel",
|
||||
value: function increaseBlockLevel() {
|
||||
this.indentTypes.push(INDENT_TYPE_BLOCK_LEVEL);
|
||||
}
|
||||
/**
|
||||
* Decreases indentation by one top-level indent.
|
||||
* Does nothing when the previous indent is not top-level.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "decreaseTopLevel",
|
||||
value: function decreaseTopLevel() {
|
||||
if (this.indentTypes.length > 0 && (0, _utils.last)(this.indentTypes) === INDENT_TYPE_TOP_LEVEL) {
|
||||
this.indentTypes.pop();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Decreases indentation by one block-level indent.
|
||||
* If there are top-level indents within the block-level indent,
|
||||
* throws away these as well.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "decreaseBlockLevel",
|
||||
value: function decreaseBlockLevel() {
|
||||
while (this.indentTypes.length > 0) {
|
||||
var type = this.indentTypes.pop();
|
||||
|
||||
if (type !== INDENT_TYPE_TOP_LEVEL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "resetIndentation",
|
||||
value: function resetIndentation() {
|
||||
this.indentTypes = [];
|
||||
}
|
||||
}]);
|
||||
|
||||
return Indentation;
|
||||
}();
|
||||
|
||||
exports["default"] = Indentation;
|
||||
module.exports = exports.default;
|
120
hera-portal/node_modules/sql-formatter/lib/core/InlineBlock.js
generated
vendored
Normal file
120
hera-portal/node_modules/sql-formatter/lib/core/InlineBlock.js
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _tokenTypes = _interopRequireDefault(require("./tokenTypes"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
var INLINE_MAX_LENGTH = 50;
|
||||
/**
|
||||
* Bookkeeper for inline blocks.
|
||||
*
|
||||
* Inline blocks are parenthized expressions that are shorter than INLINE_MAX_LENGTH.
|
||||
* These blocks are formatted on a single line, unlike longer parenthized
|
||||
* expressions where open-parenthesis causes newline and increase of indentation.
|
||||
*/
|
||||
|
||||
var InlineBlock = /*#__PURE__*/function () {
|
||||
function InlineBlock() {
|
||||
_classCallCheck(this, InlineBlock);
|
||||
|
||||
this.level = 0;
|
||||
}
|
||||
/**
|
||||
* Begins inline block when lookahead through upcoming tokens determines
|
||||
* that the block would be smaller than INLINE_MAX_LENGTH.
|
||||
* @param {Object[]} tokens Array of all tokens
|
||||
* @param {Number} index Current token position
|
||||
*/
|
||||
|
||||
|
||||
_createClass(InlineBlock, [{
|
||||
key: "beginIfPossible",
|
||||
value: function beginIfPossible(tokens, index) {
|
||||
if (this.level === 0 && this.isInlineBlock(tokens, index)) {
|
||||
this.level = 1;
|
||||
} else if (this.level > 0) {
|
||||
this.level++;
|
||||
} else {
|
||||
this.level = 0;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Finishes current inline block.
|
||||
* There might be several nested ones.
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "end",
|
||||
value: function end() {
|
||||
this.level--;
|
||||
}
|
||||
/**
|
||||
* True when inside an inline block
|
||||
* @return {Boolean}
|
||||
*/
|
||||
|
||||
}, {
|
||||
key: "isActive",
|
||||
value: function isActive() {
|
||||
return this.level > 0;
|
||||
} // Check if this should be an inline parentheses block
|
||||
// Examples are "NOW()", "COUNT(*)", "int(10)", key(`somecolumn`), DECIMAL(7,2)
|
||||
|
||||
}, {
|
||||
key: "isInlineBlock",
|
||||
value: function isInlineBlock(tokens, index) {
|
||||
var length = 0;
|
||||
var level = 0;
|
||||
|
||||
for (var i = index; i < tokens.length; i++) {
|
||||
var token = tokens[i];
|
||||
length += token.value.length; // Overran max length
|
||||
|
||||
if (length > INLINE_MAX_LENGTH) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (token.type === _tokenTypes["default"].OPEN_PAREN) {
|
||||
level++;
|
||||
} else if (token.type === _tokenTypes["default"].CLOSE_PAREN) {
|
||||
level--;
|
||||
|
||||
if (level === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isForbiddenToken(token)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
} // Reserved words that cause newlines, comments and semicolons
|
||||
// are not allowed inside inline parentheses block
|
||||
|
||||
}, {
|
||||
key: "isForbiddenToken",
|
||||
value: function isForbiddenToken(_ref) {
|
||||
var type = _ref.type,
|
||||
value = _ref.value;
|
||||
return type === _tokenTypes["default"].RESERVED_TOP_LEVEL || type === _tokenTypes["default"].RESERVED_NEWLINE || type === _tokenTypes["default"].COMMENT || type === _tokenTypes["default"].BLOCK_COMMENT || value === ';';
|
||||
}
|
||||
}]);
|
||||
|
||||
return InlineBlock;
|
||||
}();
|
||||
|
||||
exports["default"] = InlineBlock;
|
||||
module.exports = exports.default;
|
58
hera-portal/node_modules/sql-formatter/lib/core/Params.js
generated
vendored
Normal file
58
hera-portal/node_modules/sql-formatter/lib/core/Params.js
generated
vendored
Normal file
@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
/**
|
||||
* Handles placeholder replacement with given params.
|
||||
*/
|
||||
var Params = /*#__PURE__*/function () {
|
||||
/**
|
||||
* @param {Object} params
|
||||
*/
|
||||
function Params(params) {
|
||||
_classCallCheck(this, Params);
|
||||
|
||||
this.params = params;
|
||||
this.index = 0;
|
||||
}
|
||||
/**
|
||||
* Returns param value that matches given placeholder with param key.
|
||||
* @param {Object} token
|
||||
* @param {String} token.key Placeholder key
|
||||
* @param {String} token.value Placeholder value
|
||||
* @return {String} param or token.value when params are missing
|
||||
*/
|
||||
|
||||
|
||||
_createClass(Params, [{
|
||||
key: "get",
|
||||
value: function get(_ref) {
|
||||
var key = _ref.key,
|
||||
value = _ref.value;
|
||||
|
||||
if (!this.params) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (key) {
|
||||
return this.params[key];
|
||||
}
|
||||
|
||||
return this.params[this.index++];
|
||||
}
|
||||
}]);
|
||||
|
||||
return Params;
|
||||
}();
|
||||
|
||||
exports["default"] = Params;
|
||||
module.exports = exports.default;
|
341
hera-portal/node_modules/sql-formatter/lib/core/Tokenizer.js
generated
vendored
Normal file
341
hera-portal/node_modules/sql-formatter/lib/core/Tokenizer.js
generated
vendored
Normal file
@ -0,0 +1,341 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _tokenTypes = _interopRequireDefault(require("./tokenTypes"));
|
||||
|
||||
var regexFactory = _interopRequireWildcard(require("./regexFactory"));
|
||||
|
||||
var _utils = require("../utils");
|
||||
|
||||
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
||||
|
||||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
||||
|
||||
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
||||
|
||||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
var Tokenizer = /*#__PURE__*/function () {
|
||||
/**
|
||||
* @param {Object} cfg
|
||||
* @param {String[]} cfg.reservedWords Reserved words in SQL
|
||||
* @param {String[]} cfg.reservedTopLevelWords Words that are set to new line separately
|
||||
* @param {String[]} cfg.reservedNewlineWords Words that are set to newline
|
||||
* @param {String[]} cfg.reservedTopLevelWordsNoIndent Words that are top level but have no indentation
|
||||
* @param {String[]} cfg.stringTypes String types to enable: "", '', ``, [], N''
|
||||
* @param {String[]} cfg.openParens Opening parentheses to enable, like (, [
|
||||
* @param {String[]} cfg.closeParens Closing parentheses to enable, like ), ]
|
||||
* @param {String[]} cfg.indexedPlaceholderTypes Prefixes for indexed placeholders, like ?
|
||||
* @param {String[]} cfg.namedPlaceholderTypes Prefixes for named placeholders, like @ and :
|
||||
* @param {String[]} cfg.lineCommentTypes Line comments to enable, like # and --
|
||||
* @param {String[]} cfg.specialWordChars Special chars that can be found inside of words, like @ and #
|
||||
* @param {String[]} [cfg.operator] Additional operators to recognize
|
||||
*/
|
||||
function Tokenizer(cfg) {
|
||||
_classCallCheck(this, Tokenizer);
|
||||
|
||||
this.WHITESPACE_REGEX = /^([\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+)/;
|
||||
this.NUMBER_REGEX = /^((\x2D[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*)?[0-9]+(\.[0-9]+)?([Ee]\x2D?[0-9]+(\.[0-9]+)?)?|0x[0-9A-Fa-f]+|0b[01]+)\b/;
|
||||
this.OPERATOR_REGEX = regexFactory.createOperatorRegex(['<>', '<=', '>='].concat(_toConsumableArray(cfg.operators || [])));
|
||||
this.BLOCK_COMMENT_REGEX = /^(\/\*(?:(?![])[\s\S])*?(?:\*\/|$))/;
|
||||
this.LINE_COMMENT_REGEX = regexFactory.createLineCommentRegex(cfg.lineCommentTypes);
|
||||
this.RESERVED_TOP_LEVEL_REGEX = regexFactory.createReservedWordRegex(cfg.reservedTopLevelWords);
|
||||
this.RESERVED_TOP_LEVEL_NO_INDENT_REGEX = regexFactory.createReservedWordRegex(cfg.reservedTopLevelWordsNoIndent);
|
||||
this.RESERVED_NEWLINE_REGEX = regexFactory.createReservedWordRegex(cfg.reservedNewlineWords);
|
||||
this.RESERVED_PLAIN_REGEX = regexFactory.createReservedWordRegex(cfg.reservedWords);
|
||||
this.WORD_REGEX = regexFactory.createWordRegex(cfg.specialWordChars);
|
||||
this.STRING_REGEX = regexFactory.createStringRegex(cfg.stringTypes);
|
||||
this.OPEN_PAREN_REGEX = regexFactory.createParenRegex(cfg.openParens);
|
||||
this.CLOSE_PAREN_REGEX = regexFactory.createParenRegex(cfg.closeParens);
|
||||
this.INDEXED_PLACEHOLDER_REGEX = regexFactory.createPlaceholderRegex(cfg.indexedPlaceholderTypes, '[0-9]*');
|
||||
this.IDENT_NAMED_PLACEHOLDER_REGEX = regexFactory.createPlaceholderRegex(cfg.namedPlaceholderTypes, '[a-zA-Z0-9._$]+');
|
||||
this.STRING_NAMED_PLACEHOLDER_REGEX = regexFactory.createPlaceholderRegex(cfg.namedPlaceholderTypes, regexFactory.createStringPattern(cfg.stringTypes));
|
||||
}
|
||||
/**
|
||||
* Takes a SQL string and breaks it into tokens.
|
||||
* Each token is an object with type and value.
|
||||
*
|
||||
* @param {String} input The SQL string
|
||||
* @return {Object[]} tokens An array of tokens.
|
||||
* @return {String} token.type
|
||||
* @return {String} token.value
|
||||
* @return {String} token.whitespaceBefore Preceding whitespace
|
||||
*/
|
||||
|
||||
|
||||
_createClass(Tokenizer, [{
|
||||
key: "tokenize",
|
||||
value: function tokenize(input) {
|
||||
var tokens = [];
|
||||
var token; // Keep processing the string until it is empty
|
||||
|
||||
while (input.length) {
|
||||
// grab any preceding whitespace
|
||||
var whitespaceBefore = this.getWhitespace(input);
|
||||
input = input.substring(whitespaceBefore.length);
|
||||
|
||||
if (input.length) {
|
||||
// Get the next token and the token type
|
||||
token = this.getNextToken(input, token); // Advance the string
|
||||
|
||||
input = input.substring(token.value.length);
|
||||
tokens.push(_objectSpread(_objectSpread({}, token), {}, {
|
||||
whitespaceBefore: whitespaceBefore
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
return tokens;
|
||||
}
|
||||
}, {
|
||||
key: "getWhitespace",
|
||||
value: function getWhitespace(input) {
|
||||
var matches = input.match(this.WHITESPACE_REGEX);
|
||||
return matches ? matches[1] : '';
|
||||
}
|
||||
}, {
|
||||
key: "getNextToken",
|
||||
value: function getNextToken(input, previousToken) {
|
||||
return this.getCommentToken(input) || this.getStringToken(input) || this.getOpenParenToken(input) || this.getCloseParenToken(input) || this.getPlaceholderToken(input) || this.getNumberToken(input) || this.getReservedWordToken(input, previousToken) || this.getWordToken(input) || this.getOperatorToken(input);
|
||||
}
|
||||
}, {
|
||||
key: "getCommentToken",
|
||||
value: function getCommentToken(input) {
|
||||
return this.getLineCommentToken(input) || this.getBlockCommentToken(input);
|
||||
}
|
||||
}, {
|
||||
key: "getLineCommentToken",
|
||||
value: function getLineCommentToken(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].LINE_COMMENT,
|
||||
regex: this.LINE_COMMENT_REGEX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getBlockCommentToken",
|
||||
value: function getBlockCommentToken(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].BLOCK_COMMENT,
|
||||
regex: this.BLOCK_COMMENT_REGEX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getStringToken",
|
||||
value: function getStringToken(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].STRING,
|
||||
regex: this.STRING_REGEX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getOpenParenToken",
|
||||
value: function getOpenParenToken(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].OPEN_PAREN,
|
||||
regex: this.OPEN_PAREN_REGEX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getCloseParenToken",
|
||||
value: function getCloseParenToken(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].CLOSE_PAREN,
|
||||
regex: this.CLOSE_PAREN_REGEX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getPlaceholderToken",
|
||||
value: function getPlaceholderToken(input) {
|
||||
return this.getIdentNamedPlaceholderToken(input) || this.getStringNamedPlaceholderToken(input) || this.getIndexedPlaceholderToken(input);
|
||||
}
|
||||
}, {
|
||||
key: "getIdentNamedPlaceholderToken",
|
||||
value: function getIdentNamedPlaceholderToken(input) {
|
||||
return this.getPlaceholderTokenWithKey({
|
||||
input: input,
|
||||
regex: this.IDENT_NAMED_PLACEHOLDER_REGEX,
|
||||
parseKey: function parseKey(v) {
|
||||
return v.slice(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getStringNamedPlaceholderToken",
|
||||
value: function getStringNamedPlaceholderToken(input) {
|
||||
var _this = this;
|
||||
|
||||
return this.getPlaceholderTokenWithKey({
|
||||
input: input,
|
||||
regex: this.STRING_NAMED_PLACEHOLDER_REGEX,
|
||||
parseKey: function parseKey(v) {
|
||||
return _this.getEscapedPlaceholderKey({
|
||||
key: v.slice(2, -1),
|
||||
quoteChar: v.slice(-1)
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getIndexedPlaceholderToken",
|
||||
value: function getIndexedPlaceholderToken(input) {
|
||||
return this.getPlaceholderTokenWithKey({
|
||||
input: input,
|
||||
regex: this.INDEXED_PLACEHOLDER_REGEX,
|
||||
parseKey: function parseKey(v) {
|
||||
return v.slice(1);
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getPlaceholderTokenWithKey",
|
||||
value: function getPlaceholderTokenWithKey(_ref) {
|
||||
var input = _ref.input,
|
||||
regex = _ref.regex,
|
||||
parseKey = _ref.parseKey;
|
||||
var token = this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
regex: regex,
|
||||
type: _tokenTypes["default"].PLACEHOLDER
|
||||
});
|
||||
|
||||
if (token) {
|
||||
token.key = parseKey(token.value);
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
}, {
|
||||
key: "getEscapedPlaceholderKey",
|
||||
value: function getEscapedPlaceholderKey(_ref2) {
|
||||
var key = _ref2.key,
|
||||
quoteChar = _ref2.quoteChar;
|
||||
return key.replace(new RegExp((0, _utils.escapeRegExp)('\\' + quoteChar), 'gu'), quoteChar);
|
||||
} // Decimal, binary, or hex numbers
|
||||
|
||||
}, {
|
||||
key: "getNumberToken",
|
||||
value: function getNumberToken(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].NUMBER,
|
||||
regex: this.NUMBER_REGEX
|
||||
});
|
||||
} // Punctuation and symbols
|
||||
|
||||
}, {
|
||||
key: "getOperatorToken",
|
||||
value: function getOperatorToken(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].OPERATOR,
|
||||
regex: this.OPERATOR_REGEX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getReservedWordToken",
|
||||
value: function getReservedWordToken(input, previousToken) {
|
||||
// A reserved word cannot be preceded by a "."
|
||||
// this makes it so in "mytable.from", "from" is not considered a reserved word
|
||||
if (previousToken && previousToken.value && previousToken.value === '.') {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return this.getTopLevelReservedToken(input) || this.getNewlineReservedToken(input) || this.getTopLevelReservedTokenNoIndent(input) || this.getPlainReservedToken(input);
|
||||
}
|
||||
}, {
|
||||
key: "getTopLevelReservedToken",
|
||||
value: function getTopLevelReservedToken(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].RESERVED_TOP_LEVEL,
|
||||
regex: this.RESERVED_TOP_LEVEL_REGEX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getNewlineReservedToken",
|
||||
value: function getNewlineReservedToken(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].RESERVED_NEWLINE,
|
||||
regex: this.RESERVED_NEWLINE_REGEX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getTopLevelReservedTokenNoIndent",
|
||||
value: function getTopLevelReservedTokenNoIndent(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].RESERVED_TOP_LEVEL_NO_INDENT,
|
||||
regex: this.RESERVED_TOP_LEVEL_NO_INDENT_REGEX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getPlainReservedToken",
|
||||
value: function getPlainReservedToken(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].RESERVED,
|
||||
regex: this.RESERVED_PLAIN_REGEX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getWordToken",
|
||||
value: function getWordToken(input) {
|
||||
return this.getTokenOnFirstMatch({
|
||||
input: input,
|
||||
type: _tokenTypes["default"].WORD,
|
||||
regex: this.WORD_REGEX
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "getTokenOnFirstMatch",
|
||||
value: function getTokenOnFirstMatch(_ref3) {
|
||||
var input = _ref3.input,
|
||||
type = _ref3.type,
|
||||
regex = _ref3.regex;
|
||||
var matches = input.match(regex);
|
||||
return matches ? {
|
||||
type: type,
|
||||
value: matches[1]
|
||||
} : undefined;
|
||||
}
|
||||
}]);
|
||||
|
||||
return Tokenizer;
|
||||
}();
|
||||
|
||||
exports["default"] = Tokenizer;
|
||||
module.exports = exports.default;
|
92
hera-portal/node_modules/sql-formatter/lib/core/regexFactory.js
generated
vendored
Normal file
92
hera-portal/node_modules/sql-formatter/lib/core/regexFactory.js
generated
vendored
Normal file
@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.createOperatorRegex = createOperatorRegex;
|
||||
exports.createLineCommentRegex = createLineCommentRegex;
|
||||
exports.createReservedWordRegex = createReservedWordRegex;
|
||||
exports.createWordRegex = createWordRegex;
|
||||
exports.createStringRegex = createStringRegex;
|
||||
exports.createStringPattern = createStringPattern;
|
||||
exports.createParenRegex = createParenRegex;
|
||||
exports.createPlaceholderRegex = createPlaceholderRegex;
|
||||
|
||||
var _utils = require("../utils");
|
||||
|
||||
function createOperatorRegex(multiLetterOperators) {
|
||||
return new RegExp("^(".concat((0, _utils.sortByLengthDesc)(multiLetterOperators).map(_utils.escapeRegExp).join('|'), "|.)"), 'u');
|
||||
}
|
||||
|
||||
function createLineCommentRegex(lineCommentTypes) {
|
||||
return new RegExp("^((?:".concat(lineCommentTypes.map(function (c) {
|
||||
return (0, _utils.escapeRegExp)(c);
|
||||
}).join('|'), ").*?)(?:\r\n|\r|\n|$)"), 'u');
|
||||
}
|
||||
|
||||
function createReservedWordRegex(reservedWords) {
|
||||
if (reservedWords.length === 0) {
|
||||
return new RegExp("^\b$", 'u');
|
||||
}
|
||||
|
||||
var reservedWordsPattern = (0, _utils.sortByLengthDesc)(reservedWords).join('|').replace(/ /g, '\\s+');
|
||||
return new RegExp("^(".concat(reservedWordsPattern, ")\\b"), 'iu');
|
||||
}
|
||||
|
||||
function createWordRegex() {
|
||||
var specialChars = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
||||
return new RegExp("^([\\p{Alphabetic}\\p{Mark}\\p{Decimal_Number}\\p{Connector_Punctuation}\\p{Join_Control}".concat(specialChars.join(''), "]+)"), 'u');
|
||||
}
|
||||
|
||||
function createStringRegex(stringTypes) {
|
||||
return new RegExp('^(' + createStringPattern(stringTypes) + ')', 'u');
|
||||
} // This enables the following string patterns:
|
||||
// 1. backtick quoted string using `` to escape
|
||||
// 2. square bracket quoted string (SQL Server) using ]] to escape
|
||||
// 3. double quoted string using "" or \" to escape
|
||||
// 4. single quoted string using '' or \' to escape
|
||||
// 5. national character quoted string using N'' or N\' to escape
|
||||
// 6. Unicode single-quoted string using \' to escape
|
||||
// 7. Unicode double-quoted string using \" to escape
|
||||
// 8. PostgreSQL dollar-quoted strings
|
||||
|
||||
|
||||
function createStringPattern(stringTypes) {
|
||||
var patterns = {
|
||||
'``': '((`[^`]*($|`))+)',
|
||||
'{}': '((\\{[^\\}]*($|\\}))+)',
|
||||
'[]': '((\\[[^\\]]*($|\\]))(\\][^\\]]*($|\\]))*)',
|
||||
'""': '(("[^"\\\\]*(?:\\\\.[^"\\\\]*)*("|$))+)',
|
||||
"''": "(('[^'\\\\]*(?:\\\\.[^'\\\\]*)*('|$))+)",
|
||||
"N''": "((N'[^'\\\\]*(?:\\\\.[^'\\\\]*)*('|$))+)",
|
||||
"U&''": "((U&'[^'\\\\]*(?:\\\\.[^'\\\\]*)*('|$))+)",
|
||||
'U&""': '((U&"[^"\\\\]*(?:\\\\.[^"\\\\]*)*("|$))+)',
|
||||
$$: '((?<tag>\\$\\w*\\$)[\\s\\S]*?(?:\\k<tag>|$))'
|
||||
};
|
||||
return stringTypes.map(function (t) {
|
||||
return patterns[t];
|
||||
}).join('|');
|
||||
}
|
||||
|
||||
function createParenRegex(parens) {
|
||||
return new RegExp('^(' + parens.map(escapeParen).join('|') + ')', 'iu');
|
||||
}
|
||||
|
||||
function escapeParen(paren) {
|
||||
if (paren.length === 1) {
|
||||
// A single punctuation character
|
||||
return (0, _utils.escapeRegExp)(paren);
|
||||
} else {
|
||||
// longer word
|
||||
return '\\b' + paren + '\\b';
|
||||
}
|
||||
}
|
||||
|
||||
function createPlaceholderRegex(types, pattern) {
|
||||
if ((0, _utils.isEmpty)(types)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var typesRegex = types.map(_utils.escapeRegExp).join('|');
|
||||
return new RegExp("^((?:".concat(typesRegex, ")(?:").concat(pattern, "))"), 'u');
|
||||
}
|
31
hera-portal/node_modules/sql-formatter/lib/core/token.js
generated
vendored
Normal file
31
hera-portal/node_modules/sql-formatter/lib/core/token.js
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.isEnd = exports.isWindow = exports.isBy = exports.isSet = exports.isLimit = exports.isBetween = exports.isAnd = void 0;
|
||||
|
||||
var _tokenTypes = _interopRequireDefault(require("./tokenTypes"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
var isToken = function isToken(type, regex) {
|
||||
return function (token) {
|
||||
return (token === null || token === void 0 ? void 0 : token.type) === type && regex.test(token === null || token === void 0 ? void 0 : token.value);
|
||||
};
|
||||
};
|
||||
|
||||
var isAnd = isToken(_tokenTypes["default"].RESERVED_NEWLINE, /^AND$/i);
|
||||
exports.isAnd = isAnd;
|
||||
var isBetween = isToken(_tokenTypes["default"].RESERVED, /^BETWEEN$/i);
|
||||
exports.isBetween = isBetween;
|
||||
var isLimit = isToken(_tokenTypes["default"].RESERVED_TOP_LEVEL, /^LIMIT$/i);
|
||||
exports.isLimit = isLimit;
|
||||
var isSet = isToken(_tokenTypes["default"].RESERVED_TOP_LEVEL, /^[S\u017F]ET$/i);
|
||||
exports.isSet = isSet;
|
||||
var isBy = isToken(_tokenTypes["default"].RESERVED, /^BY$/i);
|
||||
exports.isBy = isBy;
|
||||
var isWindow = isToken(_tokenTypes["default"].RESERVED_TOP_LEVEL, /^WINDOW$/i);
|
||||
exports.isWindow = isWindow;
|
||||
var isEnd = isToken(_tokenTypes["default"].CLOSE_PAREN, /^END$/i);
|
||||
exports.isEnd = isEnd;
|
27
hera-portal/node_modules/sql-formatter/lib/core/tokenTypes.js
generated
vendored
Normal file
27
hera-portal/node_modules/sql-formatter/lib/core/tokenTypes.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
/**
|
||||
* Constants for token types
|
||||
*/
|
||||
var _default = {
|
||||
WORD: 'word',
|
||||
STRING: 'string',
|
||||
RESERVED: 'reserved',
|
||||
RESERVED_TOP_LEVEL: 'reserved-top-level',
|
||||
RESERVED_TOP_LEVEL_NO_INDENT: 'reserved-top-level-no-indent',
|
||||
RESERVED_NEWLINE: 'reserved-newline',
|
||||
OPERATOR: 'operator',
|
||||
OPEN_PAREN: 'open-paren',
|
||||
CLOSE_PAREN: 'close-paren',
|
||||
LINE_COMMENT: 'line-comment',
|
||||
BLOCK_COMMENT: 'block-comment',
|
||||
NUMBER: 'number',
|
||||
PLACEHOLDER: 'placeholder'
|
||||
};
|
||||
exports["default"] = _default;
|
||||
module.exports = exports.default;
|
77
hera-portal/node_modules/sql-formatter/lib/languages/Db2Formatter.js
generated
vendored
Normal file
77
hera-portal/node_modules/sql-formatter/lib/languages/Db2Formatter.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
78
hera-portal/node_modules/sql-formatter/lib/languages/MariaDbFormatter.js
generated
vendored
Normal file
78
hera-portal/node_modules/sql-formatter/lib/languages/MariaDbFormatter.js
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _Formatter2 = _interopRequireDefault(require("../core/Formatter"));
|
||||
|
||||
var _Tokenizer = _interopRequireDefault(require("../core/Tokenizer"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var reservedWords = ['ACCESSIBLE', 'ADD', 'ALL', 'ALTER', 'ANALYZE', 'AND', 'AS', 'ASC', 'ASENSITIVE', 'BEFORE', 'BETWEEN', 'BIGINT', 'BINARY', 'BLOB', 'BOTH', 'BY', 'CALL', 'CASCADE', 'CASE', 'CHANGE', 'CHAR', 'CHARACTER', 'CHECK', 'COLLATE', 'COLUMN', 'CONDITION', 'CONSTRAINT', 'CONTINUE', 'CONVERT', 'CREATE', 'CROSS', 'CURRENT_DATE', 'CURRENT_ROLE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_USER', 'CURSOR', 'DATABASE', 'DATABASES', 'DAY_HOUR', 'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT', 'DELAYED', 'DELETE', 'DESC', 'DESCRIBE', 'DETERMINISTIC', 'DISTINCT', 'DISTINCTROW', 'DIV', 'DO_DOMAIN_IDS', 'DOUBLE', 'DROP', 'DUAL', 'EACH', 'ELSE', 'ELSEIF', 'ENCLOSED', 'ESCAPED', 'EXCEPT', 'EXISTS', 'EXIT', 'EXPLAIN', 'FALSE', 'FETCH', 'FLOAT', 'FLOAT4', 'FLOAT8', 'FOR', 'FORCE', 'FOREIGN', 'FROM', 'FULLTEXT', 'GENERAL', 'GRANT', 'GROUP', 'HAVING', 'HIGH_PRIORITY', 'HOUR_MICROSECOND', 'HOUR_MINUTE', 'HOUR_SECOND', 'IF', 'IGNORE', 'IGNORE_DOMAIN_IDS', 'IGNORE_SERVER_IDS', 'IN', 'INDEX', 'INFILE', 'INNER', 'INOUT', 'INSENSITIVE', 'INSERT', 'INT', 'INT1', 'INT2', 'INT3', 'INT4', 'INT8', 'INTEGER', 'INTERSECT', 'INTERVAL', 'INTO', 'IS', 'ITERATE', 'JOIN', 'KEY', 'KEYS', 'KILL', 'LEADING', 'LEAVE', 'LEFT', 'LIKE', 'LIMIT', 'LINEAR', 'LINES', 'LOAD', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCK', 'LONG', 'LONGBLOB', 'LONGTEXT', 'LOOP', 'LOW_PRIORITY', 'MASTER_HEARTBEAT_PERIOD', 'MASTER_SSL_VERIFY_SERVER_CERT', 'MATCH', 'MAXVALUE', 'MEDIUMBLOB', 'MEDIUMINT', 'MEDIUMTEXT', 'MIDDLEINT', 'MINUTE_MICROSECOND', 'MINUTE_SECOND', 'MOD', 'MODIFIES', 'NATURAL', 'NOT', 'NO_WRITE_TO_BINLOG', 'NULL', 'NUMERIC', 'ON', 'OPTIMIZE', 'OPTION', 'OPTIONALLY', 'OR', 'ORDER', 'OUT', 'OUTER', 'OUTFILE', 'OVER', 'PAGE_CHECKSUM', 'PARSE_VCOL_EXPR', 'PARTITION', 'POSITION', 'PRECISION', 'PRIMARY', 'PROCEDURE', 'PURGE', 'RANGE', 'READ', 'READS', 'READ_WRITE', 'REAL', 'RECURSIVE', 'REF_SYSTEM_ID', 'REFERENCES', 'REGEXP', 'RELEASE', 'RENAME', 'REPEAT', 'REPLACE', 'REQUIRE', 'RESIGNAL', 'RESTRICT', 'RETURN', 'RETURNING', 'REVOKE', 'RIGHT', 'RLIKE', 'ROWS', 'SCHEMA', 'SCHEMAS', 'SECOND_MICROSECOND', 'SELECT', 'SENSITIVE', 'SEPARATOR', 'SET', 'SHOW', 'SIGNAL', 'SLOW', 'SMALLINT', 'SPATIAL', 'SPECIFIC', 'SQL', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'SQL_BIG_RESULT', 'SQL_CALC_FOUND_ROWS', 'SQL_SMALL_RESULT', 'SSL', 'STARTING', 'STATS_AUTO_RECALC', 'STATS_PERSISTENT', 'STATS_SAMPLE_PAGES', 'STRAIGHT_JOIN', 'TABLE', 'TERMINATED', 'THEN', 'TINYBLOB', 'TINYINT', 'TINYTEXT', 'TO', 'TRAILING', 'TRIGGER', 'TRUE', 'UNDO', 'UNION', 'UNIQUE', 'UNLOCK', 'UNSIGNED', 'UPDATE', 'USAGE', 'USE', 'USING', 'UTC_DATE', 'UTC_TIME', 'UTC_TIMESTAMP', 'VALUES', 'VARBINARY', 'VARCHAR', 'VARCHARACTER', 'VARYING', 'WHEN', 'WHERE', 'WHILE', 'WINDOW', 'WITH', 'WRITE', 'XOR', 'YEAR_MONTH', 'ZEROFILL'];
|
||||
var reservedTopLevelWords = ['ADD', 'ALTER COLUMN', 'ALTER TABLE', 'DELETE FROM', 'EXCEPT', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'ORDER BY', 'SELECT', 'SET', 'UPDATE', 'VALUES', 'WHERE'];
|
||||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'UNION', 'UNION ALL'];
|
||||
var reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins
|
||||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN', // non-standard joins
|
||||
'STRAIGHT_JOIN', 'NATURAL LEFT JOIN', 'NATURAL LEFT OUTER JOIN', 'NATURAL RIGHT JOIN', 'NATURAL RIGHT OUTER JOIN']; // For reference: https://mariadb.com/kb/en/sql-statements-structure/
|
||||
|
||||
var MariaDbFormatter = /*#__PURE__*/function (_Formatter) {
|
||||
_inherits(MariaDbFormatter, _Formatter);
|
||||
|
||||
var _super = _createSuper(MariaDbFormatter);
|
||||
|
||||
function MariaDbFormatter() {
|
||||
_classCallCheck(this, MariaDbFormatter);
|
||||
|
||||
return _super.apply(this, arguments);
|
||||
}
|
||||
|
||||
_createClass(MariaDbFormatter, [{
|
||||
key: "tokenizer",
|
||||
value: function tokenizer() {
|
||||
return new _Tokenizer["default"]({
|
||||
reservedWords: reservedWords,
|
||||
reservedTopLevelWords: reservedTopLevelWords,
|
||||
reservedNewlineWords: reservedNewlineWords,
|
||||
reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,
|
||||
stringTypes: ['``', "''", '""'],
|
||||
openParens: ['(', 'CASE'],
|
||||
closeParens: [')', 'END'],
|
||||
indexedPlaceholderTypes: ['?'],
|
||||
namedPlaceholderTypes: [],
|
||||
lineCommentTypes: ['--', '#'],
|
||||
specialWordChars: ['@'],
|
||||
operators: [':=', '<<', '>>', '!=', '<>', '<=>', '&&', '||']
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return MariaDbFormatter;
|
||||
}(_Formatter2["default"]);
|
||||
|
||||
exports["default"] = MariaDbFormatter;
|
||||
module.exports = exports.default;
|
78
hera-portal/node_modules/sql-formatter/lib/languages/MySqlFormatter.js
generated
vendored
Normal file
78
hera-portal/node_modules/sql-formatter/lib/languages/MySqlFormatter.js
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _Formatter2 = _interopRequireDefault(require("../core/Formatter"));
|
||||
|
||||
var _Tokenizer = _interopRequireDefault(require("../core/Tokenizer"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var reservedWords = ['ACCESSIBLE', 'ADD', 'ALL', 'ALTER', 'ANALYZE', 'AND', 'AS', 'ASC', 'ASENSITIVE', 'BEFORE', 'BETWEEN', 'BIGINT', 'BINARY', 'BLOB', 'BOTH', 'BY', 'CALL', 'CASCADE', 'CASE', 'CHANGE', 'CHAR', 'CHARACTER', 'CHECK', 'COLLATE', 'COLUMN', 'CONDITION', 'CONSTRAINT', 'CONTINUE', 'CONVERT', 'CREATE', 'CROSS', 'CUBE', 'CUME_DIST', 'CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_USER', 'CURSOR', 'DATABASE', 'DATABASES', 'DAY_HOUR', 'DAY_MICROSECOND', 'DAY_MINUTE', 'DAY_SECOND', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT', 'DELAYED', 'DELETE', 'DENSE_RANK', 'DESC', 'DESCRIBE', 'DETERMINISTIC', 'DISTINCT', 'DISTINCTROW', 'DIV', 'DOUBLE', 'DROP', 'DUAL', 'EACH', 'ELSE', 'ELSEIF', 'EMPTY', 'ENCLOSED', 'ESCAPED', 'EXCEPT', 'EXISTS', 'EXIT', 'EXPLAIN', 'FALSE', 'FETCH', 'FIRST_VALUE', 'FLOAT', 'FLOAT4', 'FLOAT8', 'FOR', 'FORCE', 'FOREIGN', 'FROM', 'FULLTEXT', 'FUNCTION', 'GENERATED', 'GET', 'GRANT', 'GROUP', 'GROUPING', 'GROUPS', 'HAVING', 'HIGH_PRIORITY', 'HOUR_MICROSECOND', 'HOUR_MINUTE', 'HOUR_SECOND', 'IF', 'IGNORE', 'IN', 'INDEX', 'INFILE', 'INNER', 'INOUT', 'INSENSITIVE', 'INSERT', 'INT', 'INT1', 'INT2', 'INT3', 'INT4', 'INT8', 'INTEGER', 'INTERVAL', 'INTO', 'IO_AFTER_GTIDS', 'IO_BEFORE_GTIDS', 'IS', 'ITERATE', 'JOIN', 'JSON_TABLE', 'KEY', 'KEYS', 'KILL', 'LAG', 'LAST_VALUE', 'LATERAL', 'LEAD', 'LEADING', 'LEAVE', 'LEFT', 'LIKE', 'LIMIT', 'LINEAR', 'LINES', 'LOAD', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCK', 'LONG', 'LONGBLOB', 'LONGTEXT', 'LOOP', 'LOW_PRIORITY', 'MASTER_BIND', 'MASTER_SSL_VERIFY_SERVER_CERT', 'MATCH', 'MAXVALUE', 'MEDIUMBLOB', 'MEDIUMINT', 'MEDIUMTEXT', 'MIDDLEINT', 'MINUTE_MICROSECOND', 'MINUTE_SECOND', 'MOD', 'MODIFIES', 'NATURAL', 'NOT', 'NO_WRITE_TO_BINLOG', 'NTH_VALUE', 'NTILE', 'NULL', 'NUMERIC', 'OF', 'ON', 'OPTIMIZE', 'OPTIMIZER_COSTS', 'OPTION', 'OPTIONALLY', 'OR', 'ORDER', 'OUT', 'OUTER', 'OUTFILE', 'OVER', 'PARTITION', 'PERCENT_RANK', 'PRECISION', 'PRIMARY', 'PROCEDURE', 'PURGE', 'RANGE', 'RANK', 'READ', 'READS', 'READ_WRITE', 'REAL', 'RECURSIVE', 'REFERENCES', 'REGEXP', 'RELEASE', 'RENAME', 'REPEAT', 'REPLACE', 'REQUIRE', 'RESIGNAL', 'RESTRICT', 'RETURN', 'REVOKE', 'RIGHT', 'RLIKE', 'ROW', 'ROWS', 'ROW_NUMBER', 'SCHEMA', 'SCHEMAS', 'SECOND_MICROSECOND', 'SELECT', 'SENSITIVE', 'SEPARATOR', 'SET', 'SHOW', 'SIGNAL', 'SMALLINT', 'SPATIAL', 'SPECIFIC', 'SQL', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'SQL_BIG_RESULT', 'SQL_CALC_FOUND_ROWS', 'SQL_SMALL_RESULT', 'SSL', 'STARTING', 'STORED', 'STRAIGHT_JOIN', 'SYSTEM', 'TABLE', 'TERMINATED', 'THEN', 'TINYBLOB', 'TINYINT', 'TINYTEXT', 'TO', 'TRAILING', 'TRIGGER', 'TRUE', 'UNDO', 'UNION', 'UNIQUE', 'UNLOCK', 'UNSIGNED', 'UPDATE', 'USAGE', 'USE', 'USING', 'UTC_DATE', 'UTC_TIME', 'UTC_TIMESTAMP', 'VALUES', 'VARBINARY', 'VARCHAR', 'VARCHARACTER', 'VARYING', 'VIRTUAL', 'WHEN', 'WHERE', 'WHILE', 'WINDOW', 'WITH', 'WRITE', 'XOR', 'YEAR_MONTH', 'ZEROFILL'];
|
||||
var reservedTopLevelWords = ['ADD', 'ALTER COLUMN', 'ALTER TABLE', 'DELETE FROM', 'EXCEPT', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'ORDER BY', 'SELECT', 'SET', 'UPDATE', 'VALUES', 'WHERE'];
|
||||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'UNION', 'UNION ALL'];
|
||||
var reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins
|
||||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN', // non-standard joins
|
||||
'STRAIGHT_JOIN', 'NATURAL LEFT JOIN', 'NATURAL LEFT OUTER JOIN', 'NATURAL RIGHT JOIN', 'NATURAL RIGHT OUTER JOIN'];
|
||||
|
||||
var MySqlFormatter = /*#__PURE__*/function (_Formatter) {
|
||||
_inherits(MySqlFormatter, _Formatter);
|
||||
|
||||
var _super = _createSuper(MySqlFormatter);
|
||||
|
||||
function MySqlFormatter() {
|
||||
_classCallCheck(this, MySqlFormatter);
|
||||
|
||||
return _super.apply(this, arguments);
|
||||
}
|
||||
|
||||
_createClass(MySqlFormatter, [{
|
||||
key: "tokenizer",
|
||||
value: function tokenizer() {
|
||||
return new _Tokenizer["default"]({
|
||||
reservedWords: reservedWords,
|
||||
reservedTopLevelWords: reservedTopLevelWords,
|
||||
reservedNewlineWords: reservedNewlineWords,
|
||||
reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,
|
||||
stringTypes: ['``', "''", '""'],
|
||||
openParens: ['(', 'CASE'],
|
||||
closeParens: [')', 'END'],
|
||||
indexedPlaceholderTypes: ['?'],
|
||||
namedPlaceholderTypes: [],
|
||||
lineCommentTypes: ['--', '#'],
|
||||
specialWordChars: ['@'],
|
||||
operators: [':=', '<<', '>>', '!=', '<>', '<=>', '&&', '||', '->', '->>']
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return MySqlFormatter;
|
||||
}(_Formatter2["default"]);
|
||||
|
||||
exports["default"] = MySqlFormatter;
|
||||
module.exports = exports.default;
|
75
hera-portal/node_modules/sql-formatter/lib/languages/N1qlFormatter.js
generated
vendored
Normal file
75
hera-portal/node_modules/sql-formatter/lib/languages/N1qlFormatter.js
generated
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _Formatter2 = _interopRequireDefault(require("../core/Formatter"));
|
||||
|
||||
var _Tokenizer = _interopRequireDefault(require("../core/Tokenizer"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var reservedWords = ['ALL', 'ALTER', 'ANALYZE', 'AND', 'ANY', 'ARRAY', 'AS', 'ASC', 'BEGIN', 'BETWEEN', 'BINARY', 'BOOLEAN', 'BREAK', 'BUCKET', 'BUILD', 'BY', 'CALL', 'CASE', 'CAST', 'CLUSTER', 'COLLATE', 'COLLECTION', 'COMMIT', 'CONNECT', 'CONTINUE', 'CORRELATE', 'COVER', 'CREATE', 'DATABASE', 'DATASET', 'DATASTORE', 'DECLARE', 'DECREMENT', 'DELETE', 'DERIVED', 'DESC', 'DESCRIBE', 'DISTINCT', 'DO', 'DROP', 'EACH', 'ELEMENT', 'ELSE', 'END', 'EVERY', 'EXCEPT', 'EXCLUDE', 'EXECUTE', 'EXISTS', 'EXPLAIN', 'FALSE', 'FETCH', 'FIRST', 'FLATTEN', 'FOR', 'FORCE', 'FROM', 'FUNCTION', 'GRANT', 'GROUP', 'GSI', 'HAVING', 'IF', 'IGNORE', 'ILIKE', 'IN', 'INCLUDE', 'INCREMENT', 'INDEX', 'INFER', 'INLINE', 'INNER', 'INSERT', 'INTERSECT', 'INTO', 'IS', 'JOIN', 'KEY', 'KEYS', 'KEYSPACE', 'KNOWN', 'LAST', 'LEFT', 'LET', 'LETTING', 'LIKE', 'LIMIT', 'LSM', 'MAP', 'MAPPING', 'MATCHED', 'MATERIALIZED', 'MERGE', 'MISSING', 'NAMESPACE', 'NEST', 'NOT', 'NULL', 'NUMBER', 'OBJECT', 'OFFSET', 'ON', 'OPTION', 'OR', 'ORDER', 'OUTER', 'OVER', 'PARSE', 'PARTITION', 'PASSWORD', 'PATH', 'POOL', 'PREPARE', 'PRIMARY', 'PRIVATE', 'PRIVILEGE', 'PROCEDURE', 'PUBLIC', 'RAW', 'REALM', 'REDUCE', 'RENAME', 'RETURN', 'RETURNING', 'REVOKE', 'RIGHT', 'ROLE', 'ROLLBACK', 'SATISFIES', 'SCHEMA', 'SELECT', 'SELF', 'SEMI', 'SET', 'SHOW', 'SOME', 'START', 'STATISTICS', 'STRING', 'SYSTEM', 'THEN', 'TO', 'TRANSACTION', 'TRIGGER', 'TRUE', 'TRUNCATE', 'UNDER', 'UNION', 'UNIQUE', 'UNKNOWN', 'UNNEST', 'UNSET', 'UPDATE', 'UPSERT', 'USE', 'USER', 'USING', 'VALIDATE', 'VALUE', 'VALUED', 'VALUES', 'VIA', 'VIEW', 'WHEN', 'WHERE', 'WHILE', 'WITH', 'WITHIN', 'WORK', 'XOR'];
|
||||
var reservedTopLevelWords = ['DELETE FROM', 'EXCEPT ALL', 'EXCEPT', 'EXPLAIN DELETE FROM', 'EXPLAIN UPDATE', 'EXPLAIN UPSERT', 'FROM', 'GROUP BY', 'HAVING', 'INFER', 'INSERT INTO', 'LET', 'LIMIT', 'MERGE', 'NEST', 'ORDER BY', 'PREPARE', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'UNNEST', 'UPDATE', 'UPSERT', 'USE KEYS', 'VALUES', 'WHERE'];
|
||||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL'];
|
||||
var reservedNewlineWords = ['AND', 'OR', 'XOR', // joins
|
||||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN']; // For reference: http://docs.couchbase.com.s3-website-us-west-1.amazonaws.com/server/6.0/n1ql/n1ql-language-reference/index.html
|
||||
|
||||
var N1qlFormatter = /*#__PURE__*/function (_Formatter) {
|
||||
_inherits(N1qlFormatter, _Formatter);
|
||||
|
||||
var _super = _createSuper(N1qlFormatter);
|
||||
|
||||
function N1qlFormatter() {
|
||||
_classCallCheck(this, N1qlFormatter);
|
||||
|
||||
return _super.apply(this, arguments);
|
||||
}
|
||||
|
||||
_createClass(N1qlFormatter, [{
|
||||
key: "tokenizer",
|
||||
value: function tokenizer() {
|
||||
return new _Tokenizer["default"]({
|
||||
reservedWords: reservedWords,
|
||||
reservedTopLevelWords: reservedTopLevelWords,
|
||||
reservedNewlineWords: reservedNewlineWords,
|
||||
reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,
|
||||
stringTypes: ["\"\"", "''", '``'],
|
||||
openParens: ['(', '[', '{'],
|
||||
closeParens: [')', ']', '}'],
|
||||
namedPlaceholderTypes: ['$'],
|
||||
lineCommentTypes: ['#', '--'],
|
||||
operators: ['==', '!=']
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return N1qlFormatter;
|
||||
}(_Formatter2["default"]);
|
||||
|
||||
exports["default"] = N1qlFormatter;
|
||||
module.exports = exports.default;
|
93
hera-portal/node_modules/sql-formatter/lib/languages/PlSqlFormatter.js
generated
vendored
Normal file
93
hera-portal/node_modules/sql-formatter/lib/languages/PlSqlFormatter.js
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _Formatter2 = _interopRequireDefault(require("../core/Formatter"));
|
||||
|
||||
var _token = require("../core/token");
|
||||
|
||||
var _Tokenizer = _interopRequireDefault(require("../core/Tokenizer"));
|
||||
|
||||
var _tokenTypes = _interopRequireDefault(require("../core/tokenTypes"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var reservedWords = ['A', 'ACCESSIBLE', 'AGENT', 'AGGREGATE', 'ALL', 'ALTER', 'ANY', 'ARRAY', 'AS', 'ASC', 'AT', 'ATTRIBUTE', 'AUTHID', 'AVG', 'BETWEEN', 'BFILE_BASE', 'BINARY_INTEGER', 'BINARY', 'BLOB_BASE', 'BLOCK', 'BODY', 'BOOLEAN', 'BOTH', 'BOUND', 'BREADTH', 'BULK', 'BY', 'BYTE', 'C', 'CALL', 'CALLING', 'CASCADE', 'CASE', 'CHAR_BASE', 'CHAR', 'CHARACTER', 'CHARSET', 'CHARSETFORM', 'CHARSETID', 'CHECK', 'CLOB_BASE', 'CLONE', 'CLOSE', 'CLUSTER', 'CLUSTERS', 'COALESCE', 'COLAUTH', 'COLLECT', 'COLUMNS', 'COMMENT', 'COMMIT', 'COMMITTED', 'COMPILED', 'COMPRESS', 'CONNECT', 'CONSTANT', 'CONSTRUCTOR', 'CONTEXT', 'CONTINUE', 'CONVERT', 'COUNT', 'CRASH', 'CREATE', 'CREDENTIAL', 'CURRENT', 'CURRVAL', 'CURSOR', 'CUSTOMDATUM', 'DANGLING', 'DATA', 'DATE_BASE', 'DATE', 'DAY', 'DECIMAL', 'DEFAULT', 'DEFINE', 'DELETE', 'DEPTH', 'DESC', 'DETERMINISTIC', 'DIRECTORY', 'DISTINCT', 'DO', 'DOUBLE', 'DROP', 'DURATION', 'ELEMENT', 'ELSIF', 'EMPTY', 'END', 'ESCAPE', 'EXCEPTIONS', 'EXCLUSIVE', 'EXECUTE', 'EXISTS', 'EXIT', 'EXTENDS', 'EXTERNAL', 'EXTRACT', 'FALSE', 'FETCH', 'FINAL', 'FIRST', 'FIXED', 'FLOAT', 'FOR', 'FORALL', 'FORCE', 'FROM', 'FUNCTION', 'GENERAL', 'GOTO', 'GRANT', 'GROUP', 'HASH', 'HEAP', 'HIDDEN', 'HOUR', 'IDENTIFIED', 'IF', 'IMMEDIATE', 'IN', 'INCLUDING', 'INDEX', 'INDEXES', 'INDICATOR', 'INDICES', 'INFINITE', 'INSTANTIABLE', 'INT', 'INTEGER', 'INTERFACE', 'INTERVAL', 'INTO', 'INVALIDATE', 'IS', 'ISOLATION', 'JAVA', 'LANGUAGE', 'LARGE', 'LEADING', 'LENGTH', 'LEVEL', 'LIBRARY', 'LIKE', 'LIKE2', 'LIKE4', 'LIKEC', 'LIMITED', 'LOCAL', 'LOCK', 'LONG', 'MAP', 'MAX', 'MAXLEN', 'MEMBER', 'MERGE', 'MIN', 'MINUTE', 'MLSLABEL', 'MOD', 'MODE', 'MONTH', 'MULTISET', 'NAME', 'NAN', 'NATIONAL', 'NATIVE', 'NATURAL', 'NATURALN', 'NCHAR', 'NEW', 'NEXTVAL', 'NOCOMPRESS', 'NOCOPY', 'NOT', 'NOWAIT', 'NULL', 'NULLIF', 'NUMBER_BASE', 'NUMBER', 'OBJECT', 'OCICOLL', 'OCIDATE', 'OCIDATETIME', 'OCIDURATION', 'OCIINTERVAL', 'OCILOBLOCATOR', 'OCINUMBER', 'OCIRAW', 'OCIREF', 'OCIREFCURSOR', 'OCIROWID', 'OCISTRING', 'OCITYPE', 'OF', 'OLD', 'ON', 'ONLY', 'OPAQUE', 'OPEN', 'OPERATOR', 'OPTION', 'ORACLE', 'ORADATA', 'ORDER', 'ORGANIZATION', 'ORLANY', 'ORLVARY', 'OTHERS', 'OUT', 'OVERLAPS', 'OVERRIDING', 'PACKAGE', 'PARALLEL_ENABLE', 'PARAMETER', 'PARAMETERS', 'PARENT', 'PARTITION', 'PASCAL', 'PCTFREE', 'PIPE', 'PIPELINED', 'PLS_INTEGER', 'PLUGGABLE', 'POSITIVE', 'POSITIVEN', 'PRAGMA', 'PRECISION', 'PRIOR', 'PRIVATE', 'PROCEDURE', 'PUBLIC', 'RAISE', 'RANGE', 'RAW', 'READ', 'REAL', 'RECORD', 'REF', 'REFERENCE', 'RELEASE', 'RELIES_ON', 'REM', 'REMAINDER', 'RENAME', 'RESOURCE', 'RESULT_CACHE', 'RESULT', 'RETURN', 'RETURNING', 'REVERSE', 'REVOKE', 'ROLLBACK', 'ROW', 'ROWID', 'ROWNUM', 'ROWTYPE', 'SAMPLE', 'SAVE', 'SAVEPOINT', 'SB1', 'SB2', 'SB4', 'SEARCH', 'SECOND', 'SEGMENT', 'SELF', 'SEPARATE', 'SEQUENCE', 'SERIALIZABLE', 'SHARE', 'SHORT', 'SIZE_T', 'SIZE', 'SMALLINT', 'SOME', 'SPACE', 'SPARSE', 'SQL', 'SQLCODE', 'SQLDATA', 'SQLERRM', 'SQLNAME', 'SQLSTATE', 'STANDARD', 'START', 'STATIC', 'STDDEV', 'STORED', 'STRING', 'STRUCT', 'STYLE', 'SUBMULTISET', 'SUBPARTITION', 'SUBSTITUTABLE', 'SUBTYPE', 'SUCCESSFUL', 'SUM', 'SYNONYM', 'SYSDATE', 'TABAUTH', 'TABLE', 'TDO', 'THE', 'THEN', 'TIME', 'TIMESTAMP', 'TIMEZONE_ABBR', 'TIMEZONE_HOUR', 'TIMEZONE_MINUTE', 'TIMEZONE_REGION', 'TO', 'TRAILING', 'TRANSACTION', 'TRANSACTIONAL', 'TRIGGER', 'TRUE', 'TRUSTED', 'TYPE', 'UB1', 'UB2', 'UB4', 'UID', 'UNDER', 'UNIQUE', 'UNPLUG', 'UNSIGNED', 'UNTRUSTED', 'USE', 'USER', 'USING', 'VALIDATE', 'VALIST', 'VALUE', 'VARCHAR', 'VARCHAR2', 'VARIABLE', 'VARIANCE', 'VARRAY', 'VARYING', 'VIEW', 'VIEWS', 'VOID', 'WHENEVER', 'WHILE', 'WITH', 'WORK', 'WRAPPED', 'WRITE', 'YEAR', 'ZONE'];
|
||||
var reservedTopLevelWords = ['ADD', 'ALTER COLUMN', 'ALTER TABLE', 'BEGIN', 'CONNECT BY', 'DECLARE', 'DELETE FROM', 'DELETE', 'END', 'EXCEPT', 'EXCEPTION', 'FETCH FIRST', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'LOOP', 'MODIFY', 'ORDER BY', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'START WITH', 'UPDATE', 'VALUES', 'WHERE'];
|
||||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL'];
|
||||
var reservedNewlineWords = ['AND', 'CROSS APPLY', 'ELSE', 'END', 'OR', 'OUTER APPLY', 'WHEN', 'XOR', // joins
|
||||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN'];
|
||||
|
||||
var PlSqlFormatter = /*#__PURE__*/function (_Formatter) {
|
||||
_inherits(PlSqlFormatter, _Formatter);
|
||||
|
||||
var _super = _createSuper(PlSqlFormatter);
|
||||
|
||||
function PlSqlFormatter() {
|
||||
_classCallCheck(this, PlSqlFormatter);
|
||||
|
||||
return _super.apply(this, arguments);
|
||||
}
|
||||
|
||||
_createClass(PlSqlFormatter, [{
|
||||
key: "tokenizer",
|
||||
value: function tokenizer() {
|
||||
return new _Tokenizer["default"]({
|
||||
reservedWords: reservedWords,
|
||||
reservedTopLevelWords: reservedTopLevelWords,
|
||||
reservedNewlineWords: reservedNewlineWords,
|
||||
reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,
|
||||
stringTypes: ["\"\"", "N''", "''", '``'],
|
||||
openParens: ['(', 'CASE'],
|
||||
closeParens: [')', 'END'],
|
||||
indexedPlaceholderTypes: ['?'],
|
||||
namedPlaceholderTypes: [':'],
|
||||
lineCommentTypes: ['--'],
|
||||
specialWordChars: ['_', '$', '#', '.', '@'],
|
||||
operators: ['||', '**', '!=', ':=']
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "tokenOverride",
|
||||
value: function tokenOverride(token) {
|
||||
if ((0, _token.isSet)(token) && (0, _token.isBy)(this.previousReservedToken)) {
|
||||
return {
|
||||
type: _tokenTypes["default"].RESERVED,
|
||||
value: token.value
|
||||
};
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
}]);
|
||||
|
||||
return PlSqlFormatter;
|
||||
}(_Formatter2["default"]);
|
||||
|
||||
exports["default"] = PlSqlFormatter;
|
||||
module.exports = exports.default;
|
76
hera-portal/node_modules/sql-formatter/lib/languages/PostgreSqlFormatter.js
generated
vendored
Normal file
76
hera-portal/node_modules/sql-formatter/lib/languages/PostgreSqlFormatter.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _Formatter2 = _interopRequireDefault(require("../core/Formatter"));
|
||||
|
||||
var _Tokenizer = _interopRequireDefault(require("../core/Tokenizer"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var reservedWords = ['ABORT', 'ABSOLUTE', 'ACCESS', 'ACTION', 'ADD', 'ADMIN', 'AFTER', 'AGGREGATE', 'ALL', 'ALSO', 'ALTER', 'ALWAYS', 'ANALYSE', 'ANALYZE', 'AND', 'ANY', 'ARRAY', 'AS', 'ASC', 'ASSERTION', 'ASSIGNMENT', 'ASYMMETRIC', 'AT', 'ATTACH', 'ATTRIBUTE', 'AUTHORIZATION', 'BACKWARD', 'BEFORE', 'BEGIN', 'BETWEEN', 'BIGINT', 'BINARY', 'BIT', 'BOOLEAN', 'BOTH', 'BY', 'CACHE', 'CALL', 'CALLED', 'CASCADE', 'CASCADED', 'CASE', 'CAST', 'CATALOG', 'CHAIN', 'CHAR', 'CHARACTER', 'CHARACTERISTICS', 'CHECK', 'CHECKPOINT', 'CLASS', 'CLOSE', 'CLUSTER', 'COALESCE', 'COLLATE', 'COLLATION', 'COLUMN', 'COLUMNS', 'COMMENT', 'COMMENTS', 'COMMIT', 'COMMITTED', 'CONCURRENTLY', 'CONFIGURATION', 'CONFLICT', 'CONNECTION', 'CONSTRAINT', 'CONSTRAINTS', 'CONTENT', 'CONTINUE', 'CONVERSION', 'COPY', 'COST', 'CREATE', 'CROSS', 'CSV', 'CUBE', 'CURRENT', 'CURRENT_CATALOG', 'CURRENT_DATE', 'CURRENT_ROLE', 'CURRENT_SCHEMA', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_USER', 'CURSOR', 'CYCLE', 'DATA', 'DATABASE', 'DAY', 'DEALLOCATE', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT', 'DEFAULTS', 'DEFERRABLE', 'DEFERRED', 'DEFINER', 'DELETE', 'DELIMITER', 'DELIMITERS', 'DEPENDS', 'DESC', 'DETACH', 'DICTIONARY', 'DISABLE', 'DISCARD', 'DISTINCT', 'DO', 'DOCUMENT', 'DOMAIN', 'DOUBLE', 'DROP', 'EACH', 'ELSE', 'ENABLE', 'ENCODING', 'ENCRYPTED', 'END', 'ENUM', 'ESCAPE', 'EVENT', 'EXCEPT', 'EXCLUDE', 'EXCLUDING', 'EXCLUSIVE', 'EXECUTE', 'EXISTS', 'EXPLAIN', 'EXPRESSION', 'EXTENSION', 'EXTERNAL', 'EXTRACT', 'FALSE', 'FAMILY', 'FETCH', 'FILTER', 'FIRST', 'FLOAT', 'FOLLOWING', 'FOR', 'FORCE', 'FOREIGN', 'FORWARD', 'FREEZE', 'FROM', 'FULL', 'FUNCTION', 'FUNCTIONS', 'GENERATED', 'GLOBAL', 'GRANT', 'GRANTED', 'GREATEST', 'GROUP', 'GROUPING', 'GROUPS', 'HANDLER', 'HAVING', 'HEADER', 'HOLD', 'HOUR', 'IDENTITY', 'IF', 'ILIKE', 'IMMEDIATE', 'IMMUTABLE', 'IMPLICIT', 'IMPORT', 'IN', 'INCLUDE', 'INCLUDING', 'INCREMENT', 'INDEX', 'INDEXES', 'INHERIT', 'INHERITS', 'INITIALLY', 'INLINE', 'INNER', 'INOUT', 'INPUT', 'INSENSITIVE', 'INSERT', 'INSTEAD', 'INT', 'INTEGER', 'INTERSECT', 'INTERVAL', 'INTO', 'INVOKER', 'IS', 'ISNULL', 'ISOLATION', 'JOIN', 'KEY', 'LABEL', 'LANGUAGE', 'LARGE', 'LAST', 'LATERAL', 'LEADING', 'LEAKPROOF', 'LEAST', 'LEFT', 'LEVEL', 'LIKE', 'LIMIT', 'LISTEN', 'LOAD', 'LOCAL', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOCATION', 'LOCK', 'LOCKED', 'LOGGED', 'MAPPING', 'MATCH', 'MATERIALIZED', 'MAXVALUE', 'METHOD', 'MINUTE', 'MINVALUE', 'MODE', 'MONTH', 'MOVE', 'NAME', 'NAMES', 'NATIONAL', 'NATURAL', 'NCHAR', 'NEW', 'NEXT', 'NFC', 'NFD', 'NFKC', 'NFKD', 'NO', 'NONE', 'NORMALIZE', 'NORMALIZED', 'NOT', 'NOTHING', 'NOTIFY', 'NOTNULL', 'NOWAIT', 'NULL', 'NULLIF', 'NULLS', 'NUMERIC', 'OBJECT', 'OF', 'OFF', 'OFFSET', 'OIDS', 'OLD', 'ON', 'ONLY', 'OPERATOR', 'OPTION', 'OPTIONS', 'OR', 'ORDER', 'ORDINALITY', 'OTHERS', 'OUT', 'OUTER', 'OVER', 'OVERLAPS', 'OVERLAY', 'OVERRIDING', 'OWNED', 'OWNER', 'PARALLEL', 'PARSER', 'PARTIAL', 'PARTITION', 'PASSING', 'PASSWORD', 'PLACING', 'PLANS', 'POLICY', 'POSITION', 'PRECEDING', 'PRECISION', 'PREPARE', 'PREPARED', 'PRESERVE', 'PRIMARY', 'PRIOR', 'PRIVILEGES', 'PROCEDURAL', 'PROCEDURE', 'PROCEDURES', 'PROGRAM', 'PUBLICATION', 'QUOTE', 'RANGE', 'READ', 'REAL', 'REASSIGN', 'RECHECK', 'RECURSIVE', 'REF', 'REFERENCES', 'REFERENCING', 'REFRESH', 'REINDEX', 'RELATIVE', 'RELEASE', 'RENAME', 'REPEATABLE', 'REPLACE', 'REPLICA', 'RESET', 'RESTART', 'RESTRICT', 'RETURNING', 'RETURNS', 'REVOKE', 'RIGHT', 'ROLE', 'ROLLBACK', 'ROLLUP', 'ROUTINE', 'ROUTINES', 'ROW', 'ROWS', 'RULE', 'SAVEPOINT', 'SCHEMA', 'SCHEMAS', 'SCROLL', 'SEARCH', 'SECOND', 'SECURITY', 'SELECT', 'SEQUENCE', 'SEQUENCES', 'SERIALIZABLE', 'SERVER', 'SESSION', 'SESSION_USER', 'SET', 'SETOF', 'SETS', 'SHARE', 'SHOW', 'SIMILAR', 'SIMPLE', 'SKIP', 'SMALLINT', 'SNAPSHOT', 'SOME', 'SQL', 'STABLE', 'STANDALONE', 'START', 'STATEMENT', 'STATISTICS', 'STDIN', 'STDOUT', 'STORAGE', 'STORED', 'STRICT', 'STRIP', 'SUBSCRIPTION', 'SUBSTRING', 'SUPPORT', 'SYMMETRIC', 'SYSID', 'SYSTEM', 'TABLE', 'TABLES', 'TABLESAMPLE', 'TABLESPACE', 'TEMP', 'TEMPLATE', 'TEMPORARY', 'TEXT', 'THEN', 'TIES', 'TIME', 'TIMESTAMP', 'TO', 'TRAILING', 'TRANSACTION', 'TRANSFORM', 'TREAT', 'TRIGGER', 'TRIM', 'TRUE', 'TRUNCATE', 'TRUSTED', 'TYPE', 'TYPES', 'UESCAPE', 'UNBOUNDED', 'UNCOMMITTED', 'UNENCRYPTED', 'UNION', 'UNIQUE', 'UNKNOWN', 'UNLISTEN', 'UNLOGGED', 'UNTIL', 'UPDATE', 'USER', 'USING', 'VACUUM', 'VALID', 'VALIDATE', 'VALIDATOR', 'VALUE', 'VALUES', 'VARCHAR', 'VARIADIC', 'VARYING', 'VERBOSE', 'VERSION', 'VIEW', 'VIEWS', 'VOLATILE', 'WHEN', 'WHERE', 'WHITESPACE', 'WINDOW', 'WITH', 'WITHIN', 'WITHOUT', 'WORK', 'WRAPPER', 'WRITE', 'XML', 'XMLATTRIBUTES', 'XMLCONCAT', 'XMLELEMENT', 'XMLEXISTS', 'XMLFOREST', 'XMLNAMESPACES', 'XMLPARSE', 'XMLPI', 'XMLROOT', 'XMLSERIALIZE', 'XMLTABLE', 'YEAR', 'YES', 'ZONE'];
|
||||
var reservedTopLevelWords = ['ADD', 'AFTER', 'ALTER COLUMN', 'ALTER TABLE', 'CASE', 'DELETE FROM', 'END', 'EXCEPT', 'FETCH FIRST', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'ORDER BY', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'UPDATE', 'VALUES', 'WHERE'];
|
||||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'UNION', 'UNION ALL'];
|
||||
var reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins
|
||||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN'];
|
||||
|
||||
var PostgreSqlFormatter = /*#__PURE__*/function (_Formatter) {
|
||||
_inherits(PostgreSqlFormatter, _Formatter);
|
||||
|
||||
var _super = _createSuper(PostgreSqlFormatter);
|
||||
|
||||
function PostgreSqlFormatter() {
|
||||
_classCallCheck(this, PostgreSqlFormatter);
|
||||
|
||||
return _super.apply(this, arguments);
|
||||
}
|
||||
|
||||
_createClass(PostgreSqlFormatter, [{
|
||||
key: "tokenizer",
|
||||
value: function tokenizer() {
|
||||
return new _Tokenizer["default"]({
|
||||
reservedWords: reservedWords,
|
||||
reservedTopLevelWords: reservedTopLevelWords,
|
||||
reservedNewlineWords: reservedNewlineWords,
|
||||
reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,
|
||||
stringTypes: ["\"\"", "''", "U&''", 'U&""', '$$'],
|
||||
openParens: ['(', 'CASE'],
|
||||
closeParens: [')', 'END'],
|
||||
indexedPlaceholderTypes: ['$'],
|
||||
namedPlaceholderTypes: [':'],
|
||||
lineCommentTypes: ['--'],
|
||||
operators: ['!=', '<<', '>>', '||/', '|/', '::', '->>', '->', '~~*', '~~', '!~~*', '!~~', '~*', '!~*', '!~', '!!']
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return PostgreSqlFormatter;
|
||||
}(_Formatter2["default"]);
|
||||
|
||||
exports["default"] = PostgreSqlFormatter;
|
||||
module.exports = exports.default;
|
76
hera-portal/node_modules/sql-formatter/lib/languages/RedshiftFormatter.js
generated
vendored
Normal file
76
hera-portal/node_modules/sql-formatter/lib/languages/RedshiftFormatter.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _Formatter2 = _interopRequireDefault(require("../core/Formatter"));
|
||||
|
||||
var _Tokenizer = _interopRequireDefault(require("../core/Tokenizer"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var reservedWords = ['AES128', 'AES256', 'ALLOWOVERWRITE', 'ANALYSE', 'ARRAY', 'AS', 'ASC', 'AUTHORIZATION', 'BACKUP', 'BINARY', 'BLANKSASNULL', 'BOTH', 'BYTEDICT', 'BZIP2', 'CAST', 'CHECK', 'COLLATE', 'COLUMN', 'CONSTRAINT', 'CREATE', 'CREDENTIALS', 'CURRENT_DATE', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_USER', 'CURRENT_USER_ID', 'DEFAULT', 'DEFERRABLE', 'DEFLATE', 'DEFRAG', 'DELTA', 'DELTA32K', 'DESC', 'DISABLE', 'DISTINCT', 'DO', 'ELSE', 'EMPTYASNULL', 'ENABLE', 'ENCODE', 'ENCRYPT', 'ENCRYPTION', 'END', 'EXPLICIT', 'FALSE', 'FOR', 'FOREIGN', 'FREEZE', 'FULL', 'GLOBALDICT256', 'GLOBALDICT64K', 'GRANT', 'GZIP', 'IDENTITY', 'IGNORE', 'ILIKE', 'INITIALLY', 'INTO', 'LEADING', 'LOCALTIME', 'LOCALTIMESTAMP', 'LUN', 'LUNS', 'LZO', 'LZOP', 'MINUS', 'MOSTLY13', 'MOSTLY32', 'MOSTLY8', 'NATURAL', 'NEW', 'NULLS', 'OFF', 'OFFLINE', 'OFFSET', 'OLD', 'ON', 'ONLY', 'OPEN', 'ORDER', 'OVERLAPS', 'PARALLEL', 'PARTITION', 'PERCENT', 'PERMISSIONS', 'PLACING', 'PRIMARY', 'RAW', 'READRATIO', 'RECOVER', 'REFERENCES', 'REJECTLOG', 'RESORT', 'RESTORE', 'SESSION_USER', 'SIMILAR', 'SYSDATE', 'SYSTEM', 'TABLE', 'TAG', 'TDES', 'TEXT255', 'TEXT32K', 'THEN', 'TIMESTAMP', 'TO', 'TOP', 'TRAILING', 'TRUE', 'TRUNCATECOLUMNS', 'UNIQUE', 'USER', 'USING', 'VERBOSE', 'WALLET', 'WHEN', 'WITH', 'WITHOUT', 'PREDICATE', 'COLUMNS', 'COMPROWS', 'COMPRESSION', 'COPY', 'FORMAT', 'DELIMITER', 'FIXEDWIDTH', 'AVRO', 'JSON', 'ENCRYPTED', 'BZIP2', 'GZIP', 'LZOP', 'PARQUET', 'ORC', 'ACCEPTANYDATE', 'ACCEPTINVCHARS', 'BLANKSASNULL', 'DATEFORMAT', 'EMPTYASNULL', 'ENCODING', 'ESCAPE', 'EXPLICIT_IDS', 'FILLRECORD', 'IGNOREBLANKLINES', 'IGNOREHEADER', 'NULL AS', 'REMOVEQUOTES', 'ROUNDEC', 'TIMEFORMAT', 'TRIMBLANKS', 'TRUNCATECOLUMNS', 'COMPROWS', 'COMPUPDATE', 'MAXERROR', 'NOLOAD', 'STATUPDATE', 'MANIFEST', 'REGION', 'IAM_ROLE', 'MASTER_SYMMETRIC_KEY', 'SSH', 'ACCEPTANYDATE', 'ACCEPTINVCHARS', 'ACCESS_KEY_ID', 'SECRET_ACCESS_KEY', 'AVRO', 'BLANKSASNULL', 'BZIP2', 'COMPROWS', 'COMPUPDATE', 'CREDENTIALS', 'DATEFORMAT', 'DELIMITER', 'EMPTYASNULL', 'ENCODING', 'ENCRYPTED', 'ESCAPE', 'EXPLICIT_IDS', 'FILLRECORD', 'FIXEDWIDTH', 'FORMAT', 'IAM_ROLE', 'GZIP', 'IGNOREBLANKLINES', 'IGNOREHEADER', 'JSON', 'LZOP', 'MANIFEST', 'MASTER_SYMMETRIC_KEY', 'MAXERROR', 'NOLOAD', 'NULL AS', 'READRATIO', 'REGION', 'REMOVEQUOTES', 'ROUNDEC', 'SSH', 'STATUPDATE', 'TIMEFORMAT', 'SESSION_TOKEN', 'TRIMBLANKS', 'TRUNCATECOLUMNS', 'EXTERNAL', 'DATA CATALOG', 'HIVE METASTORE', 'CATALOG_ROLE', 'VACUUM', 'COPY', 'UNLOAD', 'EVEN', 'ALL'];
|
||||
var reservedTopLevelWords = ['ADD', 'AFTER', 'ALTER COLUMN', 'ALTER TABLE', 'DELETE FROM', 'EXCEPT', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'INTERSECT', 'TOP', 'LIMIT', 'MODIFY', 'ORDER BY', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'UNION ALL', 'UNION', 'UPDATE', 'VALUES', 'WHERE', 'VACUUM', 'COPY', 'UNLOAD', 'ANALYZE', 'ANALYSE', 'DISTKEY', 'SORTKEY', 'COMPOUND', 'INTERLEAVED', 'FORMAT', 'DELIMITER', 'FIXEDWIDTH', 'AVRO', 'JSON', 'ENCRYPTED', 'BZIP2', 'GZIP', 'LZOP', 'PARQUET', 'ORC', 'ACCEPTANYDATE', 'ACCEPTINVCHARS', 'BLANKSASNULL', 'DATEFORMAT', 'EMPTYASNULL', 'ENCODING', 'ESCAPE', 'EXPLICIT_IDS', 'FILLRECORD', 'IGNOREBLANKLINES', 'IGNOREHEADER', 'NULL AS', 'REMOVEQUOTES', 'ROUNDEC', 'TIMEFORMAT', 'TRIMBLANKS', 'TRUNCATECOLUMNS', 'COMPROWS', 'COMPUPDATE', 'MAXERROR', 'NOLOAD', 'STATUPDATE', 'MANIFEST', 'REGION', 'IAM_ROLE', 'MASTER_SYMMETRIC_KEY', 'SSH', 'ACCEPTANYDATE', 'ACCEPTINVCHARS', 'ACCESS_KEY_ID', 'SECRET_ACCESS_KEY', 'AVRO', 'BLANKSASNULL', 'BZIP2', 'COMPROWS', 'COMPUPDATE', 'CREDENTIALS', 'DATEFORMAT', 'DELIMITER', 'EMPTYASNULL', 'ENCODING', 'ENCRYPTED', 'ESCAPE', 'EXPLICIT_IDS', 'FILLRECORD', 'FIXEDWIDTH', 'FORMAT', 'IAM_ROLE', 'GZIP', 'IGNOREBLANKLINES', 'IGNOREHEADER', 'JSON', 'LZOP', 'MANIFEST', 'MASTER_SYMMETRIC_KEY', 'MAXERROR', 'NOLOAD', 'NULL AS', 'READRATIO', 'REGION', 'REMOVEQUOTES', 'ROUNDEC', 'SSH', 'STATUPDATE', 'TIMEFORMAT', 'SESSION_TOKEN', 'TRIMBLANKS', 'TRUNCATECOLUMNS', 'EXTERNAL', 'DATA CATALOG', 'HIVE METASTORE', 'CATALOG_ROLE'];
|
||||
var reservedTopLevelWordsNoIndent = [];
|
||||
var reservedNewlineWords = ['AND', 'ELSE', 'OR', 'OUTER APPLY', 'WHEN', 'VACUUM', 'COPY', 'UNLOAD', 'ANALYZE', 'ANALYSE', 'DISTKEY', 'SORTKEY', 'COMPOUND', 'INTERLEAVED', // joins
|
||||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN'];
|
||||
|
||||
var RedshiftFormatter = /*#__PURE__*/function (_Formatter) {
|
||||
_inherits(RedshiftFormatter, _Formatter);
|
||||
|
||||
var _super = _createSuper(RedshiftFormatter);
|
||||
|
||||
function RedshiftFormatter() {
|
||||
_classCallCheck(this, RedshiftFormatter);
|
||||
|
||||
return _super.apply(this, arguments);
|
||||
}
|
||||
|
||||
_createClass(RedshiftFormatter, [{
|
||||
key: "tokenizer",
|
||||
value: function tokenizer() {
|
||||
return new _Tokenizer["default"]({
|
||||
reservedWords: reservedWords,
|
||||
reservedTopLevelWords: reservedTopLevelWords,
|
||||
reservedNewlineWords: reservedNewlineWords,
|
||||
reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,
|
||||
stringTypes: ["\"\"", "''", '``'],
|
||||
openParens: ['('],
|
||||
closeParens: [')'],
|
||||
indexedPlaceholderTypes: ['?'],
|
||||
namedPlaceholderTypes: ['@', '#', '$'],
|
||||
lineCommentTypes: ['--'],
|
||||
operators: ['|/', '||/', '<<', '>>', '!=', '||']
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return RedshiftFormatter;
|
||||
}(_Formatter2["default"]);
|
||||
|
||||
exports["default"] = RedshiftFormatter;
|
||||
module.exports = exports.default;
|
112
hera-portal/node_modules/sql-formatter/lib/languages/SparkSqlFormatter.js
generated
vendored
Normal file
112
hera-portal/node_modules/sql-formatter/lib/languages/SparkSqlFormatter.js
generated
vendored
Normal file
@ -0,0 +1,112 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _Formatter2 = _interopRequireDefault(require("../core/Formatter"));
|
||||
|
||||
var _token = require("../core/token");
|
||||
|
||||
var _Tokenizer = _interopRequireDefault(require("../core/Tokenizer"));
|
||||
|
||||
var _tokenTypes = _interopRequireDefault(require("../core/tokenTypes"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var reservedWords = ['ALL', 'ALTER', 'ANALYSE', 'ANALYZE', 'ARRAY_ZIP', 'ARRAY', 'AS', 'ASC', 'AVG', 'BETWEEN', 'CASCADE', 'CASE', 'CAST', 'COALESCE', 'COLLECT_LIST', 'COLLECT_SET', 'COLUMN', 'COLUMNS', 'COMMENT', 'CONSTRAINT', 'CONTAINS', 'CONVERT', 'COUNT', 'CUME_DIST', 'CURRENT ROW', 'CURRENT_DATE', 'CURRENT_TIMESTAMP', 'DATABASE', 'DATABASES', 'DATE_ADD', 'DATE_SUB', 'DATE_TRUNC', 'DAY_HOUR', 'DAY_MINUTE', 'DAY_SECOND', 'DAY', 'DAYS', 'DECODE', 'DEFAULT', 'DELETE', 'DENSE_RANK', 'DESC', 'DESCRIBE', 'DISTINCT', 'DISTINCTROW', 'DIV', 'DROP', 'ELSE', 'ENCODE', 'END', 'EXISTS', 'EXPLAIN', 'EXPLODE_OUTER', 'EXPLODE', 'FILTER', 'FIRST_VALUE', 'FIRST', 'FIXED', 'FLATTEN', 'FOLLOWING', 'FROM_UNIXTIME', 'FULL', 'GREATEST', 'GROUP_CONCAT', 'HOUR_MINUTE', 'HOUR_SECOND', 'HOUR', 'HOURS', 'IF', 'IFNULL', 'IN', 'INSERT', 'INTERVAL', 'INTO', 'IS', 'LAG', 'LAST_VALUE', 'LAST', 'LEAD', 'LEADING', 'LEAST', 'LEVEL', 'LIKE', 'MAX', 'MERGE', 'MIN', 'MINUTE_SECOND', 'MINUTE', 'MONTH', 'NATURAL', 'NOT', 'NOW()', 'NTILE', 'NULL', 'NULLIF', 'OFFSET', 'ON DELETE', 'ON UPDATE', 'ON', 'ONLY', 'OPTIMIZE', 'OVER', 'PERCENT_RANK', 'PRECEDING', 'RANGE', 'RANK', 'REGEXP', 'RENAME', 'RLIKE', 'ROW', 'ROWS', 'SECOND', 'SEPARATOR', 'SEQUENCE', 'SIZE', 'STRING', 'STRUCT', 'SUM', 'TABLE', 'TABLES', 'TEMPORARY', 'THEN', 'TO_DATE', 'TO_JSON', 'TO', 'TRAILING', 'TRANSFORM', 'TRUE', 'TRUNCATE', 'TYPE', 'TYPES', 'UNBOUNDED', 'UNIQUE', 'UNIX_TIMESTAMP', 'UNLOCK', 'UNSIGNED', 'USING', 'VARIABLES', 'VIEW', 'WHEN', 'WITH', 'YEAR_MONTH'];
|
||||
var reservedTopLevelWords = ['ADD', 'AFTER', 'ALTER COLUMN', 'ALTER DATABASE', 'ALTER SCHEMA', 'ALTER TABLE', 'CLUSTER BY', 'CLUSTERED BY', 'DELETE FROM', 'DISTRIBUTE BY', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'OPTIONS', 'ORDER BY', 'PARTITION BY', 'PARTITIONED BY', 'RANGE', 'ROWS', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'TBLPROPERTIES', 'UPDATE', 'USING', 'VALUES', 'WHERE', 'WINDOW'];
|
||||
var reservedTopLevelWordsNoIndent = ['EXCEPT ALL', 'EXCEPT', 'INTERSECT ALL', 'INTERSECT', 'UNION ALL', 'UNION'];
|
||||
var reservedNewlineWords = ['AND', 'CREATE OR', 'CREATE', 'ELSE', 'LATERAL VIEW', 'OR', 'OUTER APPLY', 'WHEN', 'XOR', // joins
|
||||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN', // non-standard-joins
|
||||
'ANTI JOIN', 'SEMI JOIN', 'LEFT ANTI JOIN', 'LEFT SEMI JOIN', 'RIGHT OUTER JOIN', 'RIGHT SEMI JOIN', 'NATURAL ANTI JOIN', 'NATURAL FULL OUTER JOIN', 'NATURAL INNER JOIN', 'NATURAL LEFT ANTI JOIN', 'NATURAL LEFT OUTER JOIN', 'NATURAL LEFT SEMI JOIN', 'NATURAL OUTER JOIN', 'NATURAL RIGHT OUTER JOIN', 'NATURAL RIGHT SEMI JOIN', 'NATURAL SEMI JOIN'];
|
||||
|
||||
var SparkSqlFormatter = /*#__PURE__*/function (_Formatter) {
|
||||
_inherits(SparkSqlFormatter, _Formatter);
|
||||
|
||||
var _super = _createSuper(SparkSqlFormatter);
|
||||
|
||||
function SparkSqlFormatter() {
|
||||
_classCallCheck(this, SparkSqlFormatter);
|
||||
|
||||
return _super.apply(this, arguments);
|
||||
}
|
||||
|
||||
_createClass(SparkSqlFormatter, [{
|
||||
key: "tokenizer",
|
||||
value: function tokenizer() {
|
||||
return new _Tokenizer["default"]({
|
||||
reservedWords: reservedWords,
|
||||
reservedTopLevelWords: reservedTopLevelWords,
|
||||
reservedNewlineWords: reservedNewlineWords,
|
||||
reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,
|
||||
stringTypes: ["\"\"", "''", '``', '{}'],
|
||||
openParens: ['(', 'CASE'],
|
||||
closeParens: [')', 'END'],
|
||||
indexedPlaceholderTypes: ['?'],
|
||||
namedPlaceholderTypes: ['$'],
|
||||
lineCommentTypes: ['--'],
|
||||
operators: ['!=', '<=>', '&&', '||', '==']
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: "tokenOverride",
|
||||
value: function tokenOverride(token) {
|
||||
// Fix cases where names are ambiguously keywords or functions
|
||||
if ((0, _token.isWindow)(token)) {
|
||||
var aheadToken = this.tokenLookAhead();
|
||||
|
||||
if (aheadToken && aheadToken.type === _tokenTypes["default"].OPEN_PAREN) {
|
||||
// This is a function call, treat it as a reserved word
|
||||
return {
|
||||
type: _tokenTypes["default"].RESERVED,
|
||||
value: token.value
|
||||
};
|
||||
}
|
||||
} // Fix cases where names are ambiguously keywords or properties
|
||||
|
||||
|
||||
if ((0, _token.isEnd)(token)) {
|
||||
var backToken = this.tokenLookBehind();
|
||||
|
||||
if (backToken && backToken.type === _tokenTypes["default"].OPERATOR && backToken.value === '.') {
|
||||
// This is window().end (or similar) not CASE ... END
|
||||
return {
|
||||
type: _tokenTypes["default"].WORD,
|
||||
value: token.value
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return token;
|
||||
}
|
||||
}]);
|
||||
|
||||
return SparkSqlFormatter;
|
||||
}(_Formatter2["default"]);
|
||||
|
||||
exports["default"] = SparkSqlFormatter;
|
||||
module.exports = exports.default;
|
76
hera-portal/node_modules/sql-formatter/lib/languages/StandardSqlFormatter.js
generated
vendored
Normal file
76
hera-portal/node_modules/sql-formatter/lib/languages/StandardSqlFormatter.js
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _Formatter2 = _interopRequireDefault(require("../core/Formatter"));
|
||||
|
||||
var _Tokenizer = _interopRequireDefault(require("../core/Tokenizer"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
// https://jakewheat.github.io/sql-overview/sql-2008-foundation-grammar.html#reserved-word
|
||||
var reservedWords = ['ABS', 'ALL', 'ALLOCATE', 'ALTER', 'AND', 'ANY', 'ARE', 'ARRAY', 'AS', 'ASENSITIVE', 'ASYMMETRIC', 'AT', 'ATOMIC', 'AUTHORIZATION', 'AVG', 'BEGIN', 'BETWEEN', 'BIGINT', 'BINARY', 'BLOB', 'BOOLEAN', 'BOTH', 'BY', 'CALL', 'CALLED', 'CARDINALITY', 'CASCADED', 'CASE', 'CAST', 'CEIL', 'CEILING', 'CHAR', 'CHAR_LENGTH', 'CHARACTER', 'CHARACTER_LENGTH', 'CHECK', 'CLOB', 'CLOSE', 'COALESCE', 'COLLATE', 'COLLECT', 'COLUMN', 'COMMIT', 'CONDITION', 'CONNECT', 'CONSTRAINT', 'CONVERT', 'CORR', 'CORRESPONDING', 'COUNT', 'COVAR_POP', 'COVAR_SAMP', 'CREATE', 'CROSS', 'CUBE', 'CUME_DIST', 'CURRENT', 'CURRENT_CATALOG', 'CURRENT_DATE', 'CURRENT_DEFAULT_TRANSFORM_GROUP', 'CURRENT_PATH', 'CURRENT_ROLE', 'CURRENT_SCHEMA', 'CURRENT_TIME', 'CURRENT_TIMESTAMP', 'CURRENT_TRANSFORM_GROUP_FOR_TYPE', 'CURRENT_USER', 'CURSOR', 'CYCLE', 'DATE', 'DAY', 'DEALLOCATE', 'DEC', 'DECIMAL', 'DECLARE', 'DEFAULT', 'DELETE', 'DENSE_RANK', 'DEREF', 'DESCRIBE', 'DETERMINISTIC', 'DISCONNECT', 'DISTINCT', 'DOUBLE', 'DROP', 'DYNAMIC', 'EACH', 'ELEMENT', 'ELSE', 'END', 'END-EXEC', 'ESCAPE', 'EVERY', 'EXCEPT', 'EXEC', 'EXECUTE', 'EXISTS', 'EXP', 'EXTERNAL', 'EXTRACT', 'FALSE', 'FETCH', 'FILTER', 'FLOAT', 'FLOOR', 'FOR', 'FOREIGN', 'FREE', 'FROM', 'FULL', 'FUNCTION', 'FUSION', 'GET', 'GLOBAL', 'GRANT', 'GROUP', 'GROUPING', 'HAVING', 'HOLD', 'HOUR', 'IDENTITY', 'IN', 'INDICATOR', 'INNER', 'INOUT', 'INSENSITIVE', 'INSERT', 'INT', 'INTEGER', 'INTERSECT', 'INTERSECTION', 'INTERVAL', 'INTO', 'IS', 'JOIN', 'LANGUAGE', 'LARGE', 'LATERAL', 'LEADING', 'LEFT', 'LIKE', 'LIKE_REGEX', 'LN', 'LOCAL', 'LOCALTIME', 'LOCALTIMESTAMP', 'LOWER', 'MATCH', 'MAX', 'MEMBER', 'MERGE', 'METHOD', 'MIN', 'MINUTE', 'MOD', 'MODIFIES', 'MODULE', 'MONTH', 'MULTISET', 'NATIONAL', 'NATURAL', 'NCHAR', 'NCLOB', 'NEW', 'NO', 'NONE', 'NORMALIZE', 'NOT', 'NULL', 'NULLIF', 'NUMERIC', 'OCTET_LENGTH', 'OCCURRENCES_REGEX', 'OF', 'OLD', 'ON', 'ONLY', 'OPEN', 'OR', 'ORDER', 'OUT', 'OUTER', 'OVER', 'OVERLAPS', 'OVERLAY', 'PARAMETER', 'PARTITION', 'PERCENT_RANK', 'PERCENTILE_CONT', 'PERCENTILE_DISC', 'POSITION', 'POSITION_REGEX', 'POWER', 'PRECISION', 'PREPARE', 'PRIMARY', 'PROCEDURE', 'RANGE', 'RANK', 'READS', 'REAL', 'RECURSIVE', 'REF', 'REFERENCES', 'REFERENCING', 'REGR_AVGX', 'REGR_AVGY', 'REGR_COUNT', 'REGR_INTERCEPT', 'REGR_R2', 'REGR_SLOPE', 'REGR_SXX', 'REGR_SXY', 'REGR_SYY', 'RELEASE', 'RESULT', 'RETURN', 'RETURNS', 'REVOKE', 'RIGHT', 'ROLLBACK', 'ROLLUP', 'ROW', 'ROW_NUMBER', 'ROWS', 'SAVEPOINT', 'SCOPE', 'SCROLL', 'SEARCH', 'SECOND', 'SELECT', 'SENSITIVE', 'SESSION_USER', 'SET', 'SIMILAR', 'SMALLINT', 'SOME', 'SPECIFIC', 'SPECIFICTYPE', 'SQL', 'SQLEXCEPTION', 'SQLSTATE', 'SQLWARNING', 'SQRT', 'START', 'STATIC', 'STDDEV_POP', 'STDDEV_SAMP', 'SUBMULTISET', 'SUBSTRING', 'SUBSTRING_REGEX', 'SUM', 'SYMMETRIC', 'SYSTEM', 'SYSTEM_USER', 'TABLE', 'TABLESAMPLE', 'THEN', 'TIME', 'TIMESTAMP', 'TIMEZONE_HOUR', 'TIMEZONE_MINUTE', 'TO', 'TRAILING', 'TRANSLATE', 'TRANSLATE_REGEX', 'TRANSLATION', 'TREAT', 'TRIGGER', 'TRIM', 'TRUE', 'UESCAPE', 'UNION', 'UNIQUE', 'UNKNOWN', 'UNNEST', 'UPDATE', 'UPPER', 'USER', 'USING', 'VALUE', 'VALUES', 'VAR_POP', 'VAR_SAMP', 'VARBINARY', 'VARCHAR', 'VARYING', 'WHEN', 'WHENEVER', 'WHERE', 'WIDTH_BUCKET', 'WINDOW', 'WITH', 'WITHIN', 'WITHOUT', 'YEAR'];
|
||||
var reservedTopLevelWords = ['ADD', 'ALTER COLUMN', 'ALTER TABLE', 'CASE', 'DELETE FROM', 'END', 'FETCH FIRST', 'FETCH NEXT', 'FETCH PRIOR', 'FETCH LAST', 'FETCH ABSOLUTE', 'FETCH RELATIVE', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'LIMIT', 'ORDER BY', 'SELECT', 'SET SCHEMA', 'SET', 'UPDATE', 'VALUES', 'WHERE'];
|
||||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'INTERSECT DISTINCT', 'UNION', 'UNION ALL', 'UNION DISTINCT', 'EXCEPT', 'EXCEPT ALL', 'EXCEPT DISTINCT'];
|
||||
var reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins
|
||||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'NATURAL JOIN'];
|
||||
|
||||
var StandardSqlFormatter = /*#__PURE__*/function (_Formatter) {
|
||||
_inherits(StandardSqlFormatter, _Formatter);
|
||||
|
||||
var _super = _createSuper(StandardSqlFormatter);
|
||||
|
||||
function StandardSqlFormatter() {
|
||||
_classCallCheck(this, StandardSqlFormatter);
|
||||
|
||||
return _super.apply(this, arguments);
|
||||
}
|
||||
|
||||
_createClass(StandardSqlFormatter, [{
|
||||
key: "tokenizer",
|
||||
value: function tokenizer() {
|
||||
return new _Tokenizer["default"]({
|
||||
reservedWords: reservedWords,
|
||||
reservedTopLevelWords: reservedTopLevelWords,
|
||||
reservedNewlineWords: reservedNewlineWords,
|
||||
reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,
|
||||
stringTypes: ["\"\"", "''"],
|
||||
openParens: ['(', 'CASE'],
|
||||
closeParens: [')', 'END'],
|
||||
indexedPlaceholderTypes: ['?'],
|
||||
namedPlaceholderTypes: [],
|
||||
lineCommentTypes: ['--']
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return StandardSqlFormatter;
|
||||
}(_Formatter2["default"]);
|
||||
|
||||
exports["default"] = StandardSqlFormatter;
|
||||
module.exports = exports.default;
|
78
hera-portal/node_modules/sql-formatter/lib/languages/TSqlFormatter.js
generated
vendored
Normal file
78
hera-portal/node_modules/sql-formatter/lib/languages/TSqlFormatter.js
generated
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports["default"] = void 0;
|
||||
|
||||
var _Formatter2 = _interopRequireDefault(require("../core/Formatter"));
|
||||
|
||||
var _Tokenizer = _interopRequireDefault(require("../core/Tokenizer"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
||||
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
||||
|
||||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
||||
|
||||
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
||||
|
||||
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
||||
|
||||
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
||||
|
||||
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
||||
|
||||
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
||||
|
||||
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
||||
|
||||
var reservedWords = ['ADD', 'EXTERNAL', 'PROCEDURE', 'ALL', 'FETCH', 'PUBLIC', 'ALTER', 'FILE', 'RAISERROR', 'AND', 'FILLFACTOR', 'READ', 'ANY', 'FOR', 'READTEXT', 'AS', 'FOREIGN', 'RECONFIGURE', 'ASC', 'FREETEXT', 'REFERENCES', 'AUTHORIZATION', 'FREETEXTTABLE', 'REPLICATION', 'BACKUP', 'FROM', 'RESTORE', 'BEGIN', 'FULL', 'RESTRICT', 'BETWEEN', 'FUNCTION', 'RETURN', 'BREAK', 'GOTO', 'REVERT', 'BROWSE', 'GRANT', 'REVOKE', 'BULK', 'GROUP', 'RIGHT', 'BY', 'HAVING', 'ROLLBACK', 'CASCADE', 'HOLDLOCK', 'ROWCOUNT', 'CASE', 'IDENTITY', 'ROWGUIDCOL', 'CHECK', 'IDENTITY_INSERT', 'RULE', 'CHECKPOINT', 'IDENTITYCOL', 'SAVE', 'CLOSE', 'IF', 'SCHEMA', 'CLUSTERED', 'IN', 'SECURITYAUDIT', 'COALESCE', 'INDEX', 'SELECT', 'COLLATE', 'INNER', 'SEMANTICKEYPHRASETABLE', 'COLUMN', 'INSERT', 'SEMANTICSIMILARITYDETAILSTABLE', 'COMMIT', 'INTERSECT', 'SEMANTICSIMILARITYTABLE', 'COMPUTE', 'INTO', 'SESSION_USER', 'CONSTRAINT', 'IS', 'SET', 'CONTAINS', 'JOIN', 'SETUSER', 'CONTAINSTABLE', 'KEY', 'SHUTDOWN', 'CONTINUE', 'KILL', 'SOME', 'CONVERT', 'LEFT', 'STATISTICS', 'CREATE', 'LIKE', 'SYSTEM_USER', 'CROSS', 'LINENO', 'TABLE', 'CURRENT', 'LOAD', 'TABLESAMPLE', 'CURRENT_DATE', 'MERGE', 'TEXTSIZE', 'CURRENT_TIME', 'NATIONAL', 'THEN', 'CURRENT_TIMESTAMP', 'NOCHECK', 'TO', 'CURRENT_USER', 'NONCLUSTERED', 'TOP', 'CURSOR', 'NOT', 'TRAN', 'DATABASE', 'NULL', 'TRANSACTION', 'DBCC', 'NULLIF', 'TRIGGER', 'DEALLOCATE', 'OF', 'TRUNCATE', 'DECLARE', 'OFF', 'TRY_CONVERT', 'DEFAULT', 'OFFSETS', 'TSEQUAL', 'DELETE', 'ON', 'UNION', 'DENY', 'OPEN', 'UNIQUE', 'DESC', 'OPENDATASOURCE', 'UNPIVOT', 'DISK', 'OPENQUERY', 'UPDATE', 'DISTINCT', 'OPENROWSET', 'UPDATETEXT', 'DISTRIBUTED', 'OPENXML', 'USE', 'DOUBLE', 'OPTION', 'USER', 'DROP', 'OR', 'VALUES', 'DUMP', 'ORDER', 'VARYING', 'ELSE', 'OUTER', 'VIEW', 'END', 'OVER', 'WAITFOR', 'ERRLVL', 'PERCENT', 'WHEN', 'ESCAPE', 'PIVOT', 'WHERE', 'EXCEPT', 'PLAN', 'WHILE', 'EXEC', 'PRECISION', 'WITH', 'EXECUTE', 'PRIMARY', 'WITHIN GROUP', 'EXISTS', 'PRINT', 'WRITETEXT', 'EXIT', 'PROC'];
|
||||
var reservedTopLevelWords = ['ADD', 'ALTER COLUMN', 'ALTER TABLE', 'CASE', 'DELETE FROM', 'END', 'EXCEPT', 'FROM', 'GROUP BY', 'HAVING', 'INSERT INTO', 'INSERT', 'LIMIT', 'ORDER BY', 'SELECT', 'SET CURRENT SCHEMA', 'SET SCHEMA', 'SET', 'UPDATE', 'VALUES', 'WHERE'];
|
||||
var reservedTopLevelWordsNoIndent = ['INTERSECT', 'INTERSECT ALL', 'MINUS', 'UNION', 'UNION ALL'];
|
||||
var reservedNewlineWords = ['AND', 'ELSE', 'OR', 'WHEN', // joins
|
||||
'JOIN', 'INNER JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'CROSS JOIN'];
|
||||
|
||||
var TSqlFormatter = /*#__PURE__*/function (_Formatter) {
|
||||
_inherits(TSqlFormatter, _Formatter);
|
||||
|
||||
var _super = _createSuper(TSqlFormatter);
|
||||
|
||||
function TSqlFormatter() {
|
||||
_classCallCheck(this, TSqlFormatter);
|
||||
|
||||
return _super.apply(this, arguments);
|
||||
}
|
||||
|
||||
_createClass(TSqlFormatter, [{
|
||||
key: "tokenizer",
|
||||
value: function tokenizer() {
|
||||
return new _Tokenizer["default"]({
|
||||
reservedWords: reservedWords,
|
||||
reservedTopLevelWords: reservedTopLevelWords,
|
||||
reservedNewlineWords: reservedNewlineWords,
|
||||
reservedTopLevelWordsNoIndent: reservedTopLevelWordsNoIndent,
|
||||
stringTypes: ["\"\"", "N''", "''", '[]'],
|
||||
openParens: ['(', 'CASE'],
|
||||
closeParens: [')', 'END'],
|
||||
indexedPlaceholderTypes: [],
|
||||
namedPlaceholderTypes: ['@'],
|
||||
lineCommentTypes: ['--'],
|
||||
specialWordChars: ['#', '@'],
|
||||
operators: ['>=', '<=', '<>', '!=', '!<', '!>', '+=', '-=', '*=', '/=', '%=', '|=', '&=', '^=', '::'] // TODO: Support for money constants
|
||||
|
||||
});
|
||||
}
|
||||
}]);
|
||||
|
||||
return TSqlFormatter;
|
||||
}(_Formatter2["default"]);
|
||||
|
||||
exports["default"] = TSqlFormatter;
|
||||
module.exports = exports.default;
|
79
hera-portal/node_modules/sql-formatter/lib/sqlFormatter.js
generated
vendored
Normal file
79
hera-portal/node_modules/sql-formatter/lib/sqlFormatter.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.supportedDialects = exports.format = void 0;
|
||||
|
||||
var _Db2Formatter = _interopRequireDefault(require("./languages/Db2Formatter"));
|
||||
|
||||
var _MariaDbFormatter = _interopRequireDefault(require("./languages/MariaDbFormatter"));
|
||||
|
||||
var _MySqlFormatter = _interopRequireDefault(require("./languages/MySqlFormatter"));
|
||||
|
||||
var _N1qlFormatter = _interopRequireDefault(require("./languages/N1qlFormatter"));
|
||||
|
||||
var _PlSqlFormatter = _interopRequireDefault(require("./languages/PlSqlFormatter"));
|
||||
|
||||
var _PostgreSqlFormatter = _interopRequireDefault(require("./languages/PostgreSqlFormatter"));
|
||||
|
||||
var _RedshiftFormatter = _interopRequireDefault(require("./languages/RedshiftFormatter"));
|
||||
|
||||
var _SparkSqlFormatter = _interopRequireDefault(require("./languages/SparkSqlFormatter"));
|
||||
|
||||
var _StandardSqlFormatter = _interopRequireDefault(require("./languages/StandardSqlFormatter"));
|
||||
|
||||
var _TSqlFormatter = _interopRequireDefault(require("./languages/TSqlFormatter"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
||||
|
||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
var formatters = {
|
||||
db2: _Db2Formatter["default"],
|
||||
mariadb: _MariaDbFormatter["default"],
|
||||
mysql: _MySqlFormatter["default"],
|
||||
n1ql: _N1qlFormatter["default"],
|
||||
plsql: _PlSqlFormatter["default"],
|
||||
postgresql: _PostgreSqlFormatter["default"],
|
||||
redshift: _RedshiftFormatter["default"],
|
||||
spark: _SparkSqlFormatter["default"],
|
||||
sql: _StandardSqlFormatter["default"],
|
||||
tsql: _TSqlFormatter["default"]
|
||||
};
|
||||
/**
|
||||
* Format whitespace in a query to make it easier to read.
|
||||
*
|
||||
* @param {String} query
|
||||
* @param {Object} cfg
|
||||
* @param {String} cfg.language Query language, default is Standard SQL
|
||||
* @param {String} cfg.indent Characters used for indentation, default is " " (2 spaces)
|
||||
* @param {Boolean} cfg.uppercase Converts keywords to uppercase
|
||||
* @param {Integer} cfg.linesBetweenQueries How many line breaks between queries
|
||||
* @param {Object} cfg.params Collection of params for placeholder replacement
|
||||
* @return {String}
|
||||
*/
|
||||
|
||||
var format = function format(query) {
|
||||
var cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
if (typeof query !== 'string') {
|
||||
throw new Error('Invalid query argument. Extected string, instead got ' + _typeof(query));
|
||||
}
|
||||
|
||||
var Formatter = _StandardSqlFormatter["default"];
|
||||
|
||||
if (cfg.language !== undefined) {
|
||||
Formatter = formatters[cfg.language];
|
||||
}
|
||||
|
||||
if (Formatter === undefined) {
|
||||
throw Error("Unsupported SQL dialect: ".concat(cfg.language));
|
||||
}
|
||||
|
||||
return new Formatter(cfg).format(query);
|
||||
};
|
||||
|
||||
exports.format = format;
|
||||
var supportedDialects = Object.keys(formatters);
|
||||
exports.supportedDialects = supportedDialects;
|
44
hera-portal/node_modules/sql-formatter/lib/utils.js
generated
vendored
Normal file
44
hera-portal/node_modules/sql-formatter/lib/utils.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.sortByLengthDesc = exports.escapeRegExp = exports.isEmpty = exports.last = exports.trimSpacesEnd = void 0;
|
||||
|
||||
// Only removes spaces, not newlines
|
||||
var trimSpacesEnd = function trimSpacesEnd(str) {
|
||||
return str.replace(/[\t ]+$/, '');
|
||||
}; // Last element from array
|
||||
|
||||
|
||||
exports.trimSpacesEnd = trimSpacesEnd;
|
||||
|
||||
var last = function last(arr) {
|
||||
return arr[arr.length - 1];
|
||||
}; // True array is empty, or it's not an array at all
|
||||
|
||||
|
||||
exports.last = last;
|
||||
|
||||
var isEmpty = function isEmpty(arr) {
|
||||
return !Array.isArray(arr) || arr.length === 0;
|
||||
}; // Escapes regex special chars
|
||||
|
||||
|
||||
exports.isEmpty = isEmpty;
|
||||
|
||||
var escapeRegExp = function escapeRegExp(string) {
|
||||
return string.replace(/[\$\(-\+\.\?\[-\^\{-\}]/g, '\\$&');
|
||||
}; // Sorts strings by length, so that longer ones are first
|
||||
// Also sorts alphabetically after sorting by length.
|
||||
|
||||
|
||||
exports.escapeRegExp = escapeRegExp;
|
||||
|
||||
var sortByLengthDesc = function sortByLengthDesc(strings) {
|
||||
return strings.sort(function (a, b) {
|
||||
return b.length - a.length || a.localeCompare(b);
|
||||
});
|
||||
};
|
||||
|
||||
exports.sortByLengthDesc = sortByLengthDesc;
|
216
hera-portal/node_modules/sql-formatter/node_modules/argparse/CHANGELOG.md
generated
vendored
Normal file
216
hera-portal/node_modules/sql-formatter/node_modules/argparse/CHANGELOG.md
generated
vendored
Normal file
@ -0,0 +1,216 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
|
||||
## [2.0.1] - 2020-08-29
|
||||
### Fixed
|
||||
- Fix issue with `process.argv` when used with interpreters (`coffee`, `ts-node`, etc.), #150.
|
||||
|
||||
|
||||
## [2.0.0] - 2020-08-14
|
||||
### Changed
|
||||
- Full rewrite. Now port from python 3.9.0 & more precise following.
|
||||
See [doc](./doc) for difference and migration info.
|
||||
- node.js 10+ required
|
||||
- Removed most of local docs in favour of original ones.
|
||||
|
||||
|
||||
## [1.0.10] - 2018-02-15
|
||||
### Fixed
|
||||
- Use .concat instead of + for arrays, #122.
|
||||
|
||||
|
||||
## [1.0.9] - 2016-09-29
|
||||
### Changed
|
||||
- Rerelease after 1.0.8 - deps cleanup.
|
||||
|
||||
|
||||
## [1.0.8] - 2016-09-29
|
||||
### Changed
|
||||
- Maintenance (deps bump, fix node 6.5+ tests, coverage report).
|
||||
|
||||
|
||||
## [1.0.7] - 2016-03-17
|
||||
### Changed
|
||||
- Teach `addArgument` to accept string arg names. #97, @tomxtobin.
|
||||
|
||||
|
||||
## [1.0.6] - 2016-02-06
|
||||
### Changed
|
||||
- Maintenance: moved to eslint & updated CS.
|
||||
|
||||
|
||||
## [1.0.5] - 2016-02-05
|
||||
### Changed
|
||||
- Removed lodash dependency to significantly reduce install size.
|
||||
Thanks to @mourner.
|
||||
|
||||
|
||||
## [1.0.4] - 2016-01-17
|
||||
### Changed
|
||||
- Maintenance: lodash update to 4.0.0.
|
||||
|
||||
|
||||
## [1.0.3] - 2015-10-27
|
||||
### Fixed
|
||||
- Fix parse `=` in args: `--examplepath="C:\myfolder\env=x64"`. #84, @CatWithApple.
|
||||
|
||||
|
||||
## [1.0.2] - 2015-03-22
|
||||
### Changed
|
||||
- Relaxed lodash version dependency.
|
||||
|
||||
|
||||
## [1.0.1] - 2015-02-20
|
||||
### Changed
|
||||
- Changed dependencies to be compatible with ancient nodejs.
|
||||
|
||||
|
||||
## [1.0.0] - 2015-02-19
|
||||
### Changed
|
||||
- Maintenance release.
|
||||
- Replaced `underscore` with `lodash`.
|
||||
- Bumped version to 1.0.0 to better reflect semver meaning.
|
||||
- HISTORY.md -> CHANGELOG.md
|
||||
|
||||
|
||||
## [0.1.16] - 2013-12-01
|
||||
### Changed
|
||||
- Maintenance release. Updated dependencies and docs.
|
||||
|
||||
|
||||
## [0.1.15] - 2013-05-13
|
||||
### Fixed
|
||||
- Fixed #55, @trebor89
|
||||
|
||||
|
||||
## [0.1.14] - 2013-05-12
|
||||
### Fixed
|
||||
- Fixed #62, @maxtaco
|
||||
|
||||
|
||||
## [0.1.13] - 2013-04-08
|
||||
### Changed
|
||||
- Added `.npmignore` to reduce package size
|
||||
|
||||
|
||||
## [0.1.12] - 2013-02-10
|
||||
### Fixed
|
||||
- Fixed conflictHandler (#46), @hpaulj
|
||||
|
||||
|
||||
## [0.1.11] - 2013-02-07
|
||||
### Added
|
||||
- Added 70+ tests (ported from python), @hpaulj
|
||||
- Added conflictHandler, @applepicke
|
||||
- Added fromfilePrefixChar, @hpaulj
|
||||
|
||||
### Fixed
|
||||
- Multiple bugfixes, @hpaulj
|
||||
|
||||
|
||||
## [0.1.10] - 2012-12-30
|
||||
### Added
|
||||
- Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion)
|
||||
support, thanks to @hpaulj
|
||||
|
||||
### Fixed
|
||||
- Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj
|
||||
|
||||
|
||||
## [0.1.9] - 2012-12-27
|
||||
### Fixed
|
||||
- Fixed option dest interferens with other options (issue #23), thanks to @hpaulj
|
||||
- Fixed default value behavior with `*` positionals, thanks to @hpaulj
|
||||
- Improve `getDefault()` behavior, thanks to @hpaulj
|
||||
- Improve negative argument parsing, thanks to @hpaulj
|
||||
|
||||
|
||||
## [0.1.8] - 2012-12-01
|
||||
### Fixed
|
||||
- Fixed parser parents (issue #19), thanks to @hpaulj
|
||||
- Fixed negative argument parse (issue #20), thanks to @hpaulj
|
||||
|
||||
|
||||
## [0.1.7] - 2012-10-14
|
||||
### Fixed
|
||||
- Fixed 'choices' argument parse (issue #16)
|
||||
- Fixed stderr output (issue #15)
|
||||
|
||||
|
||||
## [0.1.6] - 2012-09-09
|
||||
### Fixed
|
||||
- Fixed check for conflict of options (thanks to @tomxtobin)
|
||||
|
||||
|
||||
## [0.1.5] - 2012-09-03
|
||||
### Fixed
|
||||
- Fix parser #setDefaults method (thanks to @tomxtobin)
|
||||
|
||||
|
||||
## [0.1.4] - 2012-07-30
|
||||
### Fixed
|
||||
- Fixed pseudo-argument support (thanks to @CGamesPlay)
|
||||
- Fixed addHelp default (should be true), if not set (thanks to @benblank)
|
||||
|
||||
|
||||
## [0.1.3] - 2012-06-27
|
||||
### Fixed
|
||||
- Fixed formatter api name: Formatter -> HelpFormatter
|
||||
|
||||
|
||||
## [0.1.2] - 2012-05-29
|
||||
### Fixed
|
||||
- Removed excess whitespace in help
|
||||
- Fixed error reporting, when parcer with subcommands
|
||||
called with empty arguments
|
||||
|
||||
### Added
|
||||
- Added basic tests
|
||||
|
||||
|
||||
## [0.1.1] - 2012-05-23
|
||||
### Fixed
|
||||
- Fixed line wrapping in help formatter
|
||||
- Added better error reporting on invalid arguments
|
||||
|
||||
|
||||
## [0.1.0] - 2012-05-16
|
||||
### Added
|
||||
- First release.
|
||||
|
||||
|
||||
[2.0.1]: https://github.com/nodeca/argparse/compare/2.0.0...2.0.1
|
||||
[2.0.0]: https://github.com/nodeca/argparse/compare/1.0.10...2.0.0
|
||||
[1.0.10]: https://github.com/nodeca/argparse/compare/1.0.9...1.0.10
|
||||
[1.0.9]: https://github.com/nodeca/argparse/compare/1.0.8...1.0.9
|
||||
[1.0.8]: https://github.com/nodeca/argparse/compare/1.0.7...1.0.8
|
||||
[1.0.7]: https://github.com/nodeca/argparse/compare/1.0.6...1.0.7
|
||||
[1.0.6]: https://github.com/nodeca/argparse/compare/1.0.5...1.0.6
|
||||
[1.0.5]: https://github.com/nodeca/argparse/compare/1.0.4...1.0.5
|
||||
[1.0.4]: https://github.com/nodeca/argparse/compare/1.0.3...1.0.4
|
||||
[1.0.3]: https://github.com/nodeca/argparse/compare/1.0.2...1.0.3
|
||||
[1.0.2]: https://github.com/nodeca/argparse/compare/1.0.1...1.0.2
|
||||
[1.0.1]: https://github.com/nodeca/argparse/compare/1.0.0...1.0.1
|
||||
[1.0.0]: https://github.com/nodeca/argparse/compare/0.1.16...1.0.0
|
||||
[0.1.16]: https://github.com/nodeca/argparse/compare/0.1.15...0.1.16
|
||||
[0.1.15]: https://github.com/nodeca/argparse/compare/0.1.14...0.1.15
|
||||
[0.1.14]: https://github.com/nodeca/argparse/compare/0.1.13...0.1.14
|
||||
[0.1.13]: https://github.com/nodeca/argparse/compare/0.1.12...0.1.13
|
||||
[0.1.12]: https://github.com/nodeca/argparse/compare/0.1.11...0.1.12
|
||||
[0.1.11]: https://github.com/nodeca/argparse/compare/0.1.10...0.1.11
|
||||
[0.1.10]: https://github.com/nodeca/argparse/compare/0.1.9...0.1.10
|
||||
[0.1.9]: https://github.com/nodeca/argparse/compare/0.1.8...0.1.9
|
||||
[0.1.8]: https://github.com/nodeca/argparse/compare/0.1.7...0.1.8
|
||||
[0.1.7]: https://github.com/nodeca/argparse/compare/0.1.6...0.1.7
|
||||
[0.1.6]: https://github.com/nodeca/argparse/compare/0.1.5...0.1.6
|
||||
[0.1.5]: https://github.com/nodeca/argparse/compare/0.1.4...0.1.5
|
||||
[0.1.4]: https://github.com/nodeca/argparse/compare/0.1.3...0.1.4
|
||||
[0.1.3]: https://github.com/nodeca/argparse/compare/0.1.2...0.1.3
|
||||
[0.1.2]: https://github.com/nodeca/argparse/compare/0.1.1...0.1.2
|
||||
[0.1.1]: https://github.com/nodeca/argparse/compare/0.1.0...0.1.1
|
||||
[0.1.0]: https://github.com/nodeca/argparse/releases/tag/0.1.0
|
254
hera-portal/node_modules/sql-formatter/node_modules/argparse/LICENSE
generated
vendored
Normal file
254
hera-portal/node_modules/sql-formatter/node_modules/argparse/LICENSE
generated
vendored
Normal file
@ -0,0 +1,254 @@
|
||||
A. HISTORY OF THE SOFTWARE
|
||||
==========================
|
||||
|
||||
Python was created in the early 1990s by Guido van Rossum at Stichting
|
||||
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
|
||||
as a successor of a language called ABC. Guido remains Python's
|
||||
principal author, although it includes many contributions from others.
|
||||
|
||||
In 1995, Guido continued his work on Python at the Corporation for
|
||||
National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
|
||||
in Reston, Virginia where he released several versions of the
|
||||
software.
|
||||
|
||||
In May 2000, Guido and the Python core development team moved to
|
||||
BeOpen.com to form the BeOpen PythonLabs team. In October of the same
|
||||
year, the PythonLabs team moved to Digital Creations, which became
|
||||
Zope Corporation. In 2001, the Python Software Foundation (PSF, see
|
||||
https://www.python.org/psf/) was formed, a non-profit organization
|
||||
created specifically to own Python-related Intellectual Property.
|
||||
Zope Corporation was a sponsoring member of the PSF.
|
||||
|
||||
All Python releases are Open Source (see http://www.opensource.org for
|
||||
the Open Source Definition). Historically, most, but not all, Python
|
||||
releases have also been GPL-compatible; the table below summarizes
|
||||
the various releases.
|
||||
|
||||
Release Derived Year Owner GPL-
|
||||
from compatible? (1)
|
||||
|
||||
0.9.0 thru 1.2 1991-1995 CWI yes
|
||||
1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
|
||||
1.6 1.5.2 2000 CNRI no
|
||||
2.0 1.6 2000 BeOpen.com no
|
||||
1.6.1 1.6 2001 CNRI yes (2)
|
||||
2.1 2.0+1.6.1 2001 PSF no
|
||||
2.0.1 2.0+1.6.1 2001 PSF yes
|
||||
2.1.1 2.1+2.0.1 2001 PSF yes
|
||||
2.1.2 2.1.1 2002 PSF yes
|
||||
2.1.3 2.1.2 2002 PSF yes
|
||||
2.2 and above 2.1.1 2001-now PSF yes
|
||||
|
||||
Footnotes:
|
||||
|
||||
(1) GPL-compatible doesn't mean that we're distributing Python under
|
||||
the GPL. All Python licenses, unlike the GPL, let you distribute
|
||||
a modified version without making your changes open source. The
|
||||
GPL-compatible licenses make it possible to combine Python with
|
||||
other software that is released under the GPL; the others don't.
|
||||
|
||||
(2) According to Richard Stallman, 1.6.1 is not GPL-compatible,
|
||||
because its license has a choice of law clause. According to
|
||||
CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1
|
||||
is "not incompatible" with the GPL.
|
||||
|
||||
Thanks to the many outside volunteers who have worked under Guido's
|
||||
direction to make these releases possible.
|
||||
|
||||
|
||||
B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
|
||||
===============================================================
|
||||
|
||||
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
|
||||
--------------------------------------------
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Python Software Foundation
|
||||
("PSF"), and the Individual or Organization ("Licensee") accessing and
|
||||
otherwise using this software ("Python") in source or binary form and
|
||||
its associated documentation.
|
||||
|
||||
2. Subject to the terms and conditions of this License Agreement, PSF hereby
|
||||
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
|
||||
analyze, test, perform and/or display publicly, prepare derivative works,
|
||||
distribute, and otherwise use Python alone or in any derivative version,
|
||||
provided, however, that PSF's License Agreement and PSF's notice of copyright,
|
||||
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Python Software Foundation;
|
||||
All Rights Reserved" are retained in Python alone or in any derivative version
|
||||
prepared by Licensee.
|
||||
|
||||
3. In the event Licensee prepares a derivative work that is based on
|
||||
or incorporates Python or any part thereof, and wants to make
|
||||
the derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary of
|
||||
the changes made to Python.
|
||||
|
||||
4. PSF is making Python available to Licensee on an "AS IS"
|
||||
basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON,
|
||||
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
7. Nothing in this License Agreement shall be deemed to create any
|
||||
relationship of agency, partnership, or joint venture between PSF and
|
||||
Licensee. This License Agreement does not grant permission to use PSF
|
||||
trademarks or trade name in a trademark sense to endorse or promote
|
||||
products or services of Licensee, or any third party.
|
||||
|
||||
8. By copying, installing or otherwise using Python, Licensee
|
||||
agrees to be bound by the terms and conditions of this License
|
||||
Agreement.
|
||||
|
||||
|
||||
BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
|
||||
-------------------------------------------
|
||||
|
||||
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
|
||||
|
||||
1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an
|
||||
office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the
|
||||
Individual or Organization ("Licensee") accessing and otherwise using
|
||||
this software in source or binary form and its associated
|
||||
documentation ("the Software").
|
||||
|
||||
2. Subject to the terms and conditions of this BeOpen Python License
|
||||
Agreement, BeOpen hereby grants Licensee a non-exclusive,
|
||||
royalty-free, world-wide license to reproduce, analyze, test, perform
|
||||
and/or display publicly, prepare derivative works, distribute, and
|
||||
otherwise use the Software alone or in any derivative version,
|
||||
provided, however, that the BeOpen Python License is retained in the
|
||||
Software, alone or in any derivative version prepared by Licensee.
|
||||
|
||||
3. BeOpen is making the Software available to Licensee on an "AS IS"
|
||||
basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE
|
||||
SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS
|
||||
AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY
|
||||
DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
5. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
6. This License Agreement shall be governed by and interpreted in all
|
||||
respects by the law of the State of California, excluding conflict of
|
||||
law provisions. Nothing in this License Agreement shall be deemed to
|
||||
create any relationship of agency, partnership, or joint venture
|
||||
between BeOpen and Licensee. This License Agreement does not grant
|
||||
permission to use BeOpen trademarks or trade names in a trademark
|
||||
sense to endorse or promote products or services of Licensee, or any
|
||||
third party. As an exception, the "BeOpen Python" logos available at
|
||||
http://www.pythonlabs.com/logos.html may be used according to the
|
||||
permissions granted on that web page.
|
||||
|
||||
7. By copying, installing or otherwise using the software, Licensee
|
||||
agrees to be bound by the terms and conditions of this License
|
||||
Agreement.
|
||||
|
||||
|
||||
CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
|
||||
---------------------------------------
|
||||
|
||||
1. This LICENSE AGREEMENT is between the Corporation for National
|
||||
Research Initiatives, having an office at 1895 Preston White Drive,
|
||||
Reston, VA 20191 ("CNRI"), and the Individual or Organization
|
||||
("Licensee") accessing and otherwise using Python 1.6.1 software in
|
||||
source or binary form and its associated documentation.
|
||||
|
||||
2. Subject to the terms and conditions of this License Agreement, CNRI
|
||||
hereby grants Licensee a nonexclusive, royalty-free, world-wide
|
||||
license to reproduce, analyze, test, perform and/or display publicly,
|
||||
prepare derivative works, distribute, and otherwise use Python 1.6.1
|
||||
alone or in any derivative version, provided, however, that CNRI's
|
||||
License Agreement and CNRI's notice of copyright, i.e., "Copyright (c)
|
||||
1995-2001 Corporation for National Research Initiatives; All Rights
|
||||
Reserved" are retained in Python 1.6.1 alone or in any derivative
|
||||
version prepared by Licensee. Alternately, in lieu of CNRI's License
|
||||
Agreement, Licensee may substitute the following text (omitting the
|
||||
quotes): "Python 1.6.1 is made available subject to the terms and
|
||||
conditions in CNRI's License Agreement. This Agreement together with
|
||||
Python 1.6.1 may be located on the Internet using the following
|
||||
unique, persistent identifier (known as a handle): 1895.22/1013. This
|
||||
Agreement may also be obtained from a proxy server on the Internet
|
||||
using the following URL: http://hdl.handle.net/1895.22/1013".
|
||||
|
||||
3. In the event Licensee prepares a derivative work that is based on
|
||||
or incorporates Python 1.6.1 or any part thereof, and wants to make
|
||||
the derivative work available to others as provided herein, then
|
||||
Licensee hereby agrees to include in any such work a brief summary of
|
||||
the changes made to Python 1.6.1.
|
||||
|
||||
4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS"
|
||||
basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR
|
||||
IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND
|
||||
DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS
|
||||
FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT
|
||||
INFRINGE ANY THIRD PARTY RIGHTS.
|
||||
|
||||
5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON
|
||||
1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS
|
||||
A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1,
|
||||
OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
|
||||
|
||||
6. This License Agreement will automatically terminate upon a material
|
||||
breach of its terms and conditions.
|
||||
|
||||
7. This License Agreement shall be governed by the federal
|
||||
intellectual property law of the United States, including without
|
||||
limitation the federal copyright law, and, to the extent such
|
||||
U.S. federal law does not apply, by the law of the Commonwealth of
|
||||
Virginia, excluding Virginia's conflict of law provisions.
|
||||
Notwithstanding the foregoing, with regard to derivative works based
|
||||
on Python 1.6.1 that incorporate non-separable material that was
|
||||
previously distributed under the GNU General Public License (GPL), the
|
||||
law of the Commonwealth of Virginia shall govern this License
|
||||
Agreement only as to issues arising under or with respect to
|
||||
Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this
|
||||
License Agreement shall be deemed to create any relationship of
|
||||
agency, partnership, or joint venture between CNRI and Licensee. This
|
||||
License Agreement does not grant permission to use CNRI trademarks or
|
||||
trade name in a trademark sense to endorse or promote products or
|
||||
services of Licensee, or any third party.
|
||||
|
||||
8. By clicking on the "ACCEPT" button where indicated, or by copying,
|
||||
installing or otherwise using Python 1.6.1, Licensee agrees to be
|
||||
bound by the terms and conditions of this License Agreement.
|
||||
|
||||
ACCEPT
|
||||
|
||||
|
||||
CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
|
||||
--------------------------------------------------
|
||||
|
||||
Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam,
|
||||
The Netherlands. All rights reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Stichting Mathematisch
|
||||
Centrum or CWI not be used in advertising or publicity pertaining to
|
||||
distribution of the software without specific, written prior
|
||||
permission.
|
||||
|
||||
STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
|
||||
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
|
||||
FOR ANY SPECIAL, 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.
|
84
hera-portal/node_modules/sql-formatter/node_modules/argparse/README.md
generated
vendored
Normal file
84
hera-portal/node_modules/sql-formatter/node_modules/argparse/README.md
generated
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
argparse
|
||||
========
|
||||
|
||||
[](http://travis-ci.org/nodeca/argparse)
|
||||
[](https://www.npmjs.org/package/argparse)
|
||||
|
||||
CLI arguments parser for node.js, with [sub-commands](https://docs.python.org/3.9/library/argparse.html#sub-commands) support. Port of python's [argparse](http://docs.python.org/dev/library/argparse.html) (version [3.9.0](https://github.com/python/cpython/blob/v3.9.0rc1/Lib/argparse.py)).
|
||||
|
||||
**Difference with original.**
|
||||
|
||||
- JS has no keyword arguments support.
|
||||
- Pass options instead: `new ArgumentParser({ description: 'example', add_help: true })`.
|
||||
- JS has no python's types `int`, `float`, ...
|
||||
- Use string-typed names: `.add_argument('-b', { type: 'int', help: 'help' })`.
|
||||
- `%r` format specifier uses `require('util').inspect()`.
|
||||
|
||||
More details in [doc](./doc).
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
`test.js` file:
|
||||
|
||||
```javascript
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
const { ArgumentParser } = require('argparse');
|
||||
const { version } = require('./package.json');
|
||||
|
||||
const parser = new ArgumentParser({
|
||||
description: 'Argparse example'
|
||||
});
|
||||
|
||||
parser.add_argument('-v', '--version', { action: 'version', version });
|
||||
parser.add_argument('-f', '--foo', { help: 'foo bar' });
|
||||
parser.add_argument('-b', '--bar', { help: 'bar foo' });
|
||||
parser.add_argument('--baz', { help: 'baz bar' });
|
||||
|
||||
console.dir(parser.parse_args());
|
||||
```
|
||||
|
||||
Display help:
|
||||
|
||||
```
|
||||
$ ./test.js -h
|
||||
usage: test.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ]
|
||||
|
||||
Argparse example
|
||||
|
||||
optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-v, --version show program's version number and exit
|
||||
-f FOO, --foo FOO foo bar
|
||||
-b BAR, --bar BAR bar foo
|
||||
--baz BAZ baz bar
|
||||
```
|
||||
|
||||
Parse arguments:
|
||||
|
||||
```
|
||||
$ ./test.js -f=3 --bar=4 --baz 5
|
||||
{ foo: '3', bar: '4', baz: '5' }
|
||||
```
|
||||
|
||||
|
||||
API docs
|
||||
--------
|
||||
|
||||
Since this is a port with minimal divergence, there's no separate documentation.
|
||||
Use original one instead, with notes about difference.
|
||||
|
||||
1. [Original doc](https://docs.python.org/3.9/library/argparse.html).
|
||||
2. [Original tutorial](https://docs.python.org/3.9/howto/argparse.html).
|
||||
3. [Difference with python](./doc).
|
||||
|
||||
|
||||
argparse for enterprise
|
||||
-----------------------
|
||||
|
||||
Available as part of the Tidelift Subscription
|
||||
|
||||
The maintainers of argparse and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-argparse?utm_source=npm-argparse&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
3707
hera-portal/node_modules/sql-formatter/node_modules/argparse/argparse.js
generated
vendored
Normal file
3707
hera-portal/node_modules/sql-formatter/node_modules/argparse/argparse.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
67
hera-portal/node_modules/sql-formatter/node_modules/argparse/lib/sub.js
generated
vendored
Normal file
67
hera-portal/node_modules/sql-formatter/node_modules/argparse/lib/sub.js
generated
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
// Limited implementation of python % string operator, supports only %s and %r for now
|
||||
// (other formats are not used here, but may appear in custom templates)
|
||||
|
||||
'use strict'
|
||||
|
||||
const { inspect } = require('util')
|
||||
|
||||
|
||||
module.exports = function sub(pattern, ...values) {
|
||||
let regex = /%(?:(%)|(-)?(\*)?(?:\((\w+)\))?([A-Za-z]))/g
|
||||
|
||||
let result = pattern.replace(regex, function (_, is_literal, is_left_align, is_padded, name, format) {
|
||||
if (is_literal) return '%'
|
||||
|
||||
let padded_count = 0
|
||||
if (is_padded) {
|
||||
if (values.length === 0) throw new TypeError('not enough arguments for format string')
|
||||
padded_count = values.shift()
|
||||
if (!Number.isInteger(padded_count)) throw new TypeError('* wants int')
|
||||
}
|
||||
|
||||
let str
|
||||
if (name !== undefined) {
|
||||
let dict = values[0]
|
||||
if (typeof dict !== 'object' || dict === null) throw new TypeError('format requires a mapping')
|
||||
if (!(name in dict)) throw new TypeError(`no such key: '${name}'`)
|
||||
str = dict[name]
|
||||
} else {
|
||||
if (values.length === 0) throw new TypeError('not enough arguments for format string')
|
||||
str = values.shift()
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case 's':
|
||||
str = String(str)
|
||||
break
|
||||
case 'r':
|
||||
str = inspect(str)
|
||||
break
|
||||
case 'd':
|
||||
case 'i':
|
||||
if (typeof str !== 'number') {
|
||||
throw new TypeError(`%${format} format: a number is required, not ${typeof str}`)
|
||||
}
|
||||
str = String(str.toFixed(0))
|
||||
break
|
||||
default:
|
||||
throw new TypeError(`unsupported format character '${format}'`)
|
||||
}
|
||||
|
||||
if (padded_count > 0) {
|
||||
return is_left_align ? str.padEnd(padded_count) : str.padStart(padded_count)
|
||||
} else {
|
||||
return str
|
||||
}
|
||||
})
|
||||
|
||||
if (values.length) {
|
||||
if (values.length === 1 && typeof values[0] === 'object' && values[0] !== null) {
|
||||
// mapping
|
||||
} else {
|
||||
throw new TypeError('not all arguments converted during string formatting')
|
||||
}
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
440
hera-portal/node_modules/sql-formatter/node_modules/argparse/lib/textwrap.js
generated
vendored
Normal file
440
hera-portal/node_modules/sql-formatter/node_modules/argparse/lib/textwrap.js
generated
vendored
Normal file
@ -0,0 +1,440 @@
|
||||
// Partial port of python's argparse module, version 3.9.0 (only wrap and fill functions):
|
||||
// https://github.com/python/cpython/blob/v3.9.0b4/Lib/textwrap.py
|
||||
|
||||
'use strict'
|
||||
|
||||
/*
|
||||
* Text wrapping and filling.
|
||||
*/
|
||||
|
||||
// Copyright (C) 1999-2001 Gregory P. Ward.
|
||||
// Copyright (C) 2002, 2003 Python Software Foundation.
|
||||
// Copyright (C) 2020 argparse.js authors
|
||||
// Originally written by Greg Ward <gward@python.net>
|
||||
|
||||
// Hardcode the recognized whitespace characters to the US-ASCII
|
||||
// whitespace characters. The main reason for doing this is that
|
||||
// some Unicode spaces (like \u00a0) are non-breaking whitespaces.
|
||||
//
|
||||
// This less funky little regex just split on recognized spaces. E.g.
|
||||
// "Hello there -- you goof-ball, use the -b option!"
|
||||
// splits into
|
||||
// Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/
|
||||
const wordsep_simple_re = /([\t\n\x0b\x0c\r ]+)/
|
||||
|
||||
class TextWrapper {
|
||||
/*
|
||||
* Object for wrapping/filling text. The public interface consists of
|
||||
* the wrap() and fill() methods; the other methods are just there for
|
||||
* subclasses to override in order to tweak the default behaviour.
|
||||
* If you want to completely replace the main wrapping algorithm,
|
||||
* you'll probably have to override _wrap_chunks().
|
||||
*
|
||||
* Several instance attributes control various aspects of wrapping:
|
||||
* width (default: 70)
|
||||
* the maximum width of wrapped lines (unless break_long_words
|
||||
* is false)
|
||||
* initial_indent (default: "")
|
||||
* string that will be prepended to the first line of wrapped
|
||||
* output. Counts towards the line's width.
|
||||
* subsequent_indent (default: "")
|
||||
* string that will be prepended to all lines save the first
|
||||
* of wrapped output; also counts towards each line's width.
|
||||
* expand_tabs (default: true)
|
||||
* Expand tabs in input text to spaces before further processing.
|
||||
* Each tab will become 0 .. 'tabsize' spaces, depending on its position
|
||||
* in its line. If false, each tab is treated as a single character.
|
||||
* tabsize (default: 8)
|
||||
* Expand tabs in input text to 0 .. 'tabsize' spaces, unless
|
||||
* 'expand_tabs' is false.
|
||||
* replace_whitespace (default: true)
|
||||
* Replace all whitespace characters in the input text by spaces
|
||||
* after tab expansion. Note that if expand_tabs is false and
|
||||
* replace_whitespace is true, every tab will be converted to a
|
||||
* single space!
|
||||
* fix_sentence_endings (default: false)
|
||||
* Ensure that sentence-ending punctuation is always followed
|
||||
* by two spaces. Off by default because the algorithm is
|
||||
* (unavoidably) imperfect.
|
||||
* break_long_words (default: true)
|
||||
* Break words longer than 'width'. If false, those words will not
|
||||
* be broken, and some lines might be longer than 'width'.
|
||||
* break_on_hyphens (default: true)
|
||||
* Allow breaking hyphenated words. If true, wrapping will occur
|
||||
* preferably on whitespaces and right after hyphens part of
|
||||
* compound words.
|
||||
* drop_whitespace (default: true)
|
||||
* Drop leading and trailing whitespace from lines.
|
||||
* max_lines (default: None)
|
||||
* Truncate wrapped lines.
|
||||
* placeholder (default: ' [...]')
|
||||
* Append to the last line of truncated text.
|
||||
*/
|
||||
|
||||
constructor(options = {}) {
|
||||
let {
|
||||
width = 70,
|
||||
initial_indent = '',
|
||||
subsequent_indent = '',
|
||||
expand_tabs = true,
|
||||
replace_whitespace = true,
|
||||
fix_sentence_endings = false,
|
||||
break_long_words = true,
|
||||
drop_whitespace = true,
|
||||
break_on_hyphens = true,
|
||||
tabsize = 8,
|
||||
max_lines = undefined,
|
||||
placeholder=' [...]'
|
||||
} = options
|
||||
|
||||
this.width = width
|
||||
this.initial_indent = initial_indent
|
||||
this.subsequent_indent = subsequent_indent
|
||||
this.expand_tabs = expand_tabs
|
||||
this.replace_whitespace = replace_whitespace
|
||||
this.fix_sentence_endings = fix_sentence_endings
|
||||
this.break_long_words = break_long_words
|
||||
this.drop_whitespace = drop_whitespace
|
||||
this.break_on_hyphens = break_on_hyphens
|
||||
this.tabsize = tabsize
|
||||
this.max_lines = max_lines
|
||||
this.placeholder = placeholder
|
||||
}
|
||||
|
||||
|
||||
// -- Private methods -----------------------------------------------
|
||||
// (possibly useful for subclasses to override)
|
||||
|
||||
_munge_whitespace(text) {
|
||||
/*
|
||||
* _munge_whitespace(text : string) -> string
|
||||
*
|
||||
* Munge whitespace in text: expand tabs and convert all other
|
||||
* whitespace characters to spaces. Eg. " foo\\tbar\\n\\nbaz"
|
||||
* becomes " foo bar baz".
|
||||
*/
|
||||
if (this.expand_tabs) {
|
||||
text = text.replace(/\t/g, ' '.repeat(this.tabsize)) // not strictly correct in js
|
||||
}
|
||||
if (this.replace_whitespace) {
|
||||
text = text.replace(/[\t\n\x0b\x0c\r]/g, ' ')
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
_split(text) {
|
||||
/*
|
||||
* _split(text : string) -> [string]
|
||||
*
|
||||
* Split the text to wrap into indivisible chunks. Chunks are
|
||||
* not quite the same as words; see _wrap_chunks() for full
|
||||
* details. As an example, the text
|
||||
* Look, goof-ball -- use the -b option!
|
||||
* breaks into the following chunks:
|
||||
* 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ',
|
||||
* 'use', ' ', 'the', ' ', '-b', ' ', 'option!'
|
||||
* if break_on_hyphens is True, or in:
|
||||
* 'Look,', ' ', 'goof-ball', ' ', '--', ' ',
|
||||
* 'use', ' ', 'the', ' ', '-b', ' ', option!'
|
||||
* otherwise.
|
||||
*/
|
||||
let chunks = text.split(wordsep_simple_re)
|
||||
chunks = chunks.filter(Boolean)
|
||||
return chunks
|
||||
}
|
||||
|
||||
_handle_long_word(reversed_chunks, cur_line, cur_len, width) {
|
||||
/*
|
||||
* _handle_long_word(chunks : [string],
|
||||
* cur_line : [string],
|
||||
* cur_len : int, width : int)
|
||||
*
|
||||
* Handle a chunk of text (most likely a word, not whitespace) that
|
||||
* is too long to fit in any line.
|
||||
*/
|
||||
// Figure out when indent is larger than the specified width, and make
|
||||
// sure at least one character is stripped off on every pass
|
||||
let space_left
|
||||
if (width < 1) {
|
||||
space_left = 1
|
||||
} else {
|
||||
space_left = width - cur_len
|
||||
}
|
||||
|
||||
// If we're allowed to break long words, then do so: put as much
|
||||
// of the next chunk onto the current line as will fit.
|
||||
if (this.break_long_words) {
|
||||
cur_line.push(reversed_chunks[reversed_chunks.length - 1].slice(0, space_left))
|
||||
reversed_chunks[reversed_chunks.length - 1] = reversed_chunks[reversed_chunks.length - 1].slice(space_left)
|
||||
|
||||
// Otherwise, we have to preserve the long word intact. Only add
|
||||
// it to the current line if there's nothing already there --
|
||||
// that minimizes how much we violate the width constraint.
|
||||
} else if (!cur_line) {
|
||||
cur_line.push(...reversed_chunks.pop())
|
||||
}
|
||||
|
||||
// If we're not allowed to break long words, and there's already
|
||||
// text on the current line, do nothing. Next time through the
|
||||
// main loop of _wrap_chunks(), we'll wind up here again, but
|
||||
// cur_len will be zero, so the next line will be entirely
|
||||
// devoted to the long word that we can't handle right now.
|
||||
}
|
||||
|
||||
_wrap_chunks(chunks) {
|
||||
/*
|
||||
* _wrap_chunks(chunks : [string]) -> [string]
|
||||
*
|
||||
* Wrap a sequence of text chunks and return a list of lines of
|
||||
* length 'self.width' or less. (If 'break_long_words' is false,
|
||||
* some lines may be longer than this.) Chunks correspond roughly
|
||||
* to words and the whitespace between them: each chunk is
|
||||
* indivisible (modulo 'break_long_words'), but a line break can
|
||||
* come between any two chunks. Chunks should not have internal
|
||||
* whitespace; ie. a chunk is either all whitespace or a "word".
|
||||
* Whitespace chunks will be removed from the beginning and end of
|
||||
* lines, but apart from that whitespace is preserved.
|
||||
*/
|
||||
let lines = []
|
||||
let indent
|
||||
if (this.width <= 0) {
|
||||
throw Error(`invalid width ${this.width} (must be > 0)`)
|
||||
}
|
||||
if (this.max_lines !== undefined) {
|
||||
if (this.max_lines > 1) {
|
||||
indent = this.subsequent_indent
|
||||
} else {
|
||||
indent = this.initial_indent
|
||||
}
|
||||
if (indent.length + this.placeholder.trimStart().length > this.width) {
|
||||
throw Error('placeholder too large for max width')
|
||||
}
|
||||
}
|
||||
|
||||
// Arrange in reverse order so items can be efficiently popped
|
||||
// from a stack of chucks.
|
||||
chunks = chunks.reverse()
|
||||
|
||||
while (chunks.length > 0) {
|
||||
|
||||
// Start the list of chunks that will make up the current line.
|
||||
// cur_len is just the length of all the chunks in cur_line.
|
||||
let cur_line = []
|
||||
let cur_len = 0
|
||||
|
||||
// Figure out which static string will prefix this line.
|
||||
let indent
|
||||
if (lines) {
|
||||
indent = this.subsequent_indent
|
||||
} else {
|
||||
indent = this.initial_indent
|
||||
}
|
||||
|
||||
// Maximum width for this line.
|
||||
let width = this.width - indent.length
|
||||
|
||||
// First chunk on line is whitespace -- drop it, unless this
|
||||
// is the very beginning of the text (ie. no lines started yet).
|
||||
if (this.drop_whitespace && chunks[chunks.length - 1].trim() === '' && lines.length > 0) {
|
||||
chunks.pop()
|
||||
}
|
||||
|
||||
while (chunks.length > 0) {
|
||||
let l = chunks[chunks.length - 1].length
|
||||
|
||||
// Can at least squeeze this chunk onto the current line.
|
||||
if (cur_len + l <= width) {
|
||||
cur_line.push(chunks.pop())
|
||||
cur_len += l
|
||||
|
||||
// Nope, this line is full.
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// The current line is full, and the next chunk is too big to
|
||||
// fit on *any* line (not just this one).
|
||||
if (chunks.length && chunks[chunks.length - 1].length > width) {
|
||||
this._handle_long_word(chunks, cur_line, cur_len, width)
|
||||
cur_len = cur_line.map(l => l.length).reduce((a, b) => a + b, 0)
|
||||
}
|
||||
|
||||
// If the last chunk on this line is all whitespace, drop it.
|
||||
if (this.drop_whitespace && cur_line.length > 0 && cur_line[cur_line.length - 1].trim() === '') {
|
||||
cur_len -= cur_line[cur_line.length - 1].length
|
||||
cur_line.pop()
|
||||
}
|
||||
|
||||
if (cur_line) {
|
||||
if (this.max_lines === undefined ||
|
||||
lines.length + 1 < this.max_lines ||
|
||||
(chunks.length === 0 ||
|
||||
this.drop_whitespace &&
|
||||
chunks.length === 1 &&
|
||||
!chunks[0].trim()) && cur_len <= width) {
|
||||
// Convert current line back to a string and store it in
|
||||
// list of all lines (return value).
|
||||
lines.push(indent + cur_line.join(''))
|
||||
} else {
|
||||
let had_break = false
|
||||
while (cur_line) {
|
||||
if (cur_line[cur_line.length - 1].trim() &&
|
||||
cur_len + this.placeholder.length <= width) {
|
||||
cur_line.push(this.placeholder)
|
||||
lines.push(indent + cur_line.join(''))
|
||||
had_break = true
|
||||
break
|
||||
}
|
||||
cur_len -= cur_line[-1].length
|
||||
cur_line.pop()
|
||||
}
|
||||
if (!had_break) {
|
||||
if (lines) {
|
||||
let prev_line = lines[lines.length - 1].trimEnd()
|
||||
if (prev_line.length + this.placeholder.length <=
|
||||
this.width) {
|
||||
lines[lines.length - 1] = prev_line + this.placeholder
|
||||
break
|
||||
}
|
||||
}
|
||||
lines.push(indent + this.placeholder.lstrip())
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
_split_chunks(text) {
|
||||
text = this._munge_whitespace(text)
|
||||
return this._split(text)
|
||||
}
|
||||
|
||||
// -- Public interface ----------------------------------------------
|
||||
|
||||
wrap(text) {
|
||||
/*
|
||||
* wrap(text : string) -> [string]
|
||||
*
|
||||
* Reformat the single paragraph in 'text' so it fits in lines of
|
||||
* no more than 'self.width' columns, and return a list of wrapped
|
||||
* lines. Tabs in 'text' are expanded with string.expandtabs(),
|
||||
* and all other whitespace characters (including newline) are
|
||||
* converted to space.
|
||||
*/
|
||||
let chunks = this._split_chunks(text)
|
||||
// not implemented in js
|
||||
//if (this.fix_sentence_endings) {
|
||||
// this._fix_sentence_endings(chunks)
|
||||
//}
|
||||
return this._wrap_chunks(chunks)
|
||||
}
|
||||
|
||||
fill(text) {
|
||||
/*
|
||||
* fill(text : string) -> string
|
||||
*
|
||||
* Reformat the single paragraph in 'text' to fit in lines of no
|
||||
* more than 'self.width' columns, and return a new string
|
||||
* containing the entire wrapped paragraph.
|
||||
*/
|
||||
return this.wrap(text).join('\n')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// -- Convenience interface ---------------------------------------------
|
||||
|
||||
function wrap(text, options = {}) {
|
||||
/*
|
||||
* Wrap a single paragraph of text, returning a list of wrapped lines.
|
||||
*
|
||||
* Reformat the single paragraph in 'text' so it fits in lines of no
|
||||
* more than 'width' columns, and return a list of wrapped lines. By
|
||||
* default, tabs in 'text' are expanded with string.expandtabs(), and
|
||||
* all other whitespace characters (including newline) are converted to
|
||||
* space. See TextWrapper class for available keyword args to customize
|
||||
* wrapping behaviour.
|
||||
*/
|
||||
let { width = 70, ...kwargs } = options
|
||||
let w = new TextWrapper(Object.assign({ width }, kwargs))
|
||||
return w.wrap(text)
|
||||
}
|
||||
|
||||
function fill(text, options = {}) {
|
||||
/*
|
||||
* Fill a single paragraph of text, returning a new string.
|
||||
*
|
||||
* Reformat the single paragraph in 'text' to fit in lines of no more
|
||||
* than 'width' columns, and return a new string containing the entire
|
||||
* wrapped paragraph. As with wrap(), tabs are expanded and other
|
||||
* whitespace characters converted to space. See TextWrapper class for
|
||||
* available keyword args to customize wrapping behaviour.
|
||||
*/
|
||||
let { width = 70, ...kwargs } = options
|
||||
let w = new TextWrapper(Object.assign({ width }, kwargs))
|
||||
return w.fill(text)
|
||||
}
|
||||
|
||||
// -- Loosely related functionality -------------------------------------
|
||||
|
||||
let _whitespace_only_re = /^[ \t]+$/mg
|
||||
let _leading_whitespace_re = /(^[ \t]*)(?:[^ \t\n])/mg
|
||||
|
||||
function dedent(text) {
|
||||
/*
|
||||
* Remove any common leading whitespace from every line in `text`.
|
||||
*
|
||||
* This can be used to make triple-quoted strings line up with the left
|
||||
* edge of the display, while still presenting them in the source code
|
||||
* in indented form.
|
||||
*
|
||||
* Note that tabs and spaces are both treated as whitespace, but they
|
||||
* are not equal: the lines " hello" and "\\thello" are
|
||||
* considered to have no common leading whitespace.
|
||||
*
|
||||
* Entirely blank lines are normalized to a newline character.
|
||||
*/
|
||||
// Look for the longest leading string of spaces and tabs common to
|
||||
// all lines.
|
||||
let margin = undefined
|
||||
text = text.replace(_whitespace_only_re, '')
|
||||
let indents = text.match(_leading_whitespace_re) || []
|
||||
for (let indent of indents) {
|
||||
indent = indent.slice(0, -1)
|
||||
|
||||
if (margin === undefined) {
|
||||
margin = indent
|
||||
|
||||
// Current line more deeply indented than previous winner:
|
||||
// no change (previous winner is still on top).
|
||||
} else if (indent.startsWith(margin)) {
|
||||
// pass
|
||||
|
||||
// Current line consistent with and no deeper than previous winner:
|
||||
// it's the new winner.
|
||||
} else if (margin.startsWith(indent)) {
|
||||
margin = indent
|
||||
|
||||
// Find the largest common whitespace between current line and previous
|
||||
// winner.
|
||||
} else {
|
||||
for (let i = 0; i < margin.length && i < indent.length; i++) {
|
||||
if (margin[i] !== indent[i]) {
|
||||
margin = margin.slice(0, i)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (margin) {
|
||||
text = text.replace(new RegExp('^' + margin, 'mg'), '')
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
module.exports = { wrap, fill, dedent }
|
63
hera-portal/node_modules/sql-formatter/node_modules/argparse/package.json
generated
vendored
Normal file
63
hera-portal/node_modules/sql-formatter/node_modules/argparse/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "argparse@^2.0.1",
|
||||
"_id": "argparse@2.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
|
||||
"_location": "/sql-formatter/argparse",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "argparse@^2.0.1",
|
||||
"name": "argparse",
|
||||
"escapedName": "argparse",
|
||||
"rawSpec": "^2.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sql-formatter"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
|
||||
"_shasum": "246f50f3ca78a3240f6c997e8a9bd1eac49e4b38",
|
||||
"_spec": "argparse@^2.0.1",
|
||||
"_where": "/Users/scx/work/git/person/hera_tuya/hera-portal/node_modules/sql-formatter",
|
||||
"bugs": {
|
||||
"url": "https://github.com/nodeca/argparse/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "CLI arguments parser. Native port of python's argparse.",
|
||||
"devDependencies": {
|
||||
"@babel/eslint-parser": "^7.11.0",
|
||||
"@babel/plugin-syntax-class-properties": "^7.10.4",
|
||||
"eslint": "^7.5.0",
|
||||
"mocha": "^8.0.1",
|
||||
"nyc": "^15.1.0"
|
||||
},
|
||||
"files": [
|
||||
"argparse.js",
|
||||
"lib/"
|
||||
],
|
||||
"homepage": "https://github.com/nodeca/argparse#readme",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"parser",
|
||||
"argparse",
|
||||
"option",
|
||||
"args"
|
||||
],
|
||||
"license": "Python-2.0",
|
||||
"main": "argparse.js",
|
||||
"name": "argparse",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/nodeca/argparse.git"
|
||||
},
|
||||
"scripts": {
|
||||
"coverage": "npm run test && nyc report --reporter html",
|
||||
"lint": "eslint .",
|
||||
"test": "npm run lint && nyc mocha"
|
||||
},
|
||||
"version": "2.0.1"
|
||||
}
|
207
hera-portal/node_modules/sql-formatter/package.json
generated
vendored
Normal file
207
hera-portal/node_modules/sql-formatter/package.json
generated
vendored
Normal file
@ -0,0 +1,207 @@
|
||||
{
|
||||
"_from": "sql-formatter@^4.0.2",
|
||||
"_id": "sql-formatter@4.0.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-R6u9GJRiXZLr/lDo8p56L+OyyN2QFJPCDnsyEOsbdIpsnDKL8gubYFo7lNR7Zx7hfdWT80SfkoVS0CMaF/DE2w==",
|
||||
"_location": "/sql-formatter",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "sql-formatter@^4.0.2",
|
||||
"name": "sql-formatter",
|
||||
"escapedName": "sql-formatter",
|
||||
"rawSpec": "^4.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/sql-formatter/-/sql-formatter-4.0.2.tgz",
|
||||
"_shasum": "2b359e5a4c611498d327b9659da7329d71724607",
|
||||
"_spec": "sql-formatter@^4.0.2",
|
||||
"_where": "/Users/scx/work/git/person/hera_tuya/hera-portal",
|
||||
"bin": {
|
||||
"sql-formatter": "bin/sqlfmt.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/zeroturnaround/sql-formatter/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Adrien Pyke",
|
||||
"email": "adpyke@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Andrew"
|
||||
},
|
||||
{
|
||||
"name": "Benjamin Bellamy"
|
||||
},
|
||||
{
|
||||
"name": "bingou"
|
||||
},
|
||||
{
|
||||
"name": "Damon Davison",
|
||||
"email": "ddavison@avalere.com"
|
||||
},
|
||||
{
|
||||
"name": "Davut Can Abacigil",
|
||||
"email": "can@teamsql.io"
|
||||
},
|
||||
{
|
||||
"name": "Erik Hirmo",
|
||||
"email": "erik.hirmo@roguewave.com"
|
||||
},
|
||||
{
|
||||
"name": "George Leslie-Waksman",
|
||||
"email": "waksman@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Ian Campbell",
|
||||
"email": "icampbell@immuta.com"
|
||||
},
|
||||
{
|
||||
"name": "ivan baktsheev"
|
||||
},
|
||||
{
|
||||
"name": "João Pimentel Ferreira"
|
||||
},
|
||||
{
|
||||
"name": "Martin Nowak",
|
||||
"email": "code@dawg.eu"
|
||||
},
|
||||
{
|
||||
"name": "Matheus Salmi",
|
||||
"email": "mathsalmi@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Matheus Teixeira",
|
||||
"email": "matheus.mtxr@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Nicolas Dermine",
|
||||
"email": "nicolas.dermine@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Offir Baron",
|
||||
"email": "ofir@panoply.io"
|
||||
},
|
||||
{
|
||||
"name": "Olexandr Sydorchuk",
|
||||
"email": "olexandr.syd@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Rafael Pinto",
|
||||
"email": "raprp@posteo.de"
|
||||
},
|
||||
{
|
||||
"name": "Rahel Rjadnev-Meristo",
|
||||
"email": "rahelini@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Rene Saarsoo",
|
||||
"email": "nene@triin.net"
|
||||
},
|
||||
{
|
||||
"name": "Rodrigo Stuchi"
|
||||
},
|
||||
{
|
||||
"name": "Sasha Aliashkevich",
|
||||
"email": "olsender@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Sergei Egorov",
|
||||
"email": "sergei.egorov@zeroturnaround.com"
|
||||
},
|
||||
{
|
||||
"name": "Tyler Jones",
|
||||
"email": "tyler.jones@txwormhole.com"
|
||||
},
|
||||
{
|
||||
"name": "Uku Pattak",
|
||||
"email": "ukupat@gmail.com"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Format whitespace in a SQL query to make it more readable",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.10.4",
|
||||
"@babel/core": "^7.10.4",
|
||||
"@babel/plugin-proposal-class-properties": "^7.10.4",
|
||||
"@babel/preset-env": "^7.10.4",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-jest": "^26.1.0",
|
||||
"babel-loader": "^8.1.0",
|
||||
"babel-plugin-add-module-exports": "^1.0.2",
|
||||
"dedent-js": "^1.0.1",
|
||||
"eslint": "^7.4.0",
|
||||
"eslint-config-airbnb-base": "^14.2.0",
|
||||
"eslint-config-prettier": "^6.11.0",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"eslint-plugin-prettier": "^3.1.4",
|
||||
"jest": "^26.1.0",
|
||||
"prettier": "^2.0.5",
|
||||
"rimraf": "^3.0.2",
|
||||
"webpack": "^4.43.0",
|
||||
"webpack-cli": "^3.3.12",
|
||||
"webpack-merge": "^5.0.8"
|
||||
},
|
||||
"files": [
|
||||
"bin",
|
||||
"dist",
|
||||
"lib",
|
||||
"src"
|
||||
],
|
||||
"homepage": "https://github.com/zeroturnaround/sql-formatter#readme",
|
||||
"jest": {
|
||||
"roots": [
|
||||
"test"
|
||||
],
|
||||
"testRegex": ".*Test",
|
||||
"collectCoverage": true
|
||||
},
|
||||
"keywords": [
|
||||
"sql",
|
||||
"formatter",
|
||||
"format",
|
||||
"n1ql",
|
||||
"redshift",
|
||||
"spark",
|
||||
"whitespace",
|
||||
"mysql",
|
||||
"mariadb",
|
||||
"postgresql",
|
||||
"pl/sql",
|
||||
"transact-sql",
|
||||
"db2"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/sqlFormatter.js",
|
||||
"name": "sql-formatter",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zeroturnaround/sql-formatter.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build:commonjs && npm run build:umd && npm run build:umd:min",
|
||||
"build:commonjs": "babel src --out-dir lib",
|
||||
"build:umd": "webpack --config webpack.dev.js",
|
||||
"build:umd:min": "webpack --config webpack.prod.js",
|
||||
"check": "npm run pretty:check && npm run lint && npm run test",
|
||||
"clean": "rimraf lib dist",
|
||||
"lint": "eslint .",
|
||||
"prepare": "npm run clean && npm run check && npm run build",
|
||||
"pretty": "prettier --write .",
|
||||
"pretty:check": "prettier --check .",
|
||||
"test": "jest",
|
||||
"test:watch": "npm run test -- --watch"
|
||||
},
|
||||
"types": "src/sqlFormatter.d.ts",
|
||||
"version": "4.0.2"
|
||||
}
|
251
hera-portal/node_modules/sql-formatter/src/core/Formatter.js
generated
vendored
Normal file
251
hera-portal/node_modules/sql-formatter/src/core/Formatter.js
generated
vendored
Normal file
@ -0,0 +1,251 @@
|
||||
import tokenTypes from './tokenTypes';
|
||||
import Indentation from './Indentation';
|
||||
import InlineBlock from './InlineBlock';
|
||||
import Params from './Params';
|
||||
import { trimSpacesEnd } from '../utils';
|
||||
import { isAnd, isBetween, isLimit } from './token';
|
||||
|
||||
export default class Formatter {
|
||||
/**
|
||||
* @param {Object} cfg
|
||||
* @param {String} cfg.language
|
||||
* @param {String} cfg.indent
|
||||
* @param {Boolean} cfg.uppercase
|
||||
* @param {Integer} cfg.linesBetweenQueries
|
||||
* @param {Object} cfg.params
|
||||
*/
|
||||
constructor(cfg) {
|
||||
this.cfg = cfg;
|
||||
this.indentation = new Indentation(this.cfg.indent);
|
||||
this.inlineBlock = new InlineBlock();
|
||||
this.params = new Params(this.cfg.params);
|
||||
this.previousReservedToken = {};
|
||||
this.tokens = [];
|
||||
this.index = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* SQL Tokenizer for this formatter, provided by subclasses.
|
||||
*/
|
||||
tokenizer() {
|
||||
throw new Error('tokenizer() not implemented by subclass');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reprocess and modify a token based on parsed context.
|
||||
*
|
||||
* @param {Object} token The token to modify
|
||||
* @param {String} token.type
|
||||
* @param {String} token.value
|
||||
* @return {Object} new token or the original
|
||||
* @return {String} token.type
|
||||
* @return {String} token.value
|
||||
*/
|
||||
tokenOverride(token) {
|
||||
// subclasses can override this to modify tokens during formatting
|
||||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats whitespace in a SQL string to make it easier to read.
|
||||
*
|
||||
* @param {String} query The SQL query string
|
||||
* @return {String} formatted query
|
||||
*/
|
||||
format(query) {
|
||||
this.tokens = this.tokenizer().tokenize(query);
|
||||
const formattedQuery = this.getFormattedQueryFromTokens();
|
||||
|
||||
return formattedQuery.trim();
|
||||
}
|
||||
|
||||
getFormattedQueryFromTokens() {
|
||||
let formattedQuery = '';
|
||||
|
||||
this.tokens.forEach((token, index) => {
|
||||
this.index = index;
|
||||
|
||||
token = this.tokenOverride(token);
|
||||
|
||||
if (token.type === tokenTypes.LINE_COMMENT) {
|
||||
formattedQuery = this.formatLineComment(token, formattedQuery);
|
||||
} else if (token.type === tokenTypes.BLOCK_COMMENT) {
|
||||
formattedQuery = this.formatBlockComment(token, formattedQuery);
|
||||
} else if (token.type === tokenTypes.RESERVED_TOP_LEVEL) {
|
||||
formattedQuery = this.formatTopLevelReservedWord(token, formattedQuery);
|
||||
this.previousReservedToken = token;
|
||||
} else if (token.type === tokenTypes.RESERVED_TOP_LEVEL_NO_INDENT) {
|
||||
formattedQuery = this.formatTopLevelReservedWordNoIndent(token, formattedQuery);
|
||||
this.previousReservedToken = token;
|
||||
} else if (token.type === tokenTypes.RESERVED_NEWLINE) {
|
||||
formattedQuery = this.formatNewlineReservedWord(token, formattedQuery);
|
||||
this.previousReservedToken = token;
|
||||
} else if (token.type === tokenTypes.RESERVED) {
|
||||
formattedQuery = this.formatWithSpaces(token, formattedQuery);
|
||||
this.previousReservedToken = token;
|
||||
} else if (token.type === tokenTypes.OPEN_PAREN) {
|
||||
formattedQuery = this.formatOpeningParentheses(token, formattedQuery);
|
||||
} else if (token.type === tokenTypes.CLOSE_PAREN) {
|
||||
formattedQuery = this.formatClosingParentheses(token, formattedQuery);
|
||||
} else if (token.type === tokenTypes.PLACEHOLDER) {
|
||||
formattedQuery = this.formatPlaceholder(token, formattedQuery);
|
||||
} else if (token.value === ',') {
|
||||
formattedQuery = this.formatComma(token, formattedQuery);
|
||||
} else if (token.value === ':') {
|
||||
formattedQuery = this.formatWithSpaceAfter(token, formattedQuery);
|
||||
} else if (token.value === '.') {
|
||||
formattedQuery = this.formatWithoutSpaces(token, formattedQuery);
|
||||
} else if (token.value === ';') {
|
||||
formattedQuery = this.formatQuerySeparator(token, formattedQuery);
|
||||
} else {
|
||||
formattedQuery = this.formatWithSpaces(token, formattedQuery);
|
||||
}
|
||||
});
|
||||
return formattedQuery;
|
||||
}
|
||||
|
||||
formatLineComment(token, query) {
|
||||
return this.addNewline(query + this.show(token));
|
||||
}
|
||||
|
||||
formatBlockComment(token, query) {
|
||||
return this.addNewline(this.addNewline(query) + this.indentComment(token.value));
|
||||
}
|
||||
|
||||
indentComment(comment) {
|
||||
return comment.replace(/\n[ \t]*/gu, '\n' + this.indentation.getIndent() + ' ');
|
||||
}
|
||||
|
||||
formatTopLevelReservedWordNoIndent(token, query) {
|
||||
this.indentation.decreaseTopLevel();
|
||||
query = this.addNewline(query) + this.equalizeWhitespace(this.show(token));
|
||||
return this.addNewline(query);
|
||||
}
|
||||
|
||||
formatTopLevelReservedWord(token, query) {
|
||||
this.indentation.decreaseTopLevel();
|
||||
|
||||
query = this.addNewline(query);
|
||||
|
||||
this.indentation.increaseTopLevel();
|
||||
|
||||
query += this.equalizeWhitespace(this.show(token));
|
||||
return this.addNewline(query);
|
||||
}
|
||||
|
||||
formatNewlineReservedWord(token, query) {
|
||||
if (isAnd(token) && isBetween(this.tokenLookBehind(2))) {
|
||||
return this.formatWithSpaces(token, query);
|
||||
}
|
||||
return this.addNewline(query) + this.equalizeWhitespace(this.show(token)) + ' ';
|
||||
}
|
||||
|
||||
// Replace any sequence of whitespace characters with single space
|
||||
equalizeWhitespace(string) {
|
||||
return string.replace(/\s+/gu, ' ');
|
||||
}
|
||||
|
||||
// Opening parentheses increase the block indent level and start a new line
|
||||
formatOpeningParentheses(token, query) {
|
||||
// Take out the preceding space unless there was whitespace there in the original query
|
||||
// or another opening parens or line comment
|
||||
const preserveWhitespaceFor = {
|
||||
[tokenTypes.OPEN_PAREN]: true,
|
||||
[tokenTypes.LINE_COMMENT]: true,
|
||||
[tokenTypes.OPERATOR]: true,
|
||||
};
|
||||
if (
|
||||
token.whitespaceBefore.length === 0 &&
|
||||
!preserveWhitespaceFor[this.tokenLookBehind()?.type]
|
||||
) {
|
||||
query = trimSpacesEnd(query);
|
||||
}
|
||||
query += this.show(token);
|
||||
|
||||
this.inlineBlock.beginIfPossible(this.tokens, this.index);
|
||||
|
||||
if (!this.inlineBlock.isActive()) {
|
||||
this.indentation.increaseBlockLevel();
|
||||
query = this.addNewline(query);
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
// Closing parentheses decrease the block indent level
|
||||
formatClosingParentheses(token, query) {
|
||||
if (this.inlineBlock.isActive()) {
|
||||
this.inlineBlock.end();
|
||||
return this.formatWithSpaceAfter(token, query);
|
||||
} else {
|
||||
this.indentation.decreaseBlockLevel();
|
||||
return this.formatWithSpaces(token, this.addNewline(query));
|
||||
}
|
||||
}
|
||||
|
||||
formatPlaceholder(token, query) {
|
||||
return query + this.params.get(token) + ' ';
|
||||
}
|
||||
|
||||
// Commas start a new line (unless within inline parentheses or SQL "LIMIT" clause)
|
||||
formatComma(token, query) {
|
||||
query = trimSpacesEnd(query) + this.show(token) + ' ';
|
||||
|
||||
if (this.inlineBlock.isActive()) {
|
||||
return query;
|
||||
} else if (isLimit(this.previousReservedToken)) {
|
||||
return query;
|
||||
} else {
|
||||
return this.addNewline(query);
|
||||
}
|
||||
}
|
||||
|
||||
formatWithSpaceAfter(token, query) {
|
||||
return trimSpacesEnd(query) + this.show(token) + ' ';
|
||||
}
|
||||
|
||||
formatWithoutSpaces(token, query) {
|
||||
return trimSpacesEnd(query) + this.show(token);
|
||||
}
|
||||
|
||||
formatWithSpaces(token, query) {
|
||||
return query + this.show(token) + ' ';
|
||||
}
|
||||
|
||||
formatQuerySeparator(token, query) {
|
||||
this.indentation.resetIndentation();
|
||||
return trimSpacesEnd(query) + this.show(token) + '\n'.repeat(this.cfg.linesBetweenQueries || 1);
|
||||
}
|
||||
|
||||
// Converts token to string (uppercasing it if needed)
|
||||
show({ type, value }) {
|
||||
if (
|
||||
this.cfg.uppercase &&
|
||||
(type === tokenTypes.RESERVED ||
|
||||
type === tokenTypes.RESERVED_TOP_LEVEL ||
|
||||
type === tokenTypes.RESERVED_TOP_LEVEL_NO_INDENT ||
|
||||
type === tokenTypes.RESERVED_NEWLINE ||
|
||||
type === tokenTypes.OPEN_PAREN ||
|
||||
type === tokenTypes.CLOSE_PAREN)
|
||||
) {
|
||||
return value.toUpperCase();
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
addNewline(query) {
|
||||
query = trimSpacesEnd(query);
|
||||
if (!query.endsWith('\n')) {
|
||||
query += '\n';
|
||||
}
|
||||
return query + this.indentation.getIndent();
|
||||
}
|
||||
|
||||
tokenLookBehind(n = 1) {
|
||||
return this.tokens[this.index - n];
|
||||
}
|
||||
|
||||
tokenLookAhead(n = 1) {
|
||||
return this.tokens[this.index + n];
|
||||
}
|
||||
}
|
72
hera-portal/node_modules/sql-formatter/src/core/Indentation.js
generated
vendored
Normal file
72
hera-portal/node_modules/sql-formatter/src/core/Indentation.js
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
import { last } from '../utils';
|
||||
|
||||
const INDENT_TYPE_TOP_LEVEL = 'top-level';
|
||||
const INDENT_TYPE_BLOCK_LEVEL = 'block-level';
|
||||
|
||||
/**
|
||||
* Manages indentation levels.
|
||||
*
|
||||
* There are two types of indentation levels:
|
||||
*
|
||||
* - BLOCK_LEVEL : increased by open-parenthesis
|
||||
* - TOP_LEVEL : increased by RESERVED_TOP_LEVEL words
|
||||
*/
|
||||
export default class Indentation {
|
||||
/**
|
||||
* @param {String} indent Indent value, default is " " (2 spaces)
|
||||
*/
|
||||
constructor(indent) {
|
||||
this.indent = indent || ' ';
|
||||
this.indentTypes = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns current indentation string.
|
||||
* @return {String}
|
||||
*/
|
||||
getIndent() {
|
||||
return this.indent.repeat(this.indentTypes.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increases indentation by one top-level indent.
|
||||
*/
|
||||
increaseTopLevel() {
|
||||
this.indentTypes.push(INDENT_TYPE_TOP_LEVEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Increases indentation by one block-level indent.
|
||||
*/
|
||||
increaseBlockLevel() {
|
||||
this.indentTypes.push(INDENT_TYPE_BLOCK_LEVEL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decreases indentation by one top-level indent.
|
||||
* Does nothing when the previous indent is not top-level.
|
||||
*/
|
||||
decreaseTopLevel() {
|
||||
if (this.indentTypes.length > 0 && last(this.indentTypes) === INDENT_TYPE_TOP_LEVEL) {
|
||||
this.indentTypes.pop();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Decreases indentation by one block-level indent.
|
||||
* If there are top-level indents within the block-level indent,
|
||||
* throws away these as well.
|
||||
*/
|
||||
decreaseBlockLevel() {
|
||||
while (this.indentTypes.length > 0) {
|
||||
const type = this.indentTypes.pop();
|
||||
if (type !== INDENT_TYPE_TOP_LEVEL) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resetIndentation() {
|
||||
this.indentTypes = [];
|
||||
}
|
||||
}
|
91
hera-portal/node_modules/sql-formatter/src/core/InlineBlock.js
generated
vendored
Normal file
91
hera-portal/node_modules/sql-formatter/src/core/InlineBlock.js
generated
vendored
Normal file
@ -0,0 +1,91 @@
|
||||
import tokenTypes from './tokenTypes';
|
||||
|
||||
const INLINE_MAX_LENGTH = 50;
|
||||
|
||||
/**
|
||||
* Bookkeeper for inline blocks.
|
||||
*
|
||||
* Inline blocks are parenthized expressions that are shorter than INLINE_MAX_LENGTH.
|
||||
* These blocks are formatted on a single line, unlike longer parenthized
|
||||
* expressions where open-parenthesis causes newline and increase of indentation.
|
||||
*/
|
||||
export default class InlineBlock {
|
||||
constructor() {
|
||||
this.level = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Begins inline block when lookahead through upcoming tokens determines
|
||||
* that the block would be smaller than INLINE_MAX_LENGTH.
|
||||
* @param {Object[]} tokens Array of all tokens
|
||||
* @param {Number} index Current token position
|
||||
*/
|
||||
beginIfPossible(tokens, index) {
|
||||
if (this.level === 0 && this.isInlineBlock(tokens, index)) {
|
||||
this.level = 1;
|
||||
} else if (this.level > 0) {
|
||||
this.level++;
|
||||
} else {
|
||||
this.level = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finishes current inline block.
|
||||
* There might be several nested ones.
|
||||
*/
|
||||
end() {
|
||||
this.level--;
|
||||
}
|
||||
|
||||
/**
|
||||
* True when inside an inline block
|
||||
* @return {Boolean}
|
||||
*/
|
||||
isActive() {
|
||||
return this.level > 0;
|
||||
}
|
||||
|
||||
// Check if this should be an inline parentheses block
|
||||
// Examples are "NOW()", "COUNT(*)", "int(10)", key(`somecolumn`), DECIMAL(7,2)
|
||||
isInlineBlock(tokens, index) {
|
||||
let length = 0;
|
||||
let level = 0;
|
||||
|
||||
for (let i = index; i < tokens.length; i++) {
|
||||
const token = tokens[i];
|
||||
length += token.value.length;
|
||||
|
||||
// Overran max length
|
||||
if (length > INLINE_MAX_LENGTH) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (token.type === tokenTypes.OPEN_PAREN) {
|
||||
level++;
|
||||
} else if (token.type === tokenTypes.CLOSE_PAREN) {
|
||||
level--;
|
||||
if (level === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isForbiddenToken(token)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reserved words that cause newlines, comments and semicolons
|
||||
// are not allowed inside inline parentheses block
|
||||
isForbiddenToken({ type, value }) {
|
||||
return (
|
||||
type === tokenTypes.RESERVED_TOP_LEVEL ||
|
||||
type === tokenTypes.RESERVED_NEWLINE ||
|
||||
type === tokenTypes.COMMENT ||
|
||||
type === tokenTypes.BLOCK_COMMENT ||
|
||||
value === ';'
|
||||
);
|
||||
}
|
||||
}
|
29
hera-portal/node_modules/sql-formatter/src/core/Params.js
generated
vendored
Normal file
29
hera-portal/node_modules/sql-formatter/src/core/Params.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Handles placeholder replacement with given params.
|
||||
*/
|
||||
export default class Params {
|
||||
/**
|
||||
* @param {Object} params
|
||||
*/
|
||||
constructor(params) {
|
||||
this.params = params;
|
||||
this.index = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns param value that matches given placeholder with param key.
|
||||
* @param {Object} token
|
||||
* @param {String} token.key Placeholder key
|
||||
* @param {String} token.value Placeholder value
|
||||
* @return {String} param or token.value when params are missing
|
||||
*/
|
||||
get({ key, value }) {
|
||||
if (!this.params) {
|
||||
return value;
|
||||
}
|
||||
if (key) {
|
||||
return this.params[key];
|
||||
}
|
||||
return this.params[this.index++];
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user