@thetinkerinc/sprout 0.0.1 → 0.1.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.
@@ -0,0 +1,12 @@
1
+ import { makeCommander } from '@thetinkerinc/commander';
2
+ import { getDb } from '../db';
3
+ type Commander<T> = ReturnType<typeof makeCommander<Promise<T>>>;
4
+ type Db = Awaited<ReturnType<typeof getDb>>;
5
+ export declare const Anonymous: Commander<{
6
+ db: Db;
7
+ }>;
8
+ export declare const Authenticated: Commander<{
9
+ userId: string;
10
+ db: Db;
11
+ }>;
12
+ export {};
@@ -0,0 +1,20 @@
1
+ import { error } from '@sveltejs/kit';
2
+ import { makeCommander } from '@thetinkerinc/commander';
3
+ import { getDb } from '../db';
4
+ export const Anonymous = makeCommander(async () => {
5
+ const db = await getDb();
6
+ return {
7
+ db
8
+ };
9
+ });
10
+ export const Authenticated = makeCommander(async ({ event }) => {
11
+ const { userId } = event.locals.auth();
12
+ if (!userId) {
13
+ error(403, "You don't have permission to perform this action");
14
+ }
15
+ const db = await getDb();
16
+ return {
17
+ userId,
18
+ db
19
+ };
20
+ });
package/dist/index.js CHANGED
@@ -1,2 +1 @@
1
1
  "use strict";
2
- // Reexport your entry components here
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thetinkerinc/sprout",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -22,9 +22,6 @@
22
22
  "!dist/**/*.test.*",
23
23
  "!dist/**/*.spec.*"
24
24
  ],
25
- "sideEffects": [
26
- "**/*.css"
27
- ],
28
25
  "svelte": "./dist/index.js",
29
26
  "types": "./dist/index.d.ts",
30
27
  "type": "module",
@@ -36,6 +33,10 @@
36
33
  "./db": {
37
34
  "types": "./dist/db/index.d.ts",
38
35
  "svelte": "./dist/db/index.js"
36
+ },
37
+ "./commanders": {
38
+ "types": "./dist/commanders/index.d.ts",
39
+ "svelte": "./dist/commanders/index.js"
39
40
  }
40
41
  },
41
42
  "peerDependencies": {
@@ -66,6 +67,7 @@
66
67
  "publint": "^0.3.16",
67
68
  "svelte": "^5.46.1",
68
69
  "svelte-check": "^4.3.5",
70
+ "svelte-clerk": "^0.20.2",
69
71
  "tailwindcss": "^4.1.18",
70
72
  "typescript": "^5.9.3",
71
73
  "typescript-eslint": "^8.51.0",
@@ -75,6 +77,7 @@
75
77
  "svelte"
76
78
  ],
77
79
  "dependencies": {
80
+ "@thetinkerinc/commander": "^0.1.4",
78
81
  "kysely": "^0.28.9",
79
82
  "pg": "^8.16.3"
80
83
  }