Skip to content

Commit 6dffef9

Browse files
committed
first commit
0 parents  commit 6dffef9

File tree

124 files changed

+15509
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+15509
-0
lines changed

.github/workflows/ci.yml

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
name: LaunchQL tests
2+
on:
3+
push:
4+
workflow_dispatch:
5+
6+
jobs:
7+
setup:
8+
runs-on: ubuntu-latest
9+
container: pyramation/node-sqitch:20.12.0
10+
11+
env:
12+
PGHOST: pg_db
13+
PGPORT: 5432
14+
PGUSER: postgres
15+
PGPASSWORD: password
16+
17+
services:
18+
pg_db:
19+
image: pyramation/pgvector:13.3-alpine
20+
env:
21+
POSTGRES_USER: postgres
22+
POSTGRES_PASSWORD: password
23+
options: >-
24+
--health-cmd pg_isready
25+
--health-interval 10s
26+
--health-timeout 5s
27+
--health-retries 5
28+
ports:
29+
- 5432:5432
30+
31+
minio_cdn:
32+
image: minio/minio:edge-cicd
33+
env:
34+
MINIO_ROOT_USER: minioadmin
35+
MINIO_ROOT_PASSWORD: minioadmin
36+
ports:
37+
- 9000:9000
38+
- 9001:9001
39+
options: >-
40+
--health-cmd "curl -f http://localhost:9000/minio/health/live || exit 1"
41+
--health-interval 10s
42+
--health-timeout 5s
43+
--health-retries 5
44+
45+
steps:
46+
- name: Configure Git (for tests)
47+
run: |
48+
git config --global user.name "CI Test User"
49+
git config --global user.email "[email protected]"
50+
51+
- name: Checkout
52+
uses: actions/checkout@v4
53+
54+
- name: Enable corepack and pnpm
55+
run: |
56+
corepack enable
57+
corepack prepare pnpm@9 --activate
58+
pnpm -v
59+
node -v
60+
61+
- name: Install
62+
run: pnpm install
63+
64+
- name: Install LaunchQL CLI globally
65+
run: npm install -g @launchql/[email protected]
66+
67+
- name: Build
68+
run: pnpm -r build
69+
70+
- name: Seed app_user
71+
run: |
72+
lql admin-users bootstrap --yes
73+
lql admin-users add --test --yes
74+
env:
75+
PGHOST: pg_db
76+
PGPORT: 5432
77+
PGUSER: postgres
78+
PGPASSWORD: password
79+
80+
test:
81+
needs: setup
82+
runs-on: ubuntu-latest
83+
container: pyramation/node-sqitch:20.12.0
84+
continue-on-error: true
85+
strategy:
86+
fail-fast: false
87+
matrix:
88+
package:
89+
- utils/verify
90+
- utils/utils
91+
- utils/inflection
92+
- utils/faker
93+
- utils/base32
94+
- security/totp
95+
- security/jwt-claims
96+
- security/encrypted-secrets-table
97+
- security/encrypted-secrets
98+
- security/defaults
99+
- security/default-roles
100+
- metrics/measurements
101+
- metrics/achievements
102+
- meta/db_meta_test
103+
- meta/db_meta_modules
104+
- meta/db_meta
105+
- jobs/jobs
106+
- jobs/database-jobs
107+
- data-types/uuid
108+
- data-types/types
109+
- data-types/stamps
110+
- data-types/geotypes
111+
112+
env:
113+
PGHOST: pg_db
114+
PGPORT: 5432
115+
PGUSER: postgres
116+
PGPASSWORD: password
117+
118+
services:
119+
pg_db:
120+
image: pyramation/pgvector:13.3-alpine
121+
env:
122+
POSTGRES_USER: postgres
123+
POSTGRES_PASSWORD: password
124+
options: >-
125+
--health-cmd pg_isready
126+
--health-interval 10s
127+
--health-timeout 5s
128+
--health-retries 5
129+
ports:
130+
- 5432:5432
131+
132+
minio_cdn:
133+
image: minio/minio:edge-cicd
134+
env:
135+
MINIO_ROOT_USER: minioadmin
136+
MINIO_ROOT_PASSWORD: minioadmin
137+
ports:
138+
- 9000:9000
139+
- 9001:9001
140+
options: >-
141+
--health-cmd "curl -f http://localhost:9000/minio/health/live || exit 1"
142+
--health-interval 10s
143+
--health-timeout 5s
144+
--health-retries 5
145+
146+
steps:
147+
- name: Configure Git (for tests)
148+
run: |
149+
git config --global user.name "CI Test User"
150+
git config --global user.email "[email protected]"
151+
152+
- name: Checkout
153+
uses: actions/checkout@v4
154+
155+
- name: Enable corepack and pnpm
156+
run: |
157+
corepack enable
158+
corepack prepare pnpm@9 --activate
159+
pnpm -v
160+
node -v
161+
162+
- name: Install
163+
run: pnpm install
164+
165+
- name: Install LaunchQL CLI globally
166+
run: npm install -g @launchql/[email protected]
167+
168+
- name: Build
169+
run: pnpm -r build
170+
171+
- name: Seed app_user
172+
run: |
173+
lql admin-users bootstrap --yes
174+
lql admin-users add --test --yes
175+
176+
- name: Test ${{ matrix.package }}
177+
run: cd ./packages/${{ matrix.package }} && pnpm test
178+
179+
integration-test:
180+
needs: setup
181+
runs-on: ubuntu-latest
182+
container: pyramation/node-sqitch:20.12.0
183+
184+
env:
185+
PGHOST: pg_db
186+
PGPORT: 5432
187+
PGUSER: postgres
188+
PGPASSWORD: password
189+
190+
services:
191+
pg_db:
192+
image: pyramation/pgvector:13.3-alpine
193+
env:
194+
POSTGRES_USER: postgres
195+
POSTGRES_PASSWORD: password
196+
options: >-
197+
--health-cmd pg_isready
198+
--health-interval 10s
199+
--health-timeout 5s
200+
--health-retries 5
201+
ports:
202+
- 5432:5432
203+
204+
minio_cdn:
205+
image: minio/minio:edge-cicd
206+
env:
207+
MINIO_ROOT_USER: minioadmin
208+
MINIO_ROOT_PASSWORD: minioadmin
209+
ports:
210+
- 9000:9000
211+
- 9001:9001
212+
options: >-
213+
--health-cmd "curl -f http://localhost:9000/minio/health/live || exit 1"
214+
--health-interval 10s
215+
--health-timeout 5s
216+
--health-retries 5
217+
218+
steps:
219+
- name: Configure Git (for tests)
220+
run: |
221+
git config --global user.name "CI Test User"
222+
git config --global user.email "[email protected]"
223+
224+
- name: Checkout
225+
uses: actions/checkout@v4
226+
227+
- name: Enable corepack and pnpm
228+
run: |
229+
corepack enable
230+
corepack prepare pnpm@9 --activate
231+
pnpm -v
232+
node -v
233+
234+
- name: Install
235+
run: pnpm install
236+
237+
- name: Install LaunchQL CLI globally
238+
run: npm install -g @launchql/[email protected]
239+
240+
- name: Build
241+
run: pnpm -r build
242+
243+
- name: Seed app_user
244+
run: |
245+
lql admin-users bootstrap --yes
246+
lql admin-users add --test --yes
247+
248+
- name: Run Integration Tests
249+
run: ./scripts/test-all-packages.sh
250+

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
**/node_modules/
2+
**/.DS_Store
3+
**/dist
4+
**/yarn-error.log
5+
lerna-debug.log
6+
**/__tests__/**/*.js
7+
**/__tests__/**/*.test.d.ts

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"useTabs": false,
6+
"singleQuote": false
7+
}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2025 Dan Lynch <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# RLS Testing
2+
3+
```
4+
npx supabase init
5+
npx supabase start
6+
```
7+
8+
```
9+
pnpm install
10+
cd packages/base32
11+
export PGPORT=54322
12+
export PGHOST=localhost
13+
export PGUSER=postgres
14+
export PGPASSWORD=postgres
15+
```
16+

eslint.config.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const js = require("@eslint/js");
2+
const tsParser = require("@typescript-eslint/parser");
3+
const tsPlugin = require("@typescript-eslint/eslint-plugin");
4+
const simpleImportSort = require("eslint-plugin-simple-import-sort");
5+
const unusedImports = require("eslint-plugin-unused-imports");
6+
const prettier = require("eslint-config-prettier");
7+
8+
module.exports = [
9+
{ ignores: ["**/dist/**", "**/node_modules/**"] },
10+
js.configs.recommended,
11+
{
12+
languageOptions: {
13+
parser: tsParser,
14+
ecmaVersion: "latest",
15+
sourceType: "module"
16+
},
17+
plugins: {
18+
"@typescript-eslint": tsPlugin,
19+
"simple-import-sort": simpleImportSort,
20+
"unused-imports": unusedImports
21+
},
22+
rules: {
23+
...tsPlugin.configs.recommended.rules,
24+
"simple-import-sort/imports": "warn",
25+
"simple-import-sort/exports": "warn",
26+
"unused-imports/no-unused-imports": "warn"
27+
}
28+
},
29+
{
30+
files: ["**/*.config.js", "eslint.config.js", "jest.config.js", "**/jest.config.js"],
31+
languageOptions: {
32+
globals: {
33+
module: "readonly",
34+
require: "readonly"
35+
}
36+
},
37+
rules: {
38+
"@typescript-eslint/no-require-imports": "off",
39+
"no-undef": "off"
40+
}
41+
},
42+
prettier
43+
];

launchql.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"packages": [
3+
"packages/*"
4+
],
5+
"db": {
6+
"roles": {
7+
"anonymous": "anon",
8+
"authenticated": "authenticated",
9+
"administrator": "service_role",
10+
"default": "anonymous"
11+
}
12+
}
13+
}

lerna.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3+
"version": "0.2.0",
4+
"npmClient": "pnpm"
5+
}

0 commit comments

Comments
 (0)