@powersync/diagnostics 0.0.0-dev-20261020125654
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/LICENSE +201 -0
- package/README.md +138 -0
- package/lib/src/agent-server.d.ts +21 -0
- package/lib/src/agent-server.js +51 -0
- package/lib/src/agent-server.js.map +1 -0
- package/lib/src/agent.d.ts +11 -0
- package/lib/src/agent.js +30 -0
- package/lib/src/agent.js.map +1 -0
- package/lib/src/client.d.ts +7 -0
- package/lib/src/client.js +30 -0
- package/lib/src/client.js.map +1 -0
- package/lib/src/constants.d.ts +13 -0
- package/lib/src/constants.js +14 -0
- package/lib/src/constants.js.map +1 -0
- package/lib/src/definition.d.ts +16 -0
- package/lib/src/definition.js +421 -0
- package/lib/src/definition.js.map +1 -0
- package/lib/src/index.d.ts +4 -0
- package/lib/src/index.js +6 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/js-agent.d.ts +63 -0
- package/lib/src/js-agent.js +298 -0
- package/lib/src/js-agent.js.map +1 -0
- package/lib/src/node.d.ts +59 -0
- package/lib/src/node.js +40 -0
- package/lib/src/node.js.map +1 -0
- package/lib/src/page.d.ts +5 -0
- package/lib/src/page.js +50 -0
- package/lib/src/page.js.map +1 -0
- package/lib/src/rpc-types.d.ts +42 -0
- package/lib/src/rpc-types.js +2 -0
- package/lib/src/rpc-types.js.map +1 -0
- package/lib/src/sync-state.d.ts +4 -0
- package/lib/src/sync-state.js +53 -0
- package/lib/src/sync-state.js.map +1 -0
- package/lib/src/vite-static.d.ts +18 -0
- package/lib/src/vite-static.js +67 -0
- package/lib/src/vite-static.js.map +1 -0
- package/lib/src/vite.d.ts +27 -0
- package/lib/src/vite.js +43 -0
- package/lib/src/vite.js.map +1 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +98 -0
- package/src/agent-server.ts +73 -0
- package/src/agent.ts +58 -0
- package/src/client.ts +37 -0
- package/src/constants.ts +15 -0
- package/src/definition.ts +504 -0
- package/src/index.ts +7 -0
- package/src/js-agent.ts +378 -0
- package/src/node.ts +89 -0
- package/src/page.ts +61 -0
- package/src/rpc-types.ts +55 -0
- package/src/sync-state.ts +61 -0
- package/src/vite-static.ts +83 -0
- package/src/vite.ts +55 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# PowerSync DevTools
|
|
2
|
+
|
|
3
|
+
`@powersync/diagnostics` shows the live state of your app's [PowerSync](https://powersync.com) client while you develop: sync status, buckets, sync streams, the local database, the schema, and logs. Coding agents get the same data as MCP tools.
|
|
4
|
+
|
|
5
|
+
One implementation runs in several hosts:
|
|
6
|
+
|
|
7
|
+
| You have | Use | You get |
|
|
8
|
+
| ----------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
|
|
9
|
+
| A Vite app (React, Vue, Svelte, …) with Vite DevTools | `@powersync/diagnostics/vite` | A **PowerSync** dock in Vite DevTools, and MCP tools at `/__devtools/__mcp` |
|
|
10
|
+
| A Nuxt app | [`@powersync/nuxt`](https://github.com/powersync-ja/powersync-js/tree/main/packages/nuxt) with `useDiagnostics: true` | A **PowerSync** tab or dock in Nuxt DevTools |
|
|
11
|
+
| A node app (`@powersync/node`) | `@powersync/diagnostics/node` | A DevTools window served by your process, and MCP tools at `/__mcp` |
|
|
12
|
+
|
|
13
|
+
The process that runs your app also serves the DevTools window. You start nothing else.
|
|
14
|
+
|
|
15
|
+
The hosts above run in development only, and nothing from them goes into a production build.
|
|
16
|
+
|
|
17
|
+
Full guide: [PowerSync DevTools](https://docs.powersync.com/tools/devtools-overview).
|
|
18
|
+
|
|
19
|
+
## Vite
|
|
20
|
+
|
|
21
|
+
Install:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm add -D @powersync/diagnostics @vitejs/devtools
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Enable Vite DevTools and add the plugin:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
// vite.config.ts
|
|
31
|
+
import { defineConfig } from 'vite';
|
|
32
|
+
import powersyncDevtools from '@powersync/diagnostics/vite';
|
|
33
|
+
|
|
34
|
+
export default defineConfig({
|
|
35
|
+
// Vite >= 8.3. On Vite 7, spread `...(await DevTools())` from `@vitejs/devtools` into `plugins` instead.
|
|
36
|
+
devtools: true,
|
|
37
|
+
plugins: [powersyncDevtools()]
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
To get per-bucket totals in the Buckets tab, enable the core diagnostics stream when you connect:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
await db.connect(connector, { diagnostics: true });
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Start the dev server and open your app. The first time, Vite DevTools asks you to confirm the browser with a code from your terminal. Then the dock at the bottom of the page shows a **PowerSync** entry.
|
|
48
|
+
|
|
49
|
+
Vite DevTools also runs during `vite build`. To keep it to the dev server, set `devtools: { apply: 'serve' }`.
|
|
50
|
+
|
|
51
|
+
Option: `powersyncDevtools({ title: 'PowerSync' })` sets the dock title.
|
|
52
|
+
|
|
53
|
+
## Node
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
import { PowerSyncDatabase } from '@powersync/node';
|
|
57
|
+
|
|
58
|
+
const db = new PowerSyncDatabase({ schema, database: { dbFilename: 'app.db' } });
|
|
59
|
+
await db.connect(connector, { diagnostics: true });
|
|
60
|
+
|
|
61
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
62
|
+
const { enablePowerSyncDiagnostics } = await import('@powersync/diagnostics/node');
|
|
63
|
+
const devtools = await enablePowerSyncDiagnostics(db);
|
|
64
|
+
console.log(`PowerSync DevTools: ${devtools.signInUrl}`);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Import the package inside the check. Then a production install without dev dependencies (`npm ci --omit=dev`) still starts.
|
|
69
|
+
|
|
70
|
+
Your process serves the DevTools window on a random free port. Open the printed link. It carries a one-time code, so the browser is trusted at once. The code is valid for five minutes and for one browser; after that, open `devtools.url` and the terminal prints a new link. Set `auth: false` to trust every local browser. MCP tools are at `<url>/__mcp`.
|
|
71
|
+
|
|
72
|
+
Options: `port` (default: a random free port), `host`, `auth` (default `true`), `open` (open the browser, default `false`), `sdk` and `id` (labels in the UI), `mcp` (see [MCP](#mcp)).
|
|
73
|
+
|
|
74
|
+
## Your own host
|
|
75
|
+
|
|
76
|
+
A page that opens the database itself and shows DevTools in its own iframe, such as the PowerSync Dashboard, builds the integration and hands it to the frame:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
import { attachIframe, createIntegration } from '@powersync/diagnostics/agent';
|
|
80
|
+
|
|
81
|
+
const integration = createIntegration(db, '@powersync/web');
|
|
82
|
+
const detach = attachIframe(integration, iframe);
|
|
83
|
+
|
|
84
|
+
// When the panel goes away:
|
|
85
|
+
detach();
|
|
86
|
+
await integration.close();
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`uiDistDir()` from `@powersync/diagnostics` returns the folder that holds the DevTools page. Serve it at a route of your own and point the iframe at its `index.html`. In development, the `@powersync/diagnostics/vite-static` plugin serves it at `/__powersync/`. For production, copy the folder into your build output.
|
|
90
|
+
|
|
91
|
+
The port can run any SQL and read the sync token, so `attachIframe` only hands it to a page from the origin of the iframe's `src`. The `targetOrigin` option allows a different origin. The `onHandOff` option is called each time `attachIframe` hands the page a port, for example to hide a loading state.
|
|
92
|
+
|
|
93
|
+
**Clear & re-sync** in DevTools deletes the local rows, which is slow on a large database. A host with a throwaway client, like the PowerSync Dashboard, can pass `attachIframe` a wrapper whose `action` handles `clearData` itself and whose other methods call the integration's. Write each method out, because `{ ...integration }` copies none of them and TypeScript does not catch it. Do not delete a real app's database files, because the client would get a new client id. `disconnectAndClear()` keeps the existing one.
|
|
94
|
+
|
|
95
|
+
## MCP
|
|
96
|
+
|
|
97
|
+
Every host exposes the same tools. Names are `powersync_<function>`. Arguments are positional, `arg0` first:
|
|
98
|
+
|
|
99
|
+
| Tool | Arguments | Returns |
|
|
100
|
+
| ------------------------ | --------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
101
|
+
| `powersync_sources` | | the attached databases (`id`, `sdk`) |
|
|
102
|
+
| `powersync_query` | `arg0: { sql, params? }`, `arg1: sourceId \| null` | `{ columns, rows }`, each row an array in column order |
|
|
103
|
+
| `powersync_schema` | `arg0: sourceId \| null` | the schema as the SQLite core receives it |
|
|
104
|
+
| `powersync_info` | `arg0: sourceId \| null` | endpoint, token, client id, method, core version |
|
|
105
|
+
| `powersync_status` | `arg0: sourceId \| null` | the latest reported sync status |
|
|
106
|
+
| `powersync_upload-queue` | `arg0: sourceId \| null` | the latest reported pending uploads: count and size |
|
|
107
|
+
| `powersync_action` | `arg0: { action, args? }`, `arg1: sourceId \| null` | runs reconnect, disconnect, clearData, requestCheckpoint, subscribeStream, unsubscribeStream |
|
|
108
|
+
|
|
109
|
+
Pass `null` for `sourceId` to use the first attached database.
|
|
110
|
+
|
|
111
|
+
The endpoint accepts requests with a loopback `Origin` header only. Browsers always send it; some MCP clients do not. To accept requests without it, keep the server on localhost and set:
|
|
112
|
+
|
|
113
|
+
| Host | Where |
|
|
114
|
+
| -------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
115
|
+
| Vite (and Nuxt DevTools 4) | `devtools: { mcp: { allowedOrigins: false } }` in `vite.config.ts` (Vite DevTools' own setting) |
|
|
116
|
+
| Node app | `enablePowerSyncDiagnostics(db, { mcp: { allowedOrigins: false } })` |
|
|
117
|
+
|
|
118
|
+
The same `mcp` setting takes `false` to turn the endpoint off, or `{ authorization: '<bearer token>' }` to require a token. Example call:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
curl -X POST http://localhost:<port>/__mcp \
|
|
122
|
+
-H 'Origin: http://localhost:<port>' -H 'Content-Type: application/json' \
|
|
123
|
+
-H 'Accept: application/json, text/event-stream' \
|
|
124
|
+
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"powersync_query","arguments":{"arg0":{"sql":"select count(*) as n from ps_oplog"},"arg1":null}}}'
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Requirements
|
|
128
|
+
|
|
129
|
+
- `@powersync/web >= 2.5` for browser apps and the `agent` entry, and `@powersync/node >= 1.2` for node apps. Earlier versions drop the connector once the database connects, so DevTools cannot reconnect the client.
|
|
130
|
+
- Vite DevTools for the dock: Vite `>= 8.3` with `devtools: true`, or the `@vitejs/devtools` plugin on Vite 7.
|
|
131
|
+
- Node `>= 20.16` for the node entry.
|
|
132
|
+
|
|
133
|
+
## Related packages
|
|
134
|
+
|
|
135
|
+
These are internal packages used by this package. Your app code does not depend on them.
|
|
136
|
+
|
|
137
|
+
- [`@powersync/diagnostics-core`](https://github.com/powersync-ja/powersync-js/tree/main/tools/diagnostics-core): the protocol (`SdkIntegration`).
|
|
138
|
+
- [`@powersync/diagnostics-ui`](https://github.com/powersync-ja/powersync-js/tree/main/tools/diagnostics-ui): the UI.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serving agents to a devframe node side over an RPC client: a dock script in a web page, or a
|
|
3
|
+
* node process.
|
|
4
|
+
*/
|
|
5
|
+
import type { DevframeRpcClient } from 'devframe/client';
|
|
6
|
+
import type { SdkIntegration } from '@powersync/diagnostics-core';
|
|
7
|
+
import './rpc-types.js';
|
|
8
|
+
/** Serves integrations to the node side over one RPC client. */
|
|
9
|
+
export interface AgentServer {
|
|
10
|
+
/** Announces `integration` as `sourceId` and starts forwarding its events. */
|
|
11
|
+
serve(sourceId: string, integration: SdkIntegration, sdk: string): Promise<void>;
|
|
12
|
+
/** Withdraws a served integration. */
|
|
13
|
+
release(sourceId: string): Promise<void>;
|
|
14
|
+
/** Releases everything served through this client. */
|
|
15
|
+
close(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Registers the page-side functions the node side calls (`powersync:page-*`) on `rpc`, and returns
|
|
19
|
+
* a server that announces integrations to it. Call once per RPC client.
|
|
20
|
+
*/
|
|
21
|
+
export declare function createAgentServer(rpc: DevframeRpcClient): AgentServer;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { HEARTBEAT_MS } from './constants.js';
|
|
2
|
+
import './rpc-types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Registers the page-side functions the node side calls (`powersync:page-*`) on `rpc`, and returns
|
|
5
|
+
* a server that announces integrations to it. Call once per RPC client.
|
|
6
|
+
*/
|
|
7
|
+
export function createAgentServer(rpc) {
|
|
8
|
+
const served = new Map();
|
|
9
|
+
// The node side only knows this client is alive while it hears from it.
|
|
10
|
+
const heartbeat = setInterval(() => {
|
|
11
|
+
for (const sourceId of served.keys())
|
|
12
|
+
void rpc.callEvent('powersync:page-heartbeat', sourceId);
|
|
13
|
+
}, HEARTBEAT_MS);
|
|
14
|
+
heartbeat.unref?.();
|
|
15
|
+
const integrationFor = (sourceId) => {
|
|
16
|
+
const entry = served.get(sourceId);
|
|
17
|
+
if (!entry)
|
|
18
|
+
throw new Error(`No database "${sourceId}" is served here.`);
|
|
19
|
+
return entry.integration;
|
|
20
|
+
};
|
|
21
|
+
const register = (name, handler) => rpc.client.register({ name, type: 'action', jsonSerializable: true, handler }, true);
|
|
22
|
+
register('powersync:page-query', (id, params) => integrationFor(id).runQuery(params));
|
|
23
|
+
register('powersync:page-schema', (id) => integrationFor(id).getSchema());
|
|
24
|
+
register('powersync:page-info', (id) => integrationFor(id).getInfo());
|
|
25
|
+
register('powersync:page-action', (id, request) => integrationFor(id).action(request));
|
|
26
|
+
return {
|
|
27
|
+
async serve(sourceId, integration, sdk) {
|
|
28
|
+
await rpc.call('powersync:page-register', sourceId, sdk);
|
|
29
|
+
const stop = await integration.observeEvents((event) => {
|
|
30
|
+
void rpc.callEvent('powersync:page-event', sourceId, event);
|
|
31
|
+
});
|
|
32
|
+
served.set(sourceId, { integration, stop });
|
|
33
|
+
},
|
|
34
|
+
async release(sourceId) {
|
|
35
|
+
const entry = served.get(sourceId);
|
|
36
|
+
if (!entry)
|
|
37
|
+
return;
|
|
38
|
+
served.delete(sourceId);
|
|
39
|
+
entry.stop();
|
|
40
|
+
await entry.integration.close();
|
|
41
|
+
await rpc.call('powersync:page-unregister', sourceId).catch(() => { });
|
|
42
|
+
},
|
|
43
|
+
async close() {
|
|
44
|
+
clearInterval(heartbeat);
|
|
45
|
+
for (const sourceId of [...served.keys()]) {
|
|
46
|
+
await this.release(sourceId);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=agent-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-server.js","sourceRoot":"","sources":["../../src/agent-server.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent for a JavaScript host: the `SdkIntegration` built over a live database. This is the
|
|
3
|
+
* package's `./agent` entry, for a host that opens the database and embeds the DevTools page itself;
|
|
4
|
+
* the dock and node entries build their agents here too.
|
|
5
|
+
*/
|
|
6
|
+
import type { CommonPowerSyncDatabase } from '@powersync/common';
|
|
7
|
+
import type { SdkIntegration } from '@powersync/diagnostics-core';
|
|
8
|
+
export { attachIframe } from '@powersync/diagnostics-core';
|
|
9
|
+
export type { ActionRequest, AttachIframeOptions, DiagnosticsEvent, SdkIntegration, SyncState } from '@powersync/diagnostics-core';
|
|
10
|
+
/** Builds the JavaScript integration over a live database. The agent reads the connection from the database itself. */
|
|
11
|
+
export declare function createIntegration(database: CommonPowerSyncDatabase, sdk: string): SdkIntegration;
|
package/lib/src/agent.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { JsAgent } from './js-agent.js';
|
|
2
|
+
// The iframe hand-off and the protocol types an embedding host needs, so the host never imports the protocol package.
|
|
3
|
+
export { attachIframe } from '@powersync/diagnostics-core';
|
|
4
|
+
/** The sync client broadcasts core diagnostics events on this channel (see `emitDiagnostics`). */
|
|
5
|
+
const CORE_EVENTS_CHANNEL = 'powersync-diagnostics-events';
|
|
6
|
+
/** Consumes the core diagnostics events the sync client broadcasts (from a worker or in-process). */
|
|
7
|
+
class BroadcastCoreEvents {
|
|
8
|
+
channel = new BroadcastChannel(CORE_EVENTS_CHANNEL);
|
|
9
|
+
onEvent(handler) {
|
|
10
|
+
const listener = (event) => handler(event.data);
|
|
11
|
+
this.channel.addEventListener('message', listener);
|
|
12
|
+
return () => this.channel.removeEventListener('message', listener);
|
|
13
|
+
}
|
|
14
|
+
dispose() {
|
|
15
|
+
this.channel.close();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** Builds the JavaScript integration over a live database. The agent reads the connection from the database itself. */
|
|
19
|
+
export function createIntegration(database, sdk) {
|
|
20
|
+
const db = database;
|
|
21
|
+
return new JsAgent(db, {
|
|
22
|
+
sdk,
|
|
23
|
+
coreEvents: typeof BroadcastChannel === 'function' ? new BroadcastCoreEvents() : undefined,
|
|
24
|
+
connection: {
|
|
25
|
+
getConnector: () => db.connector ?? null,
|
|
26
|
+
getConnectionOptions: () => db.connectionOptions ?? null
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/agent.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAwB,MAAM,eAAe,CAAC;AAE9D,sHAAsH;AACtH,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAS3D,kGAAkG;AAClG,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAW3D,qGAAqG;AACrG,MAAM,mBAAmB;IACf,OAAO,GAAG,IAAI,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IAE5D,OAAO,CAAC,OAA8C;QACpD,MAAM,QAAQ,GAAG,CAAC,KAAmB,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAA4B,CAAC,CAAC;QACtF,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACnD,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACrE,CAAC;IAED,OAAO;QACL,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF;AAED,uHAAuH;AACvH,MAAM,UAAU,iBAAiB,CAAC,QAAiC,EAAE,GAAW;IAC9E,MAAM,EAAE,GAAG,QAA+B,CAAC;IAC3C,OAAO,IAAI,OAAO,CAAC,EAAE,EAAE;QACrB,GAAG;QACH,UAAU,EAAE,OAAO,gBAAgB,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAC,CAAC,SAAS;QAC1F,UAAU,EAAE;YACV,YAAY,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,SAAS,IAAI,IAAI;YACxC,oBAAoB,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,iBAAiB,IAAI,IAAI;SACzD;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The dock client script for `@powersync/web` apps. The devframe hub imports this module into the
|
|
3
|
+
* app page with an already trusted RPC client. It watches the app's open databases and serves each
|
|
4
|
+
* to the node side, which the diagnostics UI and MCP tools call.
|
|
5
|
+
*/
|
|
6
|
+
import type { DockClientScriptContext } from '@devframes/hub/client';
|
|
7
|
+
export default function setup(context: DockClientScriptContext): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { observeRegisteredDatabases } from '@powersync/web/devtools';
|
|
2
|
+
import { createIntegration } from './agent.js';
|
|
3
|
+
import { createAgentServer } from './agent-server.js';
|
|
4
|
+
const SDK = '@powersync/web';
|
|
5
|
+
export default function setup(context) {
|
|
6
|
+
const server = createAgentServer(context.rpc);
|
|
7
|
+
let counter = 0;
|
|
8
|
+
let currentId = null;
|
|
9
|
+
// A closing tab cannot wait for the release to complete: withdraw first, the heartbeat is the backstop.
|
|
10
|
+
window.addEventListener('pagehide', () => {
|
|
11
|
+
if (currentId)
|
|
12
|
+
void context.rpc.call('powersync:page-unregister', currentId);
|
|
13
|
+
});
|
|
14
|
+
observeRegisteredDatabases((databases) => {
|
|
15
|
+
const database = databases[0] ?? null;
|
|
16
|
+
if (!database) {
|
|
17
|
+
// The database closed: withdraw it.
|
|
18
|
+
if (currentId) {
|
|
19
|
+
void server.release(currentId);
|
|
20
|
+
currentId = null;
|
|
21
|
+
}
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (currentId)
|
|
25
|
+
return;
|
|
26
|
+
currentId = `web-${++counter}`;
|
|
27
|
+
void server.serve(currentId, createIntegration(database, SDK), SDK);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,GAAG,GAAG,gBAAgB,CAAC;AAE7B,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,OAAgC;IAC5D,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC9C,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,SAAS,GAAkB,IAAI,CAAC;IAEpC,wGAAwG;IACxG,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,GAAG,EAAE;QACvC,IAAI,SAAS;YAAE,KAAK,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,2BAA2B,EAAE,SAAS,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;IAEH,0BAA0B,CAAC,CAAC,SAAS,EAAE,EAAE;QACvC,MAAM,QAAQ,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;QACtC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,oCAAoC;YACpC,IAAI,SAAS,EAAE,CAAC;gBACd,KAAK,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBAC/B,SAAS,GAAG,IAAI,CAAC;YACnB,CAAC;YACD,OAAO;QACT,CAAC;QACD,IAAI,SAAS;YAAE,OAAO;QACtB,SAAS,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;QAC/B,KAAK,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,iBAAiB,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The route the diagnostics UI is served from. It is the devframe mount base of the `powersync`
|
|
3
|
+
* definition (`/__<id>/`), and the same path `./vite-static` serves for hosts without a devframe hub,
|
|
4
|
+
* so an embedding host can point an iframe at it either way.
|
|
5
|
+
*/
|
|
6
|
+
export declare const UI_ROUTE = "/__powersync/";
|
|
7
|
+
/** The devframe definition id. RPC functions live in this scope: `powersync:<name>`. */
|
|
8
|
+
export declare const DEVFRAME_ID = "powersync";
|
|
9
|
+
/**
|
|
10
|
+
* How often a page or app that serves a database reports in to the node side. A closed tab cannot
|
|
11
|
+
* say it went, so a source silent for three beats counts as gone.
|
|
12
|
+
*/
|
|
13
|
+
export declare const HEARTBEAT_MS = 2000;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The route the diagnostics UI is served from. It is the devframe mount base of the `powersync`
|
|
3
|
+
* definition (`/__<id>/`), and the same path `./vite-static` serves for hosts without a devframe hub,
|
|
4
|
+
* so an embedding host can point an iframe at it either way.
|
|
5
|
+
*/
|
|
6
|
+
export const UI_ROUTE = '/__powersync/';
|
|
7
|
+
/** The devframe definition id. RPC functions live in this scope: `powersync:<name>`. */
|
|
8
|
+
export const DEVFRAME_ID = 'powersync';
|
|
9
|
+
/**
|
|
10
|
+
* How often a page or app that serves a database reports in to the node side. A closed tab cannot
|
|
11
|
+
* say it went, so a source silent for three beats counts as gone.
|
|
12
|
+
*/
|
|
13
|
+
export const HEARTBEAT_MS = 2000;
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC;AAExC,wFAAwF;AACxF,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC;AAEvC;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SdkIntegration, Unsubscribe } from '@powersync/diagnostics-core';
|
|
2
|
+
import type { SetupSdk } from './rpc-types.js';
|
|
3
|
+
export type { SetupSdk, SourceInfo } from './rpc-types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Serves an integration that lives in this process (a node app's database). Events are pulled from
|
|
6
|
+
* it directly. Returns a function that detaches it.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Names the SDKs this host can reach, so the UI's "no database" screens explain only those. Each entry
|
|
10
|
+
* point sets it: the Vite plugin, the node server, the Nuxt module.
|
|
11
|
+
*/
|
|
12
|
+
export declare function setSetupSdks(sdks: SetupSdk[] | null): void;
|
|
13
|
+
export declare function registerIntegration(id: string, integration: SdkIntegration, sdk?: string | null): Promise<Unsubscribe>;
|
|
14
|
+
/** The built diagnostics UI (`@powersync/diagnostics-ui/dist/standalone`), served as the dock page. */
|
|
15
|
+
export declare function uiDistDir(): string;
|
|
16
|
+
export declare const definition: import("devframe").DevframeDefinition;
|