@powersync/nuxt 0.0.0-dev-20260128023420 → 0.0.0-dev-20260225163712
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} +46 -30
- package/dist/module.d.mts +2 -2
- package/dist/module.json +2 -2
- package/dist/module.mjs +22 -24
- package/dist/runtime/components/BucketsInspectorTab.d.vue.ts +1 -1
- package/dist/runtime/components/BucketsInspectorTab.vue +47 -149
- package/dist/runtime/components/BucketsInspectorTab.vue.d.ts +1 -1
- package/dist/runtime/components/ConfigInspectorTab.d.vue.ts +1 -1
- package/dist/runtime/components/ConfigInspectorTab.vue +11 -48
- package/dist/runtime/components/ConfigInspectorTab.vue.d.ts +1 -1
- package/dist/runtime/components/DataInspectorTab.d.vue.ts +1 -1
- package/dist/runtime/components/DataInspectorTab.vue +35 -149
- package/dist/runtime/components/DataInspectorTab.vue.d.ts +1 -1
- package/dist/runtime/components/LoadingSpinner.d.vue.ts +1 -1
- package/dist/runtime/components/LoadingSpinner.vue.d.ts +1 -1
- package/dist/runtime/components/LogsTab.d.vue.ts +1 -1
- package/dist/runtime/components/LogsTab.vue +42 -94
- package/dist/runtime/components/LogsTab.vue.d.ts +1 -1
- package/dist/runtime/components/PowerSyncInstanceTab.d.vue.ts +1 -1
- package/dist/runtime/components/PowerSyncInstanceTab.vue +1 -3
- package/dist/runtime/components/PowerSyncInstanceTab.vue.d.ts +1 -1
- package/dist/runtime/components/SyncStatusTab.d.vue.ts +1 -1
- package/dist/runtime/components/SyncStatusTab.vue +57 -168
- package/dist/runtime/components/SyncStatusTab.vue.d.ts +1 -1
- package/dist/runtime/composables/useDiagnosticsLogger.d.ts +1 -1
- package/dist/runtime/composables/useDiagnosticsLogger.js +16 -24
- package/dist/runtime/composables/usePowerSyncInspectorDiagnostics.js +13 -53
- package/dist/runtime/index.d.ts +3 -3
- package/dist/runtime/layouts/powersync-inspector-layout.d.vue.ts +1 -1
- package/dist/runtime/layouts/powersync-inspector-layout.vue +9 -36
- package/dist/runtime/layouts/powersync-inspector-layout.vue.d.ts +1 -1
- package/dist/runtime/pages/__powersync-inspector.d.vue.ts +1 -1
- package/dist/runtime/pages/__powersync-inspector.vue +8 -42
- package/dist/runtime/pages/__powersync-inspector.vue.d.ts +1 -1
- package/dist/runtime/utils/DynamicSchemaManager.js +3 -10
- package/dist/runtime/utils/RecordingStorageAdapter.js +4 -22
- package/dist/runtime/utils/TokenConnector.js +2 -7
- package/package.json +12 -10
|
@@ -59,17 +59,7 @@ function formatBytes(bytes, decimals = 2) {
|
|
|
59
59
|
if (!+bytes) return "0 Bytes";
|
|
60
60
|
const k = 1024;
|
|
61
61
|
const dm = decimals < 0 ? 0 : decimals;
|
|
62
|
-
const sizes = [
|
|
63
|
-
"Bytes",
|
|
64
|
-
"KiB",
|
|
65
|
-
"MiB",
|
|
66
|
-
"GiB",
|
|
67
|
-
"TiB",
|
|
68
|
-
"PiB",
|
|
69
|
-
"EiB",
|
|
70
|
-
"ZiB",
|
|
71
|
-
"YiB"
|
|
72
|
-
];
|
|
62
|
+
const sizes = ["Bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
|
73
63
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
74
64
|
return `${Number.parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
75
65
|
}
|
|
@@ -83,41 +73,23 @@ export function usePowerSyncInspectorDiagnostics() {
|
|
|
83
73
|
const hasSynced = ref(syncStatus.value?.hasSynced || false);
|
|
84
74
|
const isConnected = ref(syncStatus.value?.connected || false);
|
|
85
75
|
const isSyncing = ref(false);
|
|
86
|
-
const isDownloading = ref(
|
|
87
|
-
syncStatus.value?.dataFlowStatus.downloading || false
|
|
88
|
-
);
|
|
76
|
+
const isDownloading = ref(syncStatus.value?.dataFlowStatus.downloading || false);
|
|
89
77
|
const isUploading = ref(syncStatus.value?.dataFlowStatus.uploading || false);
|
|
90
78
|
const lastSyncedAt = ref(syncStatus.value?.lastSyncedAt || null);
|
|
91
79
|
const uploadError = ref(syncStatus.value?.dataFlowStatus.uploadError || null);
|
|
92
|
-
const downloadError = ref(
|
|
93
|
-
|
|
94
|
-
);
|
|
95
|
-
const downloadProgressDetails = ref(
|
|
96
|
-
syncStatus.value?.dataFlowStatus.downloadProgress || null
|
|
97
|
-
);
|
|
80
|
+
const downloadError = ref(syncStatus.value?.dataFlowStatus.downloadError || null);
|
|
81
|
+
const downloadProgressDetails = ref(syncStatus.value?.dataFlowStatus.downloadProgress || null);
|
|
98
82
|
const bucketRows = ref(null);
|
|
99
83
|
const tableRows = ref(null);
|
|
100
84
|
const uploadQueueStats = ref(null);
|
|
101
85
|
const totals = computed(() => ({
|
|
102
86
|
buckets: bucketRows.value?.length ?? 0,
|
|
103
87
|
row_count: bucketRows.value?.reduce((total, row) => total + row.row_count, 0) ?? 0,
|
|
104
|
-
downloaded_operations: bucketRows.value?.reduce(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
),
|
|
108
|
-
|
|
109
|
-
(total, row) => total + row.total_operations,
|
|
110
|
-
0
|
|
111
|
-
) ?? 0,
|
|
112
|
-
data_size: formatBytes(
|
|
113
|
-
bucketRows.value?.reduce((total, row) => total + row.data_size, 0) ?? 0
|
|
114
|
-
),
|
|
115
|
-
metadata_size: formatBytes(
|
|
116
|
-
bucketRows.value?.reduce((total, row) => total + row.metadata_size, 0) ?? 0
|
|
117
|
-
),
|
|
118
|
-
download_size: formatBytes(
|
|
119
|
-
bucketRows.value?.reduce((total, row) => total + row.download_size, 0) ?? 0
|
|
120
|
-
)
|
|
88
|
+
downloaded_operations: bucketRows.value?.reduce((total, row) => total + row.downloaded_operations, 0),
|
|
89
|
+
total_operations: bucketRows.value?.reduce((total, row) => total + row.total_operations, 0) ?? 0,
|
|
90
|
+
data_size: formatBytes(bucketRows.value?.reduce((total, row) => total + row.data_size, 0) ?? 0),
|
|
91
|
+
metadata_size: formatBytes(bucketRows.value?.reduce((total, row) => total + row.metadata_size, 0) ?? 0),
|
|
92
|
+
download_size: formatBytes(bucketRows.value?.reduce((total, row) => total + row.download_size, 0) ?? 0)
|
|
121
93
|
}));
|
|
122
94
|
const userID = computedAsync(async () => {
|
|
123
95
|
try {
|
|
@@ -136,9 +108,7 @@ export function usePowerSyncInspectorDiagnostics() {
|
|
|
136
108
|
}
|
|
137
109
|
return "100";
|
|
138
110
|
});
|
|
139
|
-
const uploadQueueSize = computed(
|
|
140
|
-
() => formatBytes(uploadQueueStats.value?.size ?? 0)
|
|
141
|
-
);
|
|
111
|
+
const uploadQueueSize = computed(() => formatBytes(uploadQueueStats.value?.size ?? 0));
|
|
142
112
|
const uploadQueueCount = computed(() => uploadQueueStats.value?.count ?? 0);
|
|
143
113
|
const clearData = async () => {
|
|
144
114
|
await db.value?.syncStreamImplementation?.disconnect();
|
|
@@ -148,10 +118,7 @@ export function usePowerSyncInspectorDiagnostics() {
|
|
|
148
118
|
const schemaManager = getCurrentSchemaManager();
|
|
149
119
|
await schemaManager.clear();
|
|
150
120
|
await schemaManager.refreshSchema(db.value.database);
|
|
151
|
-
await db.value.connect(
|
|
152
|
-
connector2,
|
|
153
|
-
connectionOptions2
|
|
154
|
-
);
|
|
121
|
+
await db.value.connect(connector2, connectionOptions2);
|
|
155
122
|
};
|
|
156
123
|
async function refreshState() {
|
|
157
124
|
if (db.value) {
|
|
@@ -186,9 +153,7 @@ export function usePowerSyncInspectorDiagnostics() {
|
|
|
186
153
|
downloadError.value = newStatus.dataFlowStatus.downloadError || null;
|
|
187
154
|
downloadProgressDetails.value = newStatus.dataFlowStatus.downloadProgress || null;
|
|
188
155
|
if (newStatus?.hasSynced === void 0 || newStatus?.priorityStatusEntries?.length && newStatus.priorityStatusEntries.length > 0) {
|
|
189
|
-
hasSynced.value = newStatus?.priorityStatusEntries.every(
|
|
190
|
-
(entry) => entry.hasSynced
|
|
191
|
-
) ?? false;
|
|
156
|
+
hasSynced.value = newStatus?.priorityStatusEntries.every((entry) => entry.hasSynced) ?? false;
|
|
192
157
|
}
|
|
193
158
|
if (newStatus?.dataFlowStatus.downloading || newStatus?.dataFlowStatus.uploading) {
|
|
194
159
|
isSyncing.value = true;
|
|
@@ -205,12 +170,7 @@ export function usePowerSyncInspectorDiagnostics() {
|
|
|
205
170
|
},
|
|
206
171
|
{
|
|
207
172
|
rawTableNames: true,
|
|
208
|
-
tables: [
|
|
209
|
-
"ps_oplog",
|
|
210
|
-
"ps_buckets",
|
|
211
|
-
"ps_data_local__local_bucket_data",
|
|
212
|
-
"ps_crud"
|
|
213
|
-
],
|
|
173
|
+
tables: ["ps_oplog", "ps_buckets", "ps_data_local__local_bucket_data", "ps_crud"],
|
|
214
174
|
throttleMs: 500
|
|
215
175
|
}
|
|
216
176
|
);
|
package/dist/runtime/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { PowerSyncNuxtModuleOptions } from '../module'
|
|
1
|
+
import type { PowerSyncNuxtModuleOptions } from '../module';
|
|
2
2
|
|
|
3
3
|
declare module 'nuxt/schema' {
|
|
4
4
|
interface PublicRuntimeConfig {
|
|
5
|
-
powerSyncModuleOptions: PowerSyncNuxtModuleOptions
|
|
5
|
+
powerSyncModuleOptions: PowerSyncNuxtModuleOptions;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
// It is always important to ensure you import/export something when augmenting a type
|
|
9
|
-
export {}
|
|
9
|
+
export {};
|
|
@@ -2,7 +2,7 @@ declare var __VLS_20: {};
|
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
3
|
default?: (props: typeof __VLS_20) => any;
|
|
4
4
|
};
|
|
5
|
-
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
6
6
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -1,42 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div>
|
|
2
|
+
<div>
|
|
3
|
+
<LoadingSpinner v-if="isCssLoading" />
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
<div
|
|
7
|
-
v-show="!isCssLoading"
|
|
8
|
-
flex="~ relative col"
|
|
9
|
-
p="6"
|
|
10
|
-
h="screen"
|
|
11
|
-
n-bg="base"
|
|
12
|
-
class="ps-inspector-ui"
|
|
13
|
-
>
|
|
5
|
+
<div v-show="!isCssLoading" flex="~ relative col" p="6" h="screen" n-bg="base" class="ps-inspector-ui">
|
|
14
6
|
<!-- Header with title and dark toggle -->
|
|
15
|
-
<div
|
|
16
|
-
flex="~ items-center
|
|
17
|
-
|
|
18
|
-
>
|
|
19
|
-
<h1
|
|
20
|
-
flex="~ gap-2 items-center"
|
|
21
|
-
text="3xl"
|
|
22
|
-
font="bold"
|
|
23
|
-
>
|
|
24
|
-
<img
|
|
25
|
-
:src="iconUrl"
|
|
26
|
-
alt="Powersync"
|
|
27
|
-
w="10"
|
|
28
|
-
h="10"
|
|
29
|
-
>
|
|
7
|
+
<div flex="~ items-center justify-between" mb="3">
|
|
8
|
+
<h1 flex="~ gap-2 items-center" text="3xl" font="bold">
|
|
9
|
+
<img :src="iconUrl" alt="Powersync" w="10" h="10" />
|
|
30
10
|
PowerSync Inspector
|
|
31
11
|
</h1>
|
|
32
12
|
|
|
33
13
|
<!-- Dark Mode Toggle -->
|
|
34
14
|
<NDarkToggle v-slot="{ isDark, toggle }">
|
|
35
|
-
<NButton
|
|
36
|
-
n="sm"
|
|
37
|
-
:icon="isDark.value ? 'carbon:moon' : 'carbon:sun'"
|
|
38
|
-
@click="toggle"
|
|
39
|
-
>
|
|
15
|
+
<NButton n="sm" :icon="isDark.value ? 'carbon:moon' : 'carbon:sun'" @click="toggle">
|
|
40
16
|
{{ isDark.value ? "Dark" : "Light" }}
|
|
41
17
|
</NButton>
|
|
42
18
|
</NDarkToggle>
|
|
@@ -44,15 +20,12 @@
|
|
|
44
20
|
|
|
45
21
|
<slot v-if="useDiagnostics" />
|
|
46
22
|
<div v-else>
|
|
47
|
-
<NTip
|
|
48
|
-
n="red6 dark:red5"
|
|
49
|
-
icon="carbon:warning-alt"
|
|
50
|
-
>
|
|
23
|
+
<NTip n="red6 dark:red5" icon="carbon:warning-alt">
|
|
51
24
|
Enable diagnostics in your Nuxt config to use the inspector.
|
|
52
25
|
</NTip>
|
|
53
26
|
</div>
|
|
27
|
+
</div>
|
|
54
28
|
</div>
|
|
55
|
-
</div>
|
|
56
29
|
</template>
|
|
57
30
|
|
|
58
31
|
<script setup>
|
|
@@ -2,7 +2,7 @@ declare var __VLS_20: {};
|
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
3
|
default?: (props: typeof __VLS_20) => any;
|
|
4
4
|
};
|
|
5
|
-
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
6
6
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
7
|
declare const _default: typeof __VLS_export;
|
|
8
8
|
export default _default;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
2
|
declare const _default: typeof __VLS_export;
|
|
3
3
|
export default _default;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
3
|
-
flex="~ justify-between"
|
|
4
|
-
border="b"
|
|
5
|
-
border-color="gray-100"
|
|
6
|
-
py="3"
|
|
7
|
-
mb="3"
|
|
8
|
-
>
|
|
2
|
+
<div flex="~ justify-between" border="b" border-color="gray-100" py="3" mb="3">
|
|
9
3
|
<div flex="~ gap-2">
|
|
10
4
|
<NTip
|
|
11
5
|
:n="`${isConnected ? 'green' : isSyncing ? 'blue' : 'red'} xs`"
|
|
12
6
|
:icon="`${isConnected ? 'carbon:plug-filled' : isSyncing ? 'carbon:plug' : 'carbon:connection-signal-off'}`"
|
|
13
7
|
>
|
|
14
8
|
Powersync is
|
|
15
|
-
{{
|
|
16
|
-
isConnected ? "connected" : isSyncing ? "connecting..." : "disconnected"
|
|
17
|
-
}}
|
|
9
|
+
{{ isConnected ? "connected" : isSyncing ? "connecting..." : "disconnected" }}
|
|
18
10
|
</NTip>
|
|
19
11
|
<NTip
|
|
20
12
|
:n="`${isSyncing ? 'blue' : hasSynced ? 'green' : 'yellow'} xs`"
|
|
@@ -34,50 +26,26 @@
|
|
|
34
26
|
>
|
|
35
27
|
{{ isDownloading ? "Downloading" : "Download Idle" }}
|
|
36
28
|
</NTip>
|
|
37
|
-
<NBadge
|
|
38
|
-
flex="~ gap-2 items-center"
|
|
39
|
-
n="gray xs"
|
|
40
|
-
icon="carbon:server-time"
|
|
41
|
-
>
|
|
29
|
+
<NBadge flex="~ gap-2 items-center" n="gray xs" icon="carbon:server-time">
|
|
42
30
|
Last Synced:
|
|
43
31
|
{{ lastSyncedFormatted }}
|
|
44
32
|
</NBadge>
|
|
45
|
-
<NBadge
|
|
46
|
-
flex="~ gap-2 items-center"
|
|
47
|
-
n="gray xs"
|
|
48
|
-
icon="carbon:user-admin"
|
|
49
|
-
>
|
|
50
|
-
Logged in as: {{ userID }}
|
|
51
|
-
</NBadge>
|
|
33
|
+
<NBadge flex="~ gap-2 items-center" n="gray xs" icon="carbon:user-admin"> Logged in as: {{ userID }} </NBadge>
|
|
52
34
|
</div>
|
|
53
35
|
|
|
54
36
|
<div flex="~ gap-2">
|
|
55
|
-
<NButton
|
|
56
|
-
n="red sm"
|
|
57
|
-
icon="carbon:clean"
|
|
58
|
-
@click="resync"
|
|
59
|
-
>
|
|
60
|
-
Prune & Re-sync
|
|
61
|
-
</NButton>
|
|
37
|
+
<NButton n="red sm" icon="carbon:clean" @click="resync"> Prune & Re-sync </NButton>
|
|
62
38
|
<NDarkToggle />
|
|
63
39
|
</div>
|
|
64
40
|
</div>
|
|
65
41
|
|
|
66
42
|
<div flex="~ gap-4">
|
|
67
|
-
<NTip
|
|
68
|
-
v-if="downloadError || uploadError"
|
|
69
|
-
n="red sm"
|
|
70
|
-
mb="3"
|
|
71
|
-
icon="carbon:warning-hex-filled"
|
|
72
|
-
>
|
|
43
|
+
<NTip v-if="downloadError || uploadError" n="red sm" mb="3" icon="carbon:warning-hex-filled">
|
|
73
44
|
{{ downloadError?.message ?? uploadError?.message }}
|
|
74
45
|
</NTip>
|
|
75
46
|
</div>
|
|
76
47
|
|
|
77
|
-
<div
|
|
78
|
-
flex="~ gap-2"
|
|
79
|
-
mb="3"
|
|
80
|
-
>
|
|
48
|
+
<div flex="~ gap-2" mb="3">
|
|
81
49
|
<NSelectTabs
|
|
82
50
|
v-model="selectedTab"
|
|
83
51
|
n="amber6 dark:amber5"
|
|
@@ -139,9 +107,7 @@ const tabs = [
|
|
|
139
107
|
{ label: "Client Logs", value: "logs" }
|
|
140
108
|
// { label: 'PowerSync Instance', value: 'powersync-instance' },
|
|
141
109
|
];
|
|
142
|
-
const lastSyncedFormatted = computed(
|
|
143
|
-
() => lastSyncedAt.value ? useTimeAgo(new Date(lastSyncedAt.value)) : "NA"
|
|
144
|
-
);
|
|
110
|
+
const lastSyncedFormatted = computed(() => lastSyncedAt.value ? useTimeAgo(new Date(lastSyncedAt.value)) : "NA");
|
|
145
111
|
const resync = async () => {
|
|
146
112
|
await clearData();
|
|
147
113
|
await db.value?.waitForFirstSync();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}>;
|
|
2
2
|
declare const _default: typeof __VLS_export;
|
|
3
3
|
export default _default;
|
|
@@ -49,19 +49,14 @@ export class DynamicSchemaManager {
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
if (schemaDirty) {
|
|
52
|
-
localStorage.setItem(
|
|
53
|
-
"powersync_dynamic_schema",
|
|
54
|
-
JSON.stringify(this.tables)
|
|
55
|
-
);
|
|
52
|
+
localStorage.setItem("powersync_dynamic_schema", JSON.stringify(this.tables));
|
|
56
53
|
this.dirty = true;
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
56
|
async refreshSchema(db) {
|
|
60
57
|
if (this.dirty) {
|
|
61
58
|
const json = this.buildSchema().toJSON();
|
|
62
|
-
await db.execute("SELECT powersync_replace_schema(?)", [
|
|
63
|
-
JSON.stringify(json)
|
|
64
|
-
]);
|
|
59
|
+
await db.execute("SELECT powersync_replace_schema(?)", [JSON.stringify(json)]);
|
|
65
60
|
this.dirty = false;
|
|
66
61
|
}
|
|
67
62
|
}
|
|
@@ -83,9 +78,7 @@ export class DynamicSchemaManager {
|
|
|
83
78
|
return new Schema(tables);
|
|
84
79
|
}
|
|
85
80
|
schemaToString() {
|
|
86
|
-
const filtered = this.buildSchema().tables.filter(
|
|
87
|
-
(table) => !table.localOnly
|
|
88
|
-
);
|
|
81
|
+
const filtered = this.buildSchema().tables.filter((table) => !table.localOnly);
|
|
89
82
|
return new JsSchemaGenerator().generate(new Schema(filtered));
|
|
90
83
|
}
|
|
91
84
|
}
|
|
@@ -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
|
}
|
|
@@ -25,14 +22,7 @@ export class RecordingStorageAdapter extends SqliteBucketStorage {
|
|
|
25
22
|
IFNULL((SELECT downloading FROM local_bucket_data WHERE id = ?), TRUE),
|
|
26
23
|
IFNULL((SELECT downloaded_operations FROM local_bucket_data WHERE id = ?), TRUE)
|
|
27
24
|
)`,
|
|
28
|
-
[
|
|
29
|
-
bucket.bucket,
|
|
30
|
-
bucket.count,
|
|
31
|
-
bucket.bucket,
|
|
32
|
-
bucket.bucket,
|
|
33
|
-
bucket.bucket,
|
|
34
|
-
bucket.bucket
|
|
35
|
-
]
|
|
25
|
+
[bucket.bucket, bucket.count, bucket.bucket, bucket.bucket, bucket.bucket, bucket.bucket]
|
|
36
26
|
);
|
|
37
27
|
}
|
|
38
28
|
});
|
|
@@ -43,9 +33,7 @@ export class RecordingStorageAdapter extends SqliteBucketStorage {
|
|
|
43
33
|
this.schemaManager.refreshSchema(this.rdb);
|
|
44
34
|
}, 60);
|
|
45
35
|
if (r.checkpointValid) {
|
|
46
|
-
await this.rdb.execute(
|
|
47
|
-
"UPDATE local_bucket_data SET downloading = FALSE"
|
|
48
|
-
);
|
|
36
|
+
await this.rdb.execute("UPDATE local_bucket_data SET downloading = FALSE");
|
|
49
37
|
}
|
|
50
38
|
return r;
|
|
51
39
|
}
|
|
@@ -61,13 +49,7 @@ export class RecordingStorageAdapter extends SqliteBucketStorage {
|
|
|
61
49
|
downloading = ?,
|
|
62
50
|
downloaded_operations = IFNULL(downloaded_operations, 0) + ?
|
|
63
51
|
WHERE id = ?`,
|
|
64
|
-
[
|
|
65
|
-
size,
|
|
66
|
-
bucket.next_after,
|
|
67
|
-
bucket.has_more,
|
|
68
|
-
bucket.data.length,
|
|
69
|
-
bucket.bucket
|
|
70
|
-
]
|
|
52
|
+
[size, bucket.next_after, bucket.has_more, bucket.data.length, bucket.bucket]
|
|
71
53
|
);
|
|
72
54
|
}
|
|
73
55
|
});
|
|
@@ -19,10 +19,7 @@ export class TokenConnector {
|
|
|
19
19
|
validateSecureContext(credentials.endpoint);
|
|
20
20
|
checkJWT(credentials.token);
|
|
21
21
|
try {
|
|
22
|
-
localStorage.setItem(
|
|
23
|
-
"powersync_credentials",
|
|
24
|
-
JSON.stringify(credentials)
|
|
25
|
-
);
|
|
22
|
+
localStorage.setItem("powersync_credentials", JSON.stringify(credentials));
|
|
26
23
|
await this.connectFn();
|
|
27
24
|
} catch (e) {
|
|
28
25
|
this.clearCredentials();
|
|
@@ -50,9 +47,7 @@ Run either the PowerSync endpoint on http://localhost, or the diagnostics app on
|
|
|
50
47
|
function checkJWT(token) {
|
|
51
48
|
const parts = token.split(".");
|
|
52
49
|
if (parts.length !== 3) {
|
|
53
|
-
throw new Error(
|
|
54
|
-
`Token must be a JWT: Expected 3 parts, got ${parts.length}`
|
|
55
|
-
);
|
|
50
|
+
throw new Error(`Token must be a JWT: Expected 3 parts, got ${parts.length}`);
|
|
56
51
|
}
|
|
57
52
|
const base64UrlRegex = /^[\w-]+$/;
|
|
58
53
|
const isBase64 = parts.every((part) => base64UrlRegex.test(part));
|
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-20260225163712",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@nuxt/devtools-ui-kit": "^2.6.2",
|
|
41
41
|
"@nuxt/kit": "^4.0.3",
|
|
42
42
|
"@tanstack/vue-table": "^8.21.3",
|
|
43
|
-
"@vueuse/
|
|
44
|
-
"
|
|
43
|
+
"@vueuse/core": "^14.0.0",
|
|
44
|
+
"@vueuse/nuxt": "^14.1.0",
|
|
45
45
|
"defu": "^6.1.4",
|
|
46
46
|
"fuse.js": "^7.1.0",
|
|
47
47
|
"mitt": "^3.0.1",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@journeyapps/wa-sqlite": "^1.2.6",
|
|
55
|
-
"@powersync/
|
|
56
|
-
"@powersync/
|
|
57
|
-
"@powersync/web": "0.0.0-dev-
|
|
55
|
+
"@powersync/vue": "0.4.2",
|
|
56
|
+
"@powersync/kysely-driver": "1.3.3",
|
|
57
|
+
"@powersync/web": "0.0.0-dev-20260225163712"
|
|
58
58
|
},
|
|
59
59
|
"peerDependenciesMeta": {
|
|
60
60
|
"@powersync/kysely-driver": {
|
|
@@ -66,14 +66,16 @@
|
|
|
66
66
|
"@nuxt/module-builder": "^1.0.2",
|
|
67
67
|
"@nuxt/schema": "^4.1.2",
|
|
68
68
|
"@nuxt/test-utils": "^3.19.2",
|
|
69
|
+
"async-mutex": "^0.5.0",
|
|
70
|
+
"bson": "^6.10.4",
|
|
71
|
+
"comlink": "^4.4.2",
|
|
69
72
|
"nuxt": "^4.1.2",
|
|
70
|
-
"vite-plugin-wasm": "^3.5.0",
|
|
71
73
|
"vitest": "^3.2.4",
|
|
72
74
|
"vue": "^3.5.20",
|
|
73
75
|
"vue-tsc": "^3.0.8",
|
|
74
|
-
"@powersync/kysely-driver": "
|
|
75
|
-
"@powersync/vue": "0.4.
|
|
76
|
-
"@powersync/web": "0.0.0-dev-
|
|
76
|
+
"@powersync/kysely-driver": "1.3.3",
|
|
77
|
+
"@powersync/vue": "0.4.2",
|
|
78
|
+
"@powersync/web": "0.0.0-dev-20260225163712"
|
|
77
79
|
},
|
|
78
80
|
"scripts": {
|
|
79
81
|
"prebuild": "nuxt-module-build prepare",
|