rack-queries 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.eslintignore +1 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +9 -1
- data/CODE_OF_CONDUCT.md +76 -0
- data/Gemfile.lock +10 -10
- data/LICENSE +1 -1
- data/README.md +1 -0
- data/bin/example +42 -51
- data/docs/screenshot.png +0 -0
- data/lib/rack/queries/static/app.js +8 -9
- data/lib/rack/queries/version.rb +1 -1
- data/package.json +10 -10
- data/rack-queries.gemspec +1 -1
- data/yarn.lock +989 -888
- metadata +5 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7278f7eac12f1013fe34eb2b1e84e75b7114d71d0f646c275a374c6615e56a82
|
|
4
|
+
data.tar.gz: a3c052ba9ced08c46d895b1197a63cfc65132df7e5f8ac6f64b5a16c3c0fa64b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 36ef6a95c554444c3e7d18e2027da7050b3e58390b9a3a707461d17abbdbe480195f8594eb49c71d1c1ad8b5ce51d6f6f54911480a94acb0971227c12f26ad3e
|
|
7
|
+
data.tar.gz: 87bcb39c6ab1e19e1ff38342a42ddb0d48311d922bee2439de15ab9b95af5f58e1a90ad7472d97f4b85c2fd1cbabbd4e417c07f17d74e0059e2f250c19f198e0
|
data/.eslintignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.2.1] - 2019-08-09
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- [INTERNAL] Switch to using `@testing-library/react` for tests.
|
|
14
|
+
- Rebuild JavaScript dist with latest dependencies.
|
|
15
|
+
|
|
9
16
|
## [0.2.0] - 2019-05-17
|
|
10
17
|
|
|
11
18
|
### Added
|
|
@@ -41,7 +48,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
|
41
48
|
|
|
42
49
|
- Initial release 🎉
|
|
43
50
|
|
|
44
|
-
[unreleased]: https://github.com/CultureHQ/rack-queries/compare/v0.2.
|
|
51
|
+
[unreleased]: https://github.com/CultureHQ/rack-queries/compare/v0.2.1...HEAD
|
|
52
|
+
[0.2.1]: https://github.com/CultureHQ/rack-queries/compare/v0.2.0...v0.2.1
|
|
45
53
|
[0.2.0]: https://github.com/CultureHQ/rack-queries/compare/v0.1.3...v0.2.0
|
|
46
54
|
[0.1.3]: https://github.com/CultureHQ/rack-queries/compare/v0.1.2...v0.1.3
|
|
47
55
|
[0.1.2]: https://github.com/CultureHQ/rack-queries/compare/v0.1.1...v0.1.2
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
- Using welcoming and inclusive language
|
|
18
|
+
- Being respectful of differing viewpoints and experiences
|
|
19
|
+
- Gracefully accepting constructive criticism
|
|
20
|
+
- Focusing on what is best for the community
|
|
21
|
+
- Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
- The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
- Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
- Public or private harassment
|
|
29
|
+
- Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at support@culturehq.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
72
|
+
|
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
|
74
|
+
|
|
75
|
+
For answers to common questions about this code of conduct, see
|
|
76
|
+
https://www.contributor-covenant.org/faq
|
data/Gemfile.lock
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rack-queries (0.2.
|
|
4
|
+
rack-queries (0.2.1)
|
|
5
5
|
|
|
6
6
|
GEM
|
|
7
7
|
remote: https://rubygems.org/
|
|
8
8
|
specs:
|
|
9
9
|
ast (2.4.0)
|
|
10
|
-
docile (1.3.
|
|
11
|
-
jaro_winkler (1.5.
|
|
10
|
+
docile (1.3.2)
|
|
11
|
+
jaro_winkler (1.5.3)
|
|
12
12
|
json (2.2.0)
|
|
13
13
|
minitest (5.11.3)
|
|
14
14
|
parallel (1.17.0)
|
|
@@ -18,18 +18,18 @@ GEM
|
|
|
18
18
|
rack-test (1.1.0)
|
|
19
19
|
rack (>= 1.0, < 3)
|
|
20
20
|
rainbow (3.0.0)
|
|
21
|
-
rake (12.3.
|
|
22
|
-
rubocop (0.
|
|
21
|
+
rake (12.3.3)
|
|
22
|
+
rubocop (0.74.0)
|
|
23
23
|
jaro_winkler (~> 1.5.1)
|
|
24
24
|
parallel (~> 1.10)
|
|
25
25
|
parser (>= 2.6)
|
|
26
26
|
rainbow (>= 2.2.2, < 4.0)
|
|
27
27
|
ruby-progressbar (~> 1.7)
|
|
28
28
|
unicode-display_width (>= 1.4.0, < 1.7)
|
|
29
|
-
rubocop-performance (1.
|
|
30
|
-
rubocop (>= 0.
|
|
31
|
-
ruby-progressbar (1.10.
|
|
32
|
-
simplecov (0.
|
|
29
|
+
rubocop-performance (1.4.1)
|
|
30
|
+
rubocop (>= 0.71.0)
|
|
31
|
+
ruby-progressbar (1.10.1)
|
|
32
|
+
simplecov (0.17.0)
|
|
33
33
|
docile (~> 1.1)
|
|
34
34
|
json (>= 1.8, < 3)
|
|
35
35
|
simplecov-html (~> 0.10.0)
|
|
@@ -47,7 +47,7 @@ DEPENDENCIES
|
|
|
47
47
|
rack-queries!
|
|
48
48
|
rack-test (~> 1.1)
|
|
49
49
|
rake (~> 12.0)
|
|
50
|
-
rubocop (~> 0.
|
|
50
|
+
rubocop (~> 0.72)
|
|
51
51
|
rubocop-performance (~> 1.3)
|
|
52
52
|
simplecov (~> 0.16)
|
|
53
53
|
sqlite3 (~> 1.4)
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# Rack::Queries
|
|
2
2
|
|
|
3
|
+
[](https://travis-ci.com/CultureHQ/rack-queries)
|
|
3
4
|
[](https://github.com/CultureHQ/rack-queries)
|
|
4
5
|
|
|
5
6
|
This gem provides a page in your rack-based (e.g., `Rails`, `Sinatra`) application that allows quick execution of pre-built queries. The goal is to allow quick insights into the state of your application without needing to update the main UI. Consider it a backdoor admin page that you can use before you decide to truly expose query results.
|
data/bin/example
CHANGED
|
@@ -66,73 +66,64 @@ class Database
|
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
module
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
'Organization count'
|
|
73
|
-
|
|
69
|
+
module Rack
|
|
70
|
+
module Queries
|
|
71
|
+
create do
|
|
72
|
+
name 'Organization count'
|
|
73
|
+
desc 'The total count of organizations'
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
'The total count of organizations in the system'
|
|
75
|
+
run { |_opts| Database.value_from('SELECT COUNT(*) FROM orgs') }
|
|
77
76
|
end
|
|
78
77
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
end
|
|
78
|
+
create do
|
|
79
|
+
name 'User count'
|
|
80
|
+
desc 'The total count of users'
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
def org_name
|
|
86
|
-
Database.values_from('SELECT name FROM orgs')
|
|
82
|
+
run { |_opts| Database.value_from('SELECT COUNT(*) FROM users') }
|
|
87
83
|
end
|
|
88
84
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
WHERE org_id = (SELECT id FROM orgs WHERE name = :org_name)
|
|
93
|
-
SQL
|
|
85
|
+
create do
|
|
86
|
+
name 'Users'
|
|
87
|
+
desc 'The list of all users'
|
|
94
88
|
|
|
95
|
-
|
|
89
|
+
run do |_opts|
|
|
90
|
+
[%w[id org_id active name]] +
|
|
91
|
+
Database.rows_from('SELECT id, org_id, active, name FROM users')
|
|
92
|
+
end
|
|
96
93
|
end
|
|
97
|
-
end
|
|
98
94
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
end
|
|
95
|
+
create do
|
|
96
|
+
name 'Users in organizations count'
|
|
97
|
+
desc 'The total count of users in a given organization'
|
|
103
98
|
|
|
104
|
-
|
|
105
|
-
query = <<~SQL
|
|
106
|
-
SELECT COUNT(*) FROM users
|
|
107
|
-
WHERE org_id = (SELECT id FROM orgs WHERE name = :org_name)
|
|
108
|
-
AND active = 1
|
|
109
|
-
SQL
|
|
99
|
+
opt(:org_name) { Database.values_from('SELECT name FROM orgs') }
|
|
110
100
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
101
|
+
run do |opts|
|
|
102
|
+
query = <<~SQL
|
|
103
|
+
SELECT COUNT(*) FROM users
|
|
104
|
+
WHERE org_id = (SELECT id FROM orgs WHERE name = :org_name)
|
|
105
|
+
SQL
|
|
114
106
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
Database.value_from('SELECT COUNT(*) FROM users')
|
|
107
|
+
Database.value_from(query, opts)
|
|
108
|
+
end
|
|
118
109
|
end
|
|
119
|
-
end
|
|
120
|
-
end
|
|
121
110
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
Queries::OrgActiveUsersCountQuery,
|
|
126
|
-
Queries::UserCountQuery
|
|
127
|
-
)
|
|
111
|
+
create do
|
|
112
|
+
name 'Active users in organizations count'
|
|
113
|
+
desc 'The total count of active users in a given organization'
|
|
128
114
|
|
|
129
|
-
|
|
130
|
-
name 'UsersQuery'
|
|
131
|
-
desc 'The list of all users'
|
|
115
|
+
opt(:org_name) { Database.values_from('SELECT name FROM orgs') }
|
|
132
116
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
117
|
+
run do |opts|
|
|
118
|
+
query = <<~SQL
|
|
119
|
+
SELECT COUNT(*) FROM users
|
|
120
|
+
WHERE org_id = (SELECT id FROM orgs WHERE name = :org_name)
|
|
121
|
+
AND active = 1
|
|
122
|
+
SQL
|
|
123
|
+
|
|
124
|
+
Database.value_from(query, opts)
|
|
125
|
+
end
|
|
126
|
+
end
|
|
136
127
|
end
|
|
137
128
|
end
|
|
138
129
|
|
data/docs/screenshot.png
CHANGED
|
Binary file
|