Skip to content

Commit e1bd5b1

Browse files
authored
feat: configuration options and defaults (#3)
* feat: configuration options and defaults * chore: gh workflow update * docs: add demo * docs: update readme * docs(readme): update url placeholder
1 parent 6e3413a commit e1bd5b1

File tree

10 files changed

+474
-131
lines changed

10 files changed

+474
-131
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- main
7+
- next
78

89
permissions:
910
contents: write

.gitignore

Lines changed: 176 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,177 @@
1-
node_modules
1+
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
2+
3+
# Logs
4+
5+
logs
6+
_.log
7+
npm-debug.log_
8+
yarn-debug.log*
9+
yarn-error.log*
10+
lerna-debug.log*
11+
.pnpm-debug.log*
12+
13+
# Caches
14+
15+
.cache
16+
17+
# Diagnostic reports (https://nodejs.org/api/report.html)
18+
19+
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
20+
21+
# Runtime data
22+
23+
pids
24+
_.pid
25+
_.seed
26+
*.pid.lock
27+
28+
# Directory for instrumented libs generated by jscoverage/JSCover
29+
30+
lib-cov
31+
32+
# Coverage directory used by tools like istanbul
33+
34+
coverage
35+
*.lcov
36+
37+
# nyc test coverage
38+
39+
.nyc_output
40+
41+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
42+
43+
.grunt
44+
45+
# Bower dependency directory (https://bower.io/)
46+
47+
bower_components
48+
49+
# node-waf configuration
50+
51+
.lock-wscript
52+
53+
# Compiled binary addons (https://nodejs.org/api/addons.html)
54+
55+
build/Release
56+
57+
# Dependency directories
58+
59+
node_modules/
60+
jspm_packages/
61+
62+
# Snowpack dependency directory (https://snowpack.dev/)
63+
64+
web_modules/
65+
66+
# TypeScript cache
67+
68+
*.tsbuildinfo
69+
70+
# Optional npm cache directory
71+
72+
.npm
73+
74+
# Optional eslint cache
75+
76+
.eslintcache
77+
78+
# Optional stylelint cache
79+
80+
.stylelintcache
81+
82+
# Microbundle cache
83+
84+
.rpt2_cache/
85+
.rts2_cache_cjs/
86+
.rts2_cache_es/
87+
.rts2_cache_umd/
88+
89+
# Optional REPL history
90+
91+
.node_repl_history
92+
93+
# Output of 'npm pack'
94+
95+
*.tgz
96+
97+
# Yarn Integrity file
98+
99+
.yarn-integrity
100+
101+
# dotenv environment variable files
102+
103+
.env
104+
.env.development.local
105+
.env.test.local
106+
.env.production.local
107+
.env.local
108+
109+
# parcel-bundler cache (https://parceljs.org/)
110+
111+
.parcel-cache
112+
113+
# Next.js build output
114+
115+
.next
116+
out
117+
118+
# Nuxt.js build / generate output
119+
120+
.nuxt
2121
dist
3-
dev.db
122+
123+
# Gatsby files
124+
125+
# Comment in the public line in if your project uses Gatsby and not Next.js
126+
127+
# https://nextjs.org/blog/next-9-1#public-directory-support
128+
129+
# public
130+
131+
# vuepress build output
132+
133+
.vuepress/dist
134+
135+
# vuepress v2.x temp and cache directory
136+
137+
.temp
138+
139+
# Docusaurus cache and generated files
140+
141+
.docusaurus
142+
143+
# Serverless directories
144+
145+
.serverless/
146+
147+
# FuseBox cache
148+
149+
.fusebox/
150+
151+
# DynamoDB Local files
152+
153+
.dynamodb/
154+
155+
# TernJS port file
156+
157+
.tern-port
158+
159+
# Stores VSCode versions used for testing VSCode extensions
160+
161+
.vscode-test
162+
163+
# yarn v2
164+
165+
.yarn/cache
166+
.yarn/unplugged
167+
.yarn/build-state.yml
168+
.yarn/install-state.gz
169+
.pnp.*
170+
171+
# IntelliJ based IDEs
172+
.idea
173+
174+
# Finder (MacOS) folder config
175+
.DS_Store
176+
177+
*.db

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) 2024 Turso
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: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,32 @@ import * as Sentry from "@sentry/node";
2020
import { libsqlIntegration } from "sentry-integration-libsql-client";
2121

2222
const libsqlClient = createClient({
23-
url: "...",
23+
url: "libsql://...",
2424
authToken: "...",
2525
});
2626

2727
Sentry.init({
2828
dsn: "...",
2929
tracesSampleRate: 1,
3030
profilesSampleRate: 1,
31-
integrations: [libsqlIntegration(libsqlClient, Sentry)],
31+
integrations: [
32+
libsqlIntegration(client, Sentry, {
33+
tracing: true,
34+
breadcrumbs: true,
35+
errors: true,
36+
}),
37+
],
3238
});
3339

3440
await libsqlClient.execute("SELECT * FROM users");
3541
```
42+
43+
## Not yet got a database?
44+
45+
1. [![Create Database](https://sqlite.new/button)](https://sqlite.new)
46+
2. Copy the Database URL, and create an auth token for your database
47+
3. Install the libSQL SDK
48+
49+
```bash
50+
npm install @libsql/client
51+
```

demo/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# demo
2+
3+
To install dependencies:
4+
5+
```bash
6+
bun install
7+
```
8+
9+
To run:
10+
11+
```bash
12+
bun run index.ts
13+
```
14+
15+
This project was created using `bun init` in bun v1.0.15. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.

demo/bun.lockb

2.7 KB
Binary file not shown.

demo/index.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import {
2+
Client,
3+
createClient,
4+
InStatement,
5+
Transaction,
6+
TransactionMode,
7+
} from "@libsql/client";
8+
import * as Sentry from "@sentry/node";
9+
10+
import { libsqlIntegration } from "../src";
11+
12+
const libsqlClient = createClient({
13+
url: "libsql://...",
14+
authToken: "...",
15+
});
16+
17+
Sentry.init({
18+
dsn: "https://ccf1d142a24db91da5e0d3926277f6fe@o4507576416403456.ingest.de.sentry.io/4507576457560144",
19+
tracesSampleRate: 1.0,
20+
profilesSampleRate: 1.0,
21+
integrations: [
22+
libsqlIntegration(libsqlClient, Sentry, {
23+
errors: true,
24+
breadcrumbs: true,
25+
tracing: true,
26+
}),
27+
],
28+
});
29+
30+
libsqlClient
31+
.execute("CREATE TABLE IF NOT EXISTS users (name)")
32+
.then(console.log);
33+
libsqlClient
34+
.execute(`INSERT INTO users (name) VALUES ("Jamie")`)
35+
.then(console.log);
36+
libsqlClient.execute("SELECT * FROM users").then(console.log);

demo/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "demo",
3+
"module": "index.ts",
4+
"type": "module",
5+
"devDependencies": {
6+
"bun-types": "latest"
7+
},
8+
"peerDependencies": {
9+
"typescript": "^5.0.0"
10+
}
11+
}

demo/tsconfig.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["ESNext"],
4+
"module": "esnext",
5+
"target": "esnext",
6+
"moduleResolution": "bundler",
7+
"moduleDetection": "force",
8+
"allowImportingTsExtensions": true,
9+
"noEmit": true,
10+
"composite": true,
11+
"strict": true,
12+
"downlevelIteration": true,
13+
"skipLibCheck": true,
14+
"jsx": "react-jsx",
15+
"allowSyntheticDefaultImports": true,
16+
"forceConsistentCasingInFileNames": true,
17+
"allowJs": true,
18+
"types": [
19+
"bun-types" // add Bun global
20+
]
21+
}
22+
}

0 commit comments

Comments
 (0)