@codesuma/baseline 1.0.5 → 1.0.6

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.
Files changed (2) hide show
  1. package/lib/idb.ts +23 -2
  2. package/package.json +1 -1
package/lib/idb.ts CHANGED
@@ -132,8 +132,27 @@ async function find<T>(dbName: string, store: string, options: {
132
132
  })
133
133
  }
134
134
 
135
+ // Add this factory function at the end, before export default
136
+
137
+ function createDatabase(dbName: string) {
138
+ return {
139
+ info: () => info(dbName),
140
+ createStore: (name: string, version: number, options?: StoreOptions) =>
141
+ createStore(dbName, name, version, options),
142
+ save: <T>(store: string, data: T | T[]) => save<T>(dbName, store, data),
143
+ get: <T>(store: string, id: any) => get<T>(dbName, store, id),
144
+ all: <T>(store: string) => all<T>(dbName, store),
145
+ update: <T>(store: string, data: T) => update<T>(dbName, store, data),
146
+ delete: (store: string, id: any) => del(dbName, store, id),
147
+ clear: (store: string) => clear(dbName, store),
148
+ count: (store: string) => count(dbName, store),
149
+ find: <T>(store: string, options?: Parameters<typeof find>[2]) =>
150
+ find<T>(dbName, store, options),
151
+ }
152
+ }
135
153
 
136
- export default {
154
+ // Make the export callable AND have the raw methods
155
+ const idb = Object.assign(createDatabase, {
137
156
  info,
138
157
  createStore,
139
158
  save,
@@ -144,4 +163,6 @@ export default {
144
163
  clear,
145
164
  count,
146
165
  find
147
- }
166
+ })
167
+
168
+ export default idb
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codesuma/baseline",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "A minimal, imperative UI framework for building fast web apps. No virtual DOM, no magic, no dependencies.",
5
5
  "main": "index.ts",
6
6
  "types": "index.ts",