@biltme/backend 0.5.0 → 0.5.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,7 @@
1
+ import type { StorageAdapter } from './index';
2
+ export interface AsyncStorageImpl {
3
+ getItem(key: string): Promise<string | null>;
4
+ setItem(key: string, value: string): Promise<void>;
5
+ removeItem(key: string): Promise<void>;
6
+ }
7
+ export declare function asyncStorage(impl: AsyncStorageImpl): StorageAdapter;
@@ -0,0 +1,8 @@
1
+ export interface StorageAdapter {
2
+ getItem(key: string): string | null | Promise<string | null>;
3
+ setItem(key: string, value: string): void | Promise<void>;
4
+ removeItem(key: string): void | Promise<void>;
5
+ }
6
+ export { memoryStorage } from './memory';
7
+ export { webStorage } from './web';
8
+ export { asyncStorage } from './async-storage';
@@ -0,0 +1,2 @@
1
+ import type { StorageAdapter } from './index';
2
+ export declare function memoryStorage(): StorageAdapter;
@@ -0,0 +1,2 @@
1
+ import type { StorageAdapter } from './index';
2
+ export declare function webStorage(): StorageAdapter;
package/package.json CHANGED
@@ -1,19 +1,18 @@
1
1
  {
2
2
  "name": "@biltme/backend",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Bilt backend SDK — thin shim over @supabase/supabase-js for bilt-cloud projects",
5
5
  "type": "module",
6
- "main": "dist/index.js",
7
- "types": "src/index.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
- "import": "./dist/index.js",
11
- "types": "./src/index.ts"
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
12
  }
13
13
  },
14
14
  "files": [
15
- "dist",
16
- "src"
15
+ "dist"
17
16
  ],
18
17
  "publishConfig": {
19
18
  "access": "public"
@@ -29,7 +28,7 @@
29
28
  "lint:fix": "oxlint --type-aware --type-check --fix src/",
30
29
  "format": "oxfmt --write src/",
31
30
  "format:check": "oxfmt --check src/",
32
- "build": "bun build src/index.ts --outdir dist --target node"
31
+ "build": "bun build src/index.ts --outdir dist --target node && tsc -p tsconfig.build.json"
33
32
  },
34
33
  "devDependencies": {
35
34
  "@types/bun": "latest",
package/src/index.ts DELETED
@@ -1,13 +0,0 @@
1
- export { createClient } from '@supabase/supabase-js'
2
- export { webStorage, memoryStorage, asyncStorage } from './storage'
3
- export type { StorageAdapter } from './storage'
4
- export { FunctionsHttpError, FunctionsRelayError, FunctionsFetchError, FunctionRegion } from '@supabase/supabase-js'
5
- export { StorageApiError } from '@supabase/supabase-js'
6
- export type {
7
- SupabaseClient,
8
- Session,
9
- User,
10
- AuthError,
11
- PostgrestError,
12
- FunctionInvokeOptions,
13
- } from '@supabase/supabase-js'
@@ -1,15 +0,0 @@
1
- import type { StorageAdapter } from './index'
2
-
3
- export interface AsyncStorageImpl {
4
- getItem(key: string): Promise<string | null>
5
- setItem(key: string, value: string): Promise<void>
6
- removeItem(key: string): Promise<void>
7
- }
8
-
9
- export function asyncStorage(impl: AsyncStorageImpl): StorageAdapter {
10
- return {
11
- getItem: (key) => impl.getItem(key),
12
- setItem: (key, value) => impl.setItem(key, value),
13
- removeItem: (key) => impl.removeItem(key),
14
- }
15
- }
@@ -1,9 +0,0 @@
1
- export interface StorageAdapter {
2
- getItem(key: string): string | null | Promise<string | null>
3
- setItem(key: string, value: string): void | Promise<void>
4
- removeItem(key: string): void | Promise<void>
5
- }
6
-
7
- export { memoryStorage } from './memory'
8
- export { webStorage } from './web'
9
- export { asyncStorage } from './async-storage'
@@ -1,16 +0,0 @@
1
- import type { StorageAdapter } from './index'
2
-
3
- export function memoryStorage(): StorageAdapter {
4
- const store = new Map<string, string>()
5
- return {
6
- getItem(key) {
7
- return store.get(key) ?? null
8
- },
9
- setItem(key, value) {
10
- store.set(key, value)
11
- },
12
- removeItem(key) {
13
- store.delete(key)
14
- },
15
- }
16
- }
@@ -1,38 +0,0 @@
1
- import type { StorageAdapter } from './index'
2
-
3
- export function webStorage(): StorageAdapter {
4
- let warned = false
5
- const warnOnce = (op: string, err: unknown) => {
6
- if (warned) return
7
- warned = true
8
- // eslint-disable-next-line no-console
9
- console.warn(`[bilt] localStorage ${op} failed:`, err)
10
- }
11
- return {
12
- getItem(key) {
13
- try {
14
- if (typeof window === 'undefined') return null
15
- return window.localStorage.getItem(key)
16
- } catch (err) {
17
- warnOnce('getItem', err)
18
- return null
19
- }
20
- },
21
- setItem(key, value) {
22
- try {
23
- if (typeof window === 'undefined') return
24
- window.localStorage.setItem(key, value)
25
- } catch (err) {
26
- warnOnce('setItem', err)
27
- }
28
- },
29
- removeItem(key) {
30
- try {
31
- if (typeof window === 'undefined') return
32
- window.localStorage.removeItem(key)
33
- } catch (err) {
34
- warnOnce('removeItem', err)
35
- }
36
- },
37
- }
38
- }