@powersync/nuxt 0.0.0-dev-20260216124709 → 0.0.0-dev-20260305092446
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.
- package/{README → README.md} +85 -92
- package/dist/module.json +1 -1
- package/dist/module.mjs +6 -1
- package/dist/runtime/components/SyncStatusTab.vue +39 -62
- package/dist/runtime/utils/RecordingStorageAdapter.js +1 -4
- package/dist/runtime/utils/addImportsFrom.d.ts +6 -1
- package/dist/runtime/utils/addImportsFrom.js +7 -1
- package/package.json +7 -7
package/{README → README.md}
RENAMED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="
|
|
2
|
+
<img src="https://github.com/powersync-ja/powersync-js/raw/main/packages/nuxt/src/runtime/assets/powersync-icon.svg" alt="PowerSync Logo" width="64" height="64" />
|
|
3
3
|
<h1>PowerSync Nuxt</h1>
|
|
4
|
-
<p>
|
|
5
|
-
<p>Effortless offline-first development with PowerSync integration for Nuxt applications.</p>
|
|
4
|
+
<p>PowerSync for Nuxt: offline-first sync with native Nuxt integration</p>
|
|
6
5
|
</div>
|
|
7
6
|
|
|
7
|
+
> [!NOTE]
|
|
8
|
+
> The Nuxt package is currently in an **alpha** state, intended strictly for testing. Expect breaking changes and instability as development continues.
|
|
9
|
+
>
|
|
10
|
+
> Do not rely on this package for production use.
|
|
11
|
+
|
|
8
12
|
[![npm version][npm-version-src]][npm-version-href]
|
|
9
13
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
10
14
|
[![License][license-src]][license-href]
|
|
@@ -12,14 +16,15 @@
|
|
|
12
16
|
|
|
13
17
|
PowerSync Nuxt module integrated with the [Nuxt Devtools](https://github.com/nuxt/devtools).
|
|
14
18
|
|
|
15
|
-
- [
|
|
19
|
+
- [Changelog](https://github.com/powersync-ja/powersync-js/blob/main/packages/nuxt/CHANGELOG.md)
|
|
16
20
|
|
|
17
21
|
## Features
|
|
18
22
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
+
- **Real-time offline-first sync** — PowerSync keeps a local SQLite database in sync with your backend (Postgres, MongoDB, MySQL, or SQL Server). Your app reads from local SQLite and works offline; changes sync automatically when the connection is restored.
|
|
24
|
+
- **Auto-imported composables** — `usePowerSync()`, `useQuery()`, and `usePowerSyncKysely()` are available in every component without explicit imports.
|
|
25
|
+
- **Built-in diagnostics** — View connection and sync status, inspect sync buckets and config, and tail real-time logs via the PowerSync Inspector — accessible at `/__powersync-inspector` or through Nuxt Devtools.
|
|
26
|
+
- **Data inspection** — Browse your local SQLite database in the browser without external tools — useful for verifying what data has synced and debugging data issues during development.
|
|
27
|
+
- **Kysely support** — Opt-in type-safe queries via `@powersync/kysely-driver`, enabled with `kysely: true` in your PowerSync config.
|
|
23
28
|
|
|
24
29
|
## Installation
|
|
25
30
|
|
|
@@ -28,11 +33,9 @@ This module re-exports all `@powersync/vue` composables. With **npm** (v7+), ins
|
|
|
28
33
|
```bash
|
|
29
34
|
# Using npm
|
|
30
35
|
npm install @powersync/nuxt
|
|
31
|
-
npm install --save-dev vite-plugin-top-level-await vite-plugin-wasm
|
|
32
36
|
|
|
33
37
|
# Using pnpm (peer deps are not auto-installed)
|
|
34
38
|
pnpm add @powersync/nuxt @powersync/vue @powersync/web
|
|
35
|
-
pnpm add -D vite-plugin-top-level-await vite-plugin-wasm
|
|
36
39
|
```
|
|
37
40
|
|
|
38
41
|
> [!NOTE]
|
|
@@ -45,21 +48,17 @@ For a complete working app, see the [Nuxt + Supabase Todo List demo](https://git
|
|
|
45
48
|
1. Add `@powersync/nuxt` to the `modules` section of `nuxt.config.ts`:
|
|
46
49
|
|
|
47
50
|
```typescript
|
|
48
|
-
import wasm from 'vite-plugin-wasm'
|
|
49
|
-
|
|
50
51
|
export default defineNuxtConfig({
|
|
51
52
|
modules: ['@powersync/nuxt'],
|
|
52
53
|
vite: {
|
|
53
54
|
optimizeDeps: {
|
|
54
|
-
exclude: ['@
|
|
55
|
-
include: ['@powersync/web > js-logger'], // <-- Include `js-logger` when it isn't installed and imported.
|
|
55
|
+
exclude: ['@powersync/web']
|
|
56
56
|
},
|
|
57
57
|
worker: {
|
|
58
|
-
format: 'es'
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
58
|
+
format: 'es'
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
63
62
|
```
|
|
64
63
|
|
|
65
64
|
> [!WARNING]
|
|
@@ -68,29 +67,29 @@ export default defineNuxtConfig({
|
|
|
68
67
|
2. Create a PowerSync plugin (e.g., `plugins/powersync.client.ts`):
|
|
69
68
|
|
|
70
69
|
```typescript
|
|
71
|
-
import { NuxtPowerSyncDatabase } from '@powersync/nuxt'
|
|
72
|
-
import { createPowerSyncPlugin } from '@powersync/nuxt'
|
|
73
|
-
import { AppSchema } from '~/powersync/AppSchema'
|
|
74
|
-
import { PowerSyncConnector } from '~/powersync/PowerSyncConnector'
|
|
70
|
+
import { NuxtPowerSyncDatabase } from '@powersync/nuxt';
|
|
71
|
+
import { createPowerSyncPlugin } from '@powersync/nuxt';
|
|
72
|
+
import { AppSchema } from '~/powersync/AppSchema';
|
|
73
|
+
import { PowerSyncConnector } from '~/powersync/PowerSyncConnector';
|
|
75
74
|
|
|
76
75
|
export default defineNuxtPlugin({
|
|
77
76
|
async setup(nuxtApp) {
|
|
78
77
|
const db = new NuxtPowerSyncDatabase({
|
|
79
78
|
database: {
|
|
80
|
-
dbFilename: 'your-db-filename.sqlite'
|
|
79
|
+
dbFilename: 'your-db-filename.sqlite'
|
|
81
80
|
},
|
|
82
|
-
schema: AppSchema
|
|
83
|
-
})
|
|
81
|
+
schema: AppSchema
|
|
82
|
+
});
|
|
84
83
|
|
|
85
|
-
const connector = new PowerSyncConnector()
|
|
84
|
+
const connector = new PowerSyncConnector();
|
|
86
85
|
|
|
87
|
-
await db.init()
|
|
88
|
-
await db.connect(connector)
|
|
86
|
+
await db.init();
|
|
87
|
+
await db.connect(connector);
|
|
89
88
|
|
|
90
|
-
const plugin = createPowerSyncPlugin({ database: db })
|
|
91
|
-
nuxtApp.vueApp.use(plugin)
|
|
92
|
-
}
|
|
93
|
-
})
|
|
89
|
+
const plugin = createPowerSyncPlugin({ database: db });
|
|
90
|
+
nuxtApp.vueApp.use(plugin);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
94
93
|
```
|
|
95
94
|
|
|
96
95
|
At this point, you're all set to use the module composables. The module automatically exposes all `@powersync/vue` composables, so you can use them directly:
|
|
@@ -108,13 +107,13 @@ This guide will walk you through the steps to set up PowerSync in your Nuxt proj
|
|
|
108
107
|
Create a file called `AppSchema.ts` and add your schema to it.
|
|
109
108
|
|
|
110
109
|
```typescript
|
|
111
|
-
import { column, Schema, Table } from '@powersync/web'
|
|
110
|
+
import { column, Schema, Table } from '@powersync/web';
|
|
112
111
|
|
|
113
112
|
const lists = new Table({
|
|
114
113
|
created_at: column.text,
|
|
115
114
|
name: column.text,
|
|
116
|
-
owner_id: column.text
|
|
117
|
-
})
|
|
115
|
+
owner_id: column.text
|
|
116
|
+
});
|
|
118
117
|
|
|
119
118
|
const todos = new Table(
|
|
120
119
|
{
|
|
@@ -124,20 +123,20 @@ const todos = new Table(
|
|
|
124
123
|
description: column.text,
|
|
125
124
|
created_by: column.text,
|
|
126
125
|
completed_by: column.text,
|
|
127
|
-
completed: column.integer
|
|
126
|
+
completed: column.integer
|
|
128
127
|
},
|
|
129
|
-
{ indexes: { list: ['list_id'] } }
|
|
130
|
-
)
|
|
128
|
+
{ indexes: { list: ['list_id'] } }
|
|
129
|
+
);
|
|
131
130
|
|
|
132
131
|
export const AppSchema = new Schema({
|
|
133
132
|
todos,
|
|
134
|
-
lists
|
|
135
|
-
})
|
|
133
|
+
lists
|
|
134
|
+
});
|
|
136
135
|
|
|
137
136
|
// For types
|
|
138
|
-
export type Database = (typeof AppSchema)['types']
|
|
139
|
-
export type TodoRecord = Database['todos']
|
|
140
|
-
export type ListRecord = Database['lists']
|
|
137
|
+
export type Database = (typeof AppSchema)['types'];
|
|
138
|
+
export type TodoRecord = Database['todos'];
|
|
139
|
+
export type ListRecord = Database['lists'];
|
|
141
140
|
```
|
|
142
141
|
|
|
143
142
|
> **Tip**: Learn more about how to create your schema [here](https://docs.powersync.com/client-sdk-references/javascript-web#1-define-the-schema).
|
|
@@ -147,7 +146,7 @@ export type ListRecord = Database['lists']
|
|
|
147
146
|
Create a file called `PowerSyncConnector.ts` and add your connector to it.
|
|
148
147
|
|
|
149
148
|
```typescript
|
|
150
|
-
import { UpdateType, type PowerSyncBackendConnector } from '@powersync/web'
|
|
149
|
+
import { UpdateType, type PowerSyncBackendConnector } from '@powersync/web';
|
|
151
150
|
|
|
152
151
|
export class PowerSyncConnector implements PowerSyncBackendConnector {
|
|
153
152
|
async fetchCredentials() {
|
|
@@ -159,8 +158,8 @@ export class PowerSyncConnector implements PowerSyncBackendConnector {
|
|
|
159
158
|
return {
|
|
160
159
|
endpoint: '[Your PowerSync instance URL or self-hosted endpoint]',
|
|
161
160
|
// Use a development token (see Authentication Setup https://docs.powersync.com/installation/authentication-setup/development-tokens) to get up and running quickly
|
|
162
|
-
token: 'An authentication token'
|
|
163
|
-
}
|
|
161
|
+
token: 'An authentication token'
|
|
162
|
+
};
|
|
164
163
|
}
|
|
165
164
|
|
|
166
165
|
async uploadData(db: any) {
|
|
@@ -169,7 +168,7 @@ export class PowerSyncConnector implements PowerSyncBackendConnector {
|
|
|
169
168
|
|
|
170
169
|
// See example implementation here: https://docs.powersync.com/client-sdk-references/javascript-web#3-integrate-with-your-backend
|
|
171
170
|
// see demos here: https://github.com/powersync-ja/powersync-js/tree/main/demos
|
|
172
|
-
return
|
|
171
|
+
return;
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
174
|
```
|
|
@@ -181,30 +180,30 @@ export class PowerSyncConnector implements PowerSyncBackendConnector {
|
|
|
181
180
|
Finally, putting everything together, create a [plugin](https://nuxt.com/docs/4.x/guide/directory-structure/app/plugins) called `powersync.client.ts` to setup PowerSync.
|
|
182
181
|
|
|
183
182
|
```typescript
|
|
184
|
-
import { createPowerSyncPlugin } from '@powersync/nuxt'
|
|
185
|
-
import { NuxtPowerSyncDatabase } from '@powersync/nuxt'
|
|
186
|
-
import { AppSchema } from '~/powersync/AppSchema'
|
|
187
|
-
import { PowerSyncConnector } from '~/powersync/PowerSyncConnector'
|
|
183
|
+
import { createPowerSyncPlugin } from '@powersync/nuxt';
|
|
184
|
+
import { NuxtPowerSyncDatabase } from '@powersync/nuxt';
|
|
185
|
+
import { AppSchema } from '~/powersync/AppSchema';
|
|
186
|
+
import { PowerSyncConnector } from '~/powersync/PowerSyncConnector';
|
|
188
187
|
|
|
189
188
|
export default defineNuxtPlugin({
|
|
190
189
|
async setup(nuxtApp) {
|
|
191
190
|
const db = new NuxtPowerSyncDatabase({
|
|
192
191
|
database: {
|
|
193
|
-
dbFilename: 'a-db-name.sqlite'
|
|
192
|
+
dbFilename: 'a-db-name.sqlite'
|
|
194
193
|
},
|
|
195
|
-
schema: AppSchema
|
|
196
|
-
})
|
|
194
|
+
schema: AppSchema
|
|
195
|
+
});
|
|
197
196
|
|
|
198
|
-
const connector = new PowerSyncConnector()
|
|
197
|
+
const connector = new PowerSyncConnector();
|
|
199
198
|
|
|
200
|
-
await db.init()
|
|
201
|
-
await db.connect(connector)
|
|
199
|
+
await db.init();
|
|
200
|
+
await db.connect(connector);
|
|
202
201
|
|
|
203
|
-
const plugin = createPowerSyncPlugin({ database: db })
|
|
202
|
+
const plugin = createPowerSyncPlugin({ database: db });
|
|
204
203
|
|
|
205
|
-
nuxtApp.vueApp.use(plugin)
|
|
206
|
-
}
|
|
207
|
-
})
|
|
204
|
+
nuxtApp.vueApp.use(plugin);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
208
207
|
```
|
|
209
208
|
|
|
210
209
|
### Kysely ORM (Optional)
|
|
@@ -216,6 +215,7 @@ Install the driver:
|
|
|
216
215
|
```
|
|
217
216
|
pnpm add @powersync/kysely-driver
|
|
218
217
|
```
|
|
218
|
+
|
|
219
219
|
In your existing `nuxt.config.ts`, set:
|
|
220
220
|
|
|
221
221
|
```typescript
|
|
@@ -226,28 +226,26 @@ export default defineNuxtConfig({
|
|
|
226
226
|
},
|
|
227
227
|
vite: {
|
|
228
228
|
optimizeDeps: {
|
|
229
|
-
exclude: ['@
|
|
230
|
-
include: ['@powersync/web > js-logger'],
|
|
229
|
+
exclude: ['@powersync/web']
|
|
231
230
|
},
|
|
232
231
|
worker: {
|
|
233
|
-
format: 'es'
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
})
|
|
232
|
+
format: 'es'
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
});
|
|
238
236
|
```
|
|
239
237
|
|
|
240
238
|
When enabled, the module exposes `usePowerSyncKysely`. Use your schema’s `Database` type to get proper typings:
|
|
241
239
|
|
|
242
240
|
```typescript
|
|
243
|
-
import { usePowerSyncKysely } from '@powersync/nuxt'
|
|
244
|
-
import { type Database } from '../powersync/AppSchema'
|
|
241
|
+
import { usePowerSyncKysely } from '@powersync/nuxt';
|
|
242
|
+
import { type Database } from '../powersync/AppSchema';
|
|
245
243
|
|
|
246
244
|
// In your component or composable
|
|
247
|
-
const db = usePowerSyncKysely<Database>()
|
|
245
|
+
const db = usePowerSyncKysely<Database>();
|
|
248
246
|
|
|
249
247
|
// Use the db object to interact with the database
|
|
250
|
-
const users = await db.selectFrom('users').selectAll().execute()
|
|
248
|
+
const users = await db.selectFrom('users').selectAll().execute();
|
|
251
249
|
```
|
|
252
250
|
|
|
253
251
|
### Enabling Diagnostics
|
|
@@ -260,28 +258,26 @@ To enable the PowerSync Inspector with diagnostics capabilities:
|
|
|
260
258
|
export default defineNuxtConfig({
|
|
261
259
|
modules: ['@powersync/nuxt'],
|
|
262
260
|
powersync: {
|
|
263
|
-
useDiagnostics: true
|
|
261
|
+
useDiagnostics: true // <- Add this
|
|
264
262
|
},
|
|
265
263
|
vite: {
|
|
266
264
|
optimizeDeps: {
|
|
267
|
-
exclude: ['@
|
|
268
|
-
include: ['@powersync/web > js-logger'],
|
|
265
|
+
exclude: ['@powersync/web']
|
|
269
266
|
},
|
|
270
267
|
worker: {
|
|
271
|
-
format: 'es'
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
})
|
|
268
|
+
format: 'es'
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
});
|
|
276
272
|
```
|
|
277
273
|
|
|
278
274
|
When `useDiagnostics: true` is set, `NuxtPowerSyncDatabase` automatically:
|
|
275
|
+
|
|
279
276
|
- Extend your schema with diagnostics schema
|
|
280
277
|
- Sets up diagnostics recording
|
|
281
278
|
- Stores the connector internally (accessible via diagnostics)
|
|
282
279
|
- Configures logging for diagnostics
|
|
283
280
|
|
|
284
|
-
|
|
285
281
|
2. **Accessing PowerSync Inspector**:
|
|
286
282
|
|
|
287
283
|
Once diagnostics are enabled, you can access the [PowerSync Inspector](#powersync-inspector):
|
|
@@ -289,8 +285,6 @@ Once diagnostics are enabled, you can access the [PowerSync Inspector](#powersyn
|
|
|
289
285
|
- **Via Nuxt Devtools**: Open Devtools and look for the PowerSync tab
|
|
290
286
|
- **Direct URL**: `http://localhost:3000/__powersync-inspector`
|
|
291
287
|
|
|
292
|
-
|
|
293
|
-
|
|
294
288
|
## PowerSync Inspector
|
|
295
289
|
|
|
296
290
|
PowerSync Inspector is a tool that helps inspect and diagnose the state of your PowerSync client directly from your app in real-time.
|
|
@@ -310,6 +304,7 @@ Once setup, the inspector can be accessed on the `http://localhost:3000/__powers
|
|
|
310
304
|
#### Sync Status
|
|
311
305
|
|
|
312
306
|
The `Sync Status` tab provides a real-time view of the sync status of your PowerSync client, including:
|
|
307
|
+
|
|
313
308
|
- Connection status
|
|
314
309
|
- Sync progress
|
|
315
310
|
- Upload queue statistics
|
|
@@ -341,8 +336,8 @@ To fix this, you can add the following to your `nuxt.config.ts`:
|
|
|
341
336
|
export default defineNuxtConfig({
|
|
342
337
|
unocss: {
|
|
343
338
|
autoImport: false
|
|
344
|
-
}
|
|
345
|
-
})
|
|
339
|
+
}
|
|
340
|
+
});
|
|
346
341
|
```
|
|
347
342
|
|
|
348
343
|
## Development
|
|
@@ -368,23 +363,21 @@ Don't forget to add a watcher for the module for hot reloading.
|
|
|
368
363
|
Example (in your nuxt app):
|
|
369
364
|
|
|
370
365
|
```typescript
|
|
371
|
-
import { defineNuxtConfig } from 'nuxt/config'
|
|
366
|
+
import { defineNuxtConfig } from 'nuxt/config';
|
|
372
367
|
|
|
373
368
|
export default defineNuxtConfig({
|
|
374
369
|
modules: ['../../my-location/@powersync/nuxt/src/*'],
|
|
375
|
-
watch: ['../../my-location/@powersync/nuxt/src/*']
|
|
376
|
-
})
|
|
370
|
+
watch: ['../../my-location/@powersync/nuxt/src/*']
|
|
371
|
+
});
|
|
377
372
|
```
|
|
378
373
|
|
|
379
374
|
<!-- Badges -->
|
|
375
|
+
|
|
380
376
|
[npm-version-src]: https://img.shields.io/npm/v/@powersync/nuxt/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
381
377
|
[npm-version-href]: https://npmjs.com/package/@powersync/nuxt
|
|
382
|
-
|
|
383
378
|
[npm-downloads-src]: https://img.shields.io/npm/dm/@powersync/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
384
379
|
[npm-downloads-href]: https://npmjs.com/package/@powersync/nuxt
|
|
385
|
-
|
|
386
380
|
[license-src]: https://img.shields.io/npm/l/@powersync/nuxt.svg?style=flat&colorA=18181B&colorB=28CF8D
|
|
387
381
|
[license-href]: https://npmjs.com/package/@powersync/nuxt
|
|
388
|
-
|
|
389
382
|
[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
|
|
390
383
|
[nuxt-href]: https://nuxt.com
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -100,7 +100,12 @@ const module$1 = defineNuxtModule({
|
|
|
100
100
|
"usePowerSyncWatchedQuery",
|
|
101
101
|
"useQuery",
|
|
102
102
|
"useStatus",
|
|
103
|
-
"useWatchedQuerySubscription"
|
|
103
|
+
"useWatchedQuerySubscription",
|
|
104
|
+
"useSyncStream",
|
|
105
|
+
{
|
|
106
|
+
name: "AdditionalOptions",
|
|
107
|
+
type: true
|
|
108
|
+
}
|
|
104
109
|
],
|
|
105
110
|
"@powersync/vue"
|
|
106
111
|
);
|
|
@@ -95,68 +95,22 @@
|
|
|
95
95
|
|
|
96
96
|
<span border="b" border-color="gray-100" />
|
|
97
97
|
|
|
98
|
-
<
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<div
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<div flex="~ col gap-2">
|
|
110
|
-
<span text="sm gray-500">Rows Synced</span>
|
|
111
|
-
<span text="sm"> {{ totals?.row_count }} </span>
|
|
112
|
-
</div>
|
|
113
|
-
|
|
114
|
-
<div flex="~ col gap-2">
|
|
115
|
-
<span text="sm gray-500">Data size</span>
|
|
116
|
-
<span text="sm">
|
|
117
|
-
{{ totals?.data_size }}
|
|
118
|
-
</span>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
<div flex="~ col gap-2">
|
|
122
|
-
<span text="sm gray-500">Metadata size</span>
|
|
123
|
-
<span text="sm">
|
|
124
|
-
{{ totals?.metadata_size }}
|
|
125
|
-
</span>
|
|
126
|
-
</div>
|
|
127
|
-
|
|
128
|
-
<div flex="~ col gap-2">
|
|
129
|
-
<span text="sm gray-500">Download size</span>
|
|
130
|
-
<span text="sm">
|
|
131
|
-
{{ totals?.download_size }}
|
|
132
|
-
</span>
|
|
133
|
-
</div>
|
|
134
|
-
</div>
|
|
135
|
-
</NSectionBlock>
|
|
136
|
-
|
|
137
|
-
<span border="b" border-color="gray-100" />
|
|
138
|
-
|
|
139
|
-
<NSectionBlock icon="carbon:data-share" text="Operations">
|
|
140
|
-
<NTip v-if="!isDiagnosticSchemaSetup" n="red6 dark:red5" icon="carbon:warning-alt">
|
|
141
|
-
Make sure to extend your schema with the diagnostics schema using the `diagnosticsSchema` from the
|
|
142
|
-
`usePowerSyncInspector` composable.
|
|
143
|
-
</NTip>
|
|
144
|
-
<div v-else grid="~ cols-2 gap-4" mb="4">
|
|
145
|
-
<div flex="~ col gap-2">
|
|
146
|
-
<span text="sm gray-500">Total operations</span>
|
|
147
|
-
<span text="sm">
|
|
148
|
-
{{ totals?.total_operations }}
|
|
149
|
-
</span>
|
|
98
|
+
<template v-for="(section, index) in metricSections" :key="section.text">
|
|
99
|
+
<NSectionBlock :icon="section.icon" :text="section.text">
|
|
100
|
+
<NTip v-if="!isDiagnosticSchemaSetup" n="red6 dark:red5" icon="carbon:warning-alt">
|
|
101
|
+
Make sure to extend your schema with the diagnostics schema using the `diagnosticsSchema` from the
|
|
102
|
+
`usePowerSyncInspector` composable.
|
|
103
|
+
</NTip>
|
|
104
|
+
<div v-else :grid="`~ cols-${section.cols} gap-4`" mb="4">
|
|
105
|
+
<div v-for="metric in section.metrics" :key="metric.label" flex="~ col gap-2">
|
|
106
|
+
<span text="sm gray-500">{{ metric.label }}</span>
|
|
107
|
+
<span text="sm">{{ metric.value }}</span>
|
|
108
|
+
</div>
|
|
150
109
|
</div>
|
|
110
|
+
</NSectionBlock>
|
|
151
111
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
<span text="sm">
|
|
155
|
-
{{ totals?.downloaded_operations }}
|
|
156
|
-
</span>
|
|
157
|
-
</div>
|
|
158
|
-
</div>
|
|
159
|
-
</NSectionBlock>
|
|
112
|
+
<span v-if="index < metricSections.length - 1" border="b" border-color="gray-100" />
|
|
113
|
+
</template>
|
|
160
114
|
|
|
161
115
|
<span border="b" border-color="gray-100" />
|
|
162
116
|
</div>
|
|
@@ -165,7 +119,7 @@
|
|
|
165
119
|
|
|
166
120
|
<script setup>
|
|
167
121
|
import { usePowerSyncInspectorDiagnostics } from "#imports";
|
|
168
|
-
import { onMounted } from "vue";
|
|
122
|
+
import { computed, onMounted } from "vue";
|
|
169
123
|
const {
|
|
170
124
|
db,
|
|
171
125
|
isDiagnosticSchemaSetup,
|
|
@@ -178,7 +132,30 @@ const {
|
|
|
178
132
|
uploadQueueSize,
|
|
179
133
|
totals
|
|
180
134
|
} = usePowerSyncInspectorDiagnostics();
|
|
135
|
+
const metricSections = computed(() => [
|
|
136
|
+
{
|
|
137
|
+
icon: "carbon:data-volume",
|
|
138
|
+
text: "Data Size",
|
|
139
|
+
cols: 5,
|
|
140
|
+
metrics: [
|
|
141
|
+
{ label: "Buckets Synced", value: totals.value?.buckets },
|
|
142
|
+
{ label: "Rows Synced", value: totals.value?.row_count },
|
|
143
|
+
{ label: "Data size", value: totals.value?.data_size },
|
|
144
|
+
{ label: "Metadata size", value: totals.value?.metadata_size },
|
|
145
|
+
{ label: "Download size", value: totals.value?.download_size }
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
icon: "carbon:data-share",
|
|
150
|
+
text: "Operations",
|
|
151
|
+
cols: 2,
|
|
152
|
+
metrics: [
|
|
153
|
+
{ label: "Total operations", value: totals.value?.total_operations },
|
|
154
|
+
{ label: "Downloaded operations", value: totals.value?.downloaded_operations }
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
]);
|
|
181
158
|
onMounted(async () => {
|
|
182
|
-
await db
|
|
159
|
+
await db?.value?.waitForFirstSync();
|
|
183
160
|
});
|
|
184
161
|
</script>
|
|
@@ -4,10 +4,7 @@ export class RecordingStorageAdapter extends SqliteBucketStorage {
|
|
|
4
4
|
schemaManager;
|
|
5
5
|
tables = {};
|
|
6
6
|
constructor(db, schemaManager) {
|
|
7
|
-
super(
|
|
8
|
-
db.value.database,
|
|
9
|
-
AbstractPowerSyncDatabase.transactionMutex
|
|
10
|
-
);
|
|
7
|
+
super(db.value.database, AbstractPowerSyncDatabase.transactionMutex);
|
|
11
8
|
this.rdb = db.value.database;
|
|
12
9
|
this.schemaManager = schemaManager.value;
|
|
13
10
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { addImports } from "@nuxt/kit";
|
|
2
2
|
export const addImportsFrom = (names, from) => {
|
|
3
|
-
addImports(
|
|
3
|
+
addImports(
|
|
4
|
+
names.map((name) => ({
|
|
5
|
+
name: typeof name === "string" ? name : name.name,
|
|
6
|
+
type: typeof name === "string" ? false : name.type,
|
|
7
|
+
from
|
|
8
|
+
}))
|
|
9
|
+
);
|
|
4
10
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powersync/nuxt",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260305092446",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@journeyapps/wa-sqlite": "^1.2.6",
|
|
55
|
-
"@powersync/kysely-driver": "
|
|
56
|
-
"@powersync/vue": "0.
|
|
57
|
-
"@powersync/web": "0.0.0-dev-
|
|
55
|
+
"@powersync/kysely-driver": "1.3.3",
|
|
56
|
+
"@powersync/vue": "0.5.0",
|
|
57
|
+
"@powersync/web": "0.0.0-dev-20260305092446"
|
|
58
58
|
},
|
|
59
59
|
"peerDependenciesMeta": {
|
|
60
60
|
"@powersync/kysely-driver": {
|
|
@@ -73,9 +73,9 @@
|
|
|
73
73
|
"vitest": "^3.2.4",
|
|
74
74
|
"vue": "^3.5.20",
|
|
75
75
|
"vue-tsc": "^3.0.8",
|
|
76
|
-
"@powersync/kysely-driver": "
|
|
77
|
-
"@powersync/vue": "0.
|
|
78
|
-
"@powersync/web": "0.0.0-dev-
|
|
76
|
+
"@powersync/kysely-driver": "1.3.3",
|
|
77
|
+
"@powersync/vue": "0.5.0",
|
|
78
|
+
"@powersync/web": "0.0.0-dev-20260305092446"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
81
|
"prebuild": "nuxt-module-build prepare",
|