@powersync/diagnostics 0.0.2 → 0.1.0

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 (54) hide show
  1. package/README.md +71 -4
  2. package/dist/devtools/assets/powersync-B1PBHXj2.js +184 -0
  3. package/dist/devtools/assets/powersync-CpTiA65L.css +1 -0
  4. package/dist/devtools/powersync.html +24 -0
  5. package/dist/rozenite.json +14 -0
  6. package/lib/src/agent-server.d.ts +21 -0
  7. package/lib/src/agent-server.js +51 -0
  8. package/lib/src/agent-server.js.map +1 -0
  9. package/lib/src/agent.d.ts +8 -19
  10. package/lib/src/agent.js +39 -59
  11. package/lib/src/agent.js.map +1 -1
  12. package/lib/src/client.js +5 -4
  13. package/lib/src/client.js.map +1 -1
  14. package/lib/src/definition.js +11 -17
  15. package/lib/src/definition.js.map +1 -1
  16. package/lib/src/js-agent.d.ts +6 -13
  17. package/lib/src/js-agent.js +18 -9
  18. package/lib/src/js-agent.js.map +1 -1
  19. package/lib/src/node.d.ts +1 -1
  20. package/lib/src/node.js +2 -2
  21. package/lib/src/node.js.map +1 -1
  22. package/lib/src/page.js +2 -3
  23. package/lib/src/page.js.map +1 -1
  24. package/lib/src/react-native/agent-tools.d.ts +3 -0
  25. package/lib/src/react-native/agent-tools.js +137 -0
  26. package/lib/src/react-native/agent-tools.js.map +1 -0
  27. package/lib/src/react-native/protocol.d.ts +22 -0
  28. package/lib/src/react-native/protocol.js +5 -0
  29. package/lib/src/react-native/protocol.js.map +1 -0
  30. package/lib/src/react-native/usePowerSyncDevTools.d.ts +7 -0
  31. package/lib/src/react-native/usePowerSyncDevTools.js +56 -0
  32. package/lib/src/react-native/usePowerSyncDevTools.js.map +1 -0
  33. package/lib/src/react-native.d.ts +7 -0
  34. package/lib/src/react-native.js +8 -0
  35. package/lib/src/react-native.js.map +1 -0
  36. package/lib/src/rpc-types.d.ts +1 -1
  37. package/lib/src/tools.d.ts +19 -0
  38. package/lib/src/tools.js +24 -0
  39. package/lib/src/tools.js.map +1 -0
  40. package/lib/tsconfig.tsbuildinfo +1 -1
  41. package/package.json +41 -13
  42. package/src/agent-server.ts +73 -0
  43. package/src/agent.ts +50 -82
  44. package/src/client.ts +5 -5
  45. package/src/definition.ts +11 -17
  46. package/src/js-agent.ts +28 -26
  47. package/src/node.ts +3 -3
  48. package/src/page.ts +2 -4
  49. package/src/react-native/agent-tools.ts +148 -0
  50. package/src/react-native/protocol.ts +33 -0
  51. package/src/react-native/usePowerSyncDevTools.ts +59 -0
  52. package/src/react-native.ts +14 -0
  53. package/src/rpc-types.ts +1 -1
  54. package/src/tools.ts +35 -0
@@ -0,0 +1 @@
1
+ @layer properties;@layer theme,base,components,utilities;@layer theme{:root,:host{--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-red-400: oklch(70.4% .191 22.216);--color-red-500: oklch(63.7% .237 25.331);--color-red-600: oklch(57.7% .245 27.325);--color-amber-400: oklch(82.8% .189 84.429);--color-amber-500: oklch(76.9% .188 70.08);--color-amber-600: oklch(66.6% .179 58.318);--color-blue-400: oklch(70.7% .165 254.624);--color-blue-500: oklch(62.3% .214 259.815);--color-blue-600: oklch(54.6% .245 262.881);--spacing: .25rem;--container-md: 28rem;--text-xs: .75rem;--text-xs--line-height: calc(1 / .75);--text-sm: .875rem;--text-sm--line-height: calc(1.25 / .875);--text-base: 1rem;--text-base--line-height: 1.5 ;--text-lg: 1.125rem;--text-lg--line-height: calc(1.75 / 1.125);--font-weight-normal: 400;--font-weight-medium: 500;--font-weight-semibold: 600;--tracking-tight: -.025em;--tracking-wide: .025em;--leading-snug: 1.375;--leading-relaxed: 1.625;--animate-spin: spin 1s linear infinite;--animate-pulse: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration: .15s;--default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);--default-font-family: var(--font-sans);--default-mono-font-family: var(--font-mono);--color-background: var(--background);--color-foreground: var(--foreground);--color-border: var(--border)}}@layer base{*,:after,:before,::backdrop,::file-selector-button{box-sizing:border-box;margin:0;padding:0;border:0 solid}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;tab-size:4;font-family:var(--default-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings, normal);font-variation-settings:var(--default-font-variation-settings, normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings, normal);font-variation-settings:var(--default-mono-font-variation-settings, normal);font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea,::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;border-radius:0;background-color:transparent;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px){::placeholder{color:currentcolor}@supports (color: color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit,::-webkit-datetime-edit-year-field,::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field,::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field,::-webkit-datetime-edit-millisecond-field,::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]),::file-selector-button{appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer utilities{.\@container{container-type:inline-size}.pointer-events-none{pointer-events:none}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.top-0{top:0}.top-1\.5{top:calc(var(--spacing) * 1.5)}.top-1\/2{top:50%}.top-full{top:100%}.right-0{right:0}.right-1\.5{right:calc(var(--spacing) * 1.5)}.left-0{left:0}.left-1\/2{left:50%}.left-2{left:calc(var(--spacing) * 2)}.z-10{z-index:10}.z-20{z-index:20}.z-50{z-index:50}.mx-0\.5{margin-inline:calc(var(--spacing) * .5)}.mx-auto{margin-inline:auto}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mr-1{margin-right:var(--spacing)}.ml-auto{margin-left:auto}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.size-3{width:calc(var(--spacing) * 3);height:calc(var(--spacing) * 3)}.size-3\.5{width:calc(var(--spacing) * 3.5);height:calc(var(--spacing) * 3.5)}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-10{width:calc(var(--spacing) * 10);height:calc(var(--spacing) * 10)}.size-full{width:100%;height:100%}.h-1{height:var(--spacing)}.h-1\.5{height:calc(var(--spacing) * 1.5)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-7{height:calc(var(--spacing) * 7)}.h-9{height:calc(var(--spacing) * 9)}.h-24{height:calc(var(--spacing) * 24)}.h-full{height:100%}.h-screen{height:100vh}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-64{max-height:calc(var(--spacing) * 64)}.max-h-\[55vh\]{max-height:55vh}.min-h-0{min-height:0px}.w-1\.5{width:calc(var(--spacing) * 1.5)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-14{width:calc(var(--spacing) * 14)}.w-16{width:calc(var(--spacing) * 16)}.w-20{width:calc(var(--spacing) * 20)}.w-24{width:calc(var(--spacing) * 24)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-52{width:calc(var(--spacing) * 52)}.w-full{width:100%}.w-px{width:1px}.w-screen{width:100vw}.max-w-0{max-width:0px}.max-w-40{max-width:calc(var(--spacing) * 40)}.max-w-44{max-width:calc(var(--spacing) * 44)}.max-w-64{max-width:calc(var(--spacing) * 64)}.max-w-\[11rem\]{max-width:11rem}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.min-w-0{min-width:0px}.min-w-32{min-width:calc(var(--spacing) * 32)}.min-w-40{min-width:calc(var(--spacing) * 40)}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-rotate-90{rotate:-90deg}.rotate-90{rotate:90deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-pointer{cursor:pointer}.resize{resize:both}.resize-none{resize:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse: 0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-3{column-gap:calc(var(--spacing) * 3)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-x-6{column-gap:calc(var(--spacing) * 6)}.gap-y-0\.5{row-gap:calc(var(--spacing) * .5)}.gap-y-1{row-gap:var(--spacing)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse: 0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:calc(infinity * 1px)}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-destructive\/40{border-color:var(--destructive)}@supports (color: color-mix(in lab,red,red)){.border-destructive\/40{border-color:color-mix(in oklab,var(--destructive) 40%,transparent)}}.border-transparent{border-color:transparent}.border-warning\/40{border-color:var(--warning)}@supports (color: color-mix(in lab,red,red)){.border-warning\/40{border-color:color-mix(in oklab,var(--warning) 40%,transparent)}}.bg-accent{background-color:var(--accent)}.bg-amber-500\/15{background-color:color-mix(in srgb,oklch(76.9% .188 70.08) 15%,transparent)}@supports (color: color-mix(in lab,red,red)){.bg-amber-500\/15{background-color:color-mix(in oklab,var(--color-amber-500) 15%,transparent)}}.bg-background{background-color:var(--background)}.bg-blue-500\/15{background-color:color-mix(in srgb,oklch(62.3% .214 259.815) 15%,transparent)}@supports (color: color-mix(in lab,red,red)){.bg-blue-500\/15{background-color:color-mix(in oklab,var(--color-blue-500) 15%,transparent)}}.bg-border{background-color:var(--border)}.bg-card{background-color:var(--card)}.bg-card\/40{background-color:var(--card)}@supports (color: color-mix(in lab,red,red)){.bg-card\/40{background-color:color-mix(in oklab,var(--card) 40%,transparent)}}.bg-destructive{background-color:var(--destructive)}.bg-destructive\/10{background-color:var(--destructive)}@supports (color: color-mix(in lab,red,red)){.bg-destructive\/10{background-color:color-mix(in oklab,var(--destructive) 10%,transparent)}}.bg-destructive\/15{background-color:var(--destructive)}@supports (color: color-mix(in lab,red,red)){.bg-destructive\/15{background-color:color-mix(in oklab,var(--destructive) 15%,transparent)}}.bg-muted{background-color:var(--muted)}.bg-muted\/40{background-color:var(--muted)}@supports (color: color-mix(in lab,red,red)){.bg-muted\/40{background-color:color-mix(in oklab,var(--muted) 40%,transparent)}}.bg-primary{background-color:var(--primary)}.bg-red-500\/15{background-color:color-mix(in srgb,oklch(63.7% .237 25.331) 15%,transparent)}@supports (color: color-mix(in lab,red,red)){.bg-red-500\/15{background-color:color-mix(in oklab,var(--color-red-500) 15%,transparent)}}.bg-success{background-color:var(--success)}.bg-success\/15{background-color:var(--success)}@supports (color: color-mix(in lab,red,red)){.bg-success\/15{background-color:color-mix(in oklab,var(--success) 15%,transparent)}}.bg-transparent{background-color:transparent}.bg-warning\/10{background-color:var(--warning)}@supports (color: color-mix(in lab,red,red)){.bg-warning\/10{background-color:color-mix(in oklab,var(--warning) 10%,transparent)}}.bg-warning\/20{background-color:var(--warning)}@supports (color: color-mix(in lab,red,red)){.bg-warning\/20{background-color:color-mix(in oklab,var(--warning) 20%,transparent)}}.fill-card{fill:var(--card)}.stroke-border{stroke:var(--border)}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-8{padding:calc(var(--spacing) * 8)}.p-42{padding:calc(var(--spacing) * 42)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-6{padding-block:calc(var(--spacing) * 6)}.pt-1{padding-top:var(--spacing)}.pt-2{padding-top:calc(var(--spacing) * 2)}.pr-7{padding-right:calc(var(--spacing) * 7)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pl-7{padding-left:calc(var(--spacing) * 7)}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading, var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading, var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading, var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading, var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-5{--tw-leading: calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-\[22px\]{--tw-leading: 22px;line-height:22px}.leading-relaxed{--tw-leading: var(--leading-relaxed);line-height:var(--leading-relaxed)}.leading-snug{--tw-leading: var(--leading-snug);line-height:var(--leading-snug)}.font-medium{--tw-font-weight: var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight: var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight: var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking: var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking: var(--tracking-wide);letter-spacing:var(--tracking-wide)}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre{white-space:pre}.text-\[color\:var\(--warning\)\]{color:var(--warning)}.text-accent-foreground{color:var(--accent-foreground)}.text-amber-600{color:var(--color-amber-600)}.text-blue-600{color:var(--color-blue-600)}.text-card-foreground{color:var(--card-foreground)}.text-destructive{color:var(--destructive)}.text-destructive-foreground{color:var(--destructive-foreground)}.text-destructive\/80{color:var(--destructive)}@supports (color: color-mix(in lab,red,red)){.text-destructive\/80{color:color-mix(in oklab,var(--destructive) 80%,transparent)}}.text-foreground{color:var(--foreground)}.text-muted-foreground{color:var(--muted-foreground)}.text-muted-foreground\/40{color:var(--muted-foreground)}@supports (color: color-mix(in lab,red,red)){.text-muted-foreground\/40{color:color-mix(in oklab,var(--muted-foreground) 40%,transparent)}}.text-muted-foreground\/50{color:var(--muted-foreground)}@supports (color: color-mix(in lab,red,red)){.text-muted-foreground\/50{color:color-mix(in oklab,var(--muted-foreground) 50%,transparent)}}.text-muted-foreground\/60{color:var(--muted-foreground)}@supports (color: color-mix(in lab,red,red)){.text-muted-foreground\/60{color:color-mix(in oklab,var(--muted-foreground) 60%,transparent)}}.text-muted-foreground\/70{color:var(--muted-foreground)}@supports (color: color-mix(in lab,red,red)){.text-muted-foreground\/70{color:color-mix(in oklab,var(--muted-foreground) 70%,transparent)}}.text-muted-foreground\/80{color:var(--muted-foreground)}@supports (color: color-mix(in lab,red,red)){.text-muted-foreground\/80{color:color-mix(in oklab,var(--muted-foreground) 80%,transparent)}}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-600{color:var(--color-red-600)}.text-success{color:var(--success)}.text-transparent{color:transparent}.text-warning{color:var(--warning)}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.underline-offset-2{text-underline-offset:2px}.caret-foreground{caret-color:var(--foreground)}.opacity-0{opacity:0%}.shadow-md{--tw-shadow: 0 4px 6px -1px var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 2px 4px -2px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, rgb(0 0 0 / .1)), 0 1px 2px -1px var(--tw-shadow-color, rgb(0 0 0 / .1));box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease, var(--default-transition-timing-function));transition-duration:var(--tw-duration, var(--default-transition-duration))}.outline-none{--tw-outline-style: none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *){opacity:100%}}.placeholder\:text-muted-foreground::placeholder{color:var(--muted-foreground)}@media(hover:hover){.hover\:bg-accent:hover{background-color:var(--accent)}.hover\:bg-destructive\/15:hover{background-color:var(--destructive)}@supports (color: color-mix(in lab,red,red)){.hover\:bg-destructive\/15:hover{background-color:color-mix(in oklab,var(--destructive) 15%,transparent)}}.hover\:bg-destructive\/90:hover{background-color:var(--destructive)}@supports (color: color-mix(in lab,red,red)){.hover\:bg-destructive\/90:hover{background-color:color-mix(in oklab,var(--destructive) 90%,transparent)}}.hover\:bg-muted\/30:hover{background-color:var(--muted)}@supports (color: color-mix(in lab,red,red)){.hover\:bg-muted\/30:hover{background-color:color-mix(in oklab,var(--muted) 30%,transparent)}}.hover\:bg-muted\/40:hover{background-color:var(--muted)}@supports (color: color-mix(in lab,red,red)){.hover\:bg-muted\/40:hover{background-color:color-mix(in oklab,var(--muted) 40%,transparent)}}.hover\:bg-primary\/40:hover{background-color:var(--primary)}@supports (color: color-mix(in lab,red,red)){.hover\:bg-primary\/40:hover{background-color:color-mix(in oklab,var(--primary) 40%,transparent)}}.hover\:bg-primary\/90:hover{background-color:var(--primary)}@supports (color: color-mix(in lab,red,red)){.hover\:bg-primary\/90:hover{background-color:color-mix(in oklab,var(--primary) 90%,transparent)}}.hover\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\:text-destructive:hover{color:var(--destructive)}.hover\:text-foreground:hover{color:var(--foreground)}.hover\:underline:hover{text-decoration-line:underline}}.focus-visible\:ring-1:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow: var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: var(--ring)}.focus-visible\:outline-none:focus-visible{--tw-outline-style: none;outline-style:none}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:opacity-40:disabled{opacity:40%}.disabled\:opacity-50:disabled{opacity:50%}.data-\[state\=active\]\:border-primary[data-state=active]{border-color:var(--primary)}.data-\[state\=active\]\:text-foreground[data-state=active]{color:var(--foreground)}@media(min-width:40rem){.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}@container (width < 36rem){.\@max-xl\:sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border-width:0}.\@max-xl\:justify-around{justify-content:space-around}.\@max-xl\:px-3{padding-inline:calc(var(--spacing) * 3)}.\@max-xl\:py-2{padding-block:calc(var(--spacing) * 2)}}@container (width < 28rem){.\@max-md\:order-last{order:9999}.\@max-md\:w-full{width:100%}.\@max-md\:basis-full{flex-basis:100%}}@container (width >= 20rem){.\@xs\:inline{display:inline}}@container (width >= 24rem){.\@sm\:inline{display:inline}.\@sm\:inline-block{display:inline-block}}@container (width >= 28rem){.\@md\:inline{display:inline}.\@md\:inline-flex{display:inline-flex}.\@md\:max-w-\[45\%\]{max-width:45%}}@container (width >= 32rem){.\@lg\:block{display:block}.\@lg\:hidden{display:none}}@container (width >= 36rem){.\@xl\:flex{display:flex}.\@xl\:hidden{display:none}.\@xl\:inline{display:inline}}.dark\:text-amber-400:is(.dark *){color:var(--color-amber-400)}.dark\:text-blue-400:is(.dark *){color:var(--color-blue-400)}.dark\:text-red-400:is(.dark *){color:var(--color-red-400)}.\[\&_pre\]\:\!bg-transparent pre{background-color:transparent!important}.\[\&\>pre\]\:\!m-0>pre{margin:0!important}.\[\&\>pre\]\:\!bg-transparent>pre{background-color:transparent!important}.\[\&\>pre\]\:p-2>pre{padding:calc(var(--spacing) * 2)}.\[\&\>pre\]\:leading-5>pre{--tw-leading: calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}}:root{color-scheme:light;--background: hsl(0 0% 100%);--foreground: hsl(240 10% 3.9%);--card: hsl(0 0% 100%);--card-foreground: hsl(240 10% 3.9%);--primary: hsl(240 5.9% 10%);--primary-foreground: hsl(0 0% 98%);--secondary: hsl(240 4.8% 95.9%);--secondary-foreground: hsl(240 5.9% 10%);--muted: hsl(240 4.8% 95.9%);--muted-foreground: hsl(240 3.8% 46.1%);--accent: hsl(240 4.8% 95.9%);--accent-foreground: hsl(240 5.9% 10%);--destructive: hsl(0 72% 51%);--destructive-foreground: hsl(0 0% 98%);--success: hsl(142 71% 45%);--warning: hsl(38 92% 50%);--border: hsl(240 5.9% 90%);--input: hsl(240 5.9% 90%);--ring: hsl(240 5.9% 10%);--radius: .5rem}.dark{color-scheme:dark;--background: hsl(240 10% 3.9%);--foreground: hsl(0 0% 98%);--card: hsl(240 10% 5.9%);--card-foreground: hsl(0 0% 98%);--primary: hsl(0 0% 98%);--primary-foreground: hsl(240 5.9% 10%);--secondary: hsl(240 3.7% 15.9%);--secondary-foreground: hsl(0 0% 98%);--muted: hsl(240 3.7% 15.9%);--muted-foreground: hsl(240 5% 64.9%);--accent: hsl(240 3.7% 15.9%);--accent-foreground: hsl(0 0% 98%);--destructive: hsl(0 62.8% 45%);--destructive-foreground: hsl(0 0% 98%);--success: hsl(142 71% 45%);--warning: hsl(38 92% 50%);--border: hsl(240 3.7% 15.9%);--input: hsl(240 3.7% 18%);--ring: hsl(240 4.9% 83.9%)}@layer base{*{border-color:var(--color-border)}body{background-color:var(--color-background);color:var(--color-foreground);font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,sans-serif}}@property --tw-translate-x{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-translate-y{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-translate-z{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-rotate-x{syntax: "*"; inherits: false;}@property --tw-rotate-y{syntax: "*"; inherits: false;}@property --tw-rotate-z{syntax: "*"; inherits: false;}@property --tw-skew-x{syntax: "*"; inherits: false;}@property --tw-skew-y{syntax: "*"; inherits: false;}@property --tw-space-y-reverse{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-divide-y-reverse{syntax: "*"; inherits: false; initial-value: 0;}@property --tw-border-style{syntax: "*"; inherits: false; initial-value: solid;}@property --tw-leading{syntax: "*"; inherits: false;}@property --tw-font-weight{syntax: "*"; inherits: false;}@property --tw-tracking{syntax: "*"; inherits: false;}@property --tw-ordinal{syntax: "*"; inherits: false;}@property --tw-slashed-zero{syntax: "*"; inherits: false;}@property --tw-numeric-figure{syntax: "*"; inherits: false;}@property --tw-numeric-spacing{syntax: "*"; inherits: false;}@property --tw-numeric-fraction{syntax: "*"; inherits: false;}@property --tw-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-shadow-color{syntax: "*"; inherits: false;}@property --tw-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-inset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-shadow-color{syntax: "*"; inherits: false;}@property --tw-inset-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-ring-color{syntax: "*"; inherits: false;}@property --tw-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-inset-ring-color{syntax: "*"; inherits: false;}@property --tw-inset-ring-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-ring-inset{syntax: "*"; inherits: false;}@property --tw-ring-offset-width{syntax: "<length>"; inherits: false; initial-value: 0px;}@property --tw-ring-offset-color{syntax: "*"; inherits: false; initial-value: #fff;}@property --tw-ring-offset-shadow{syntax: "*"; inherits: false; initial-value: 0 0 #0000;}@property --tw-outline-style{syntax: "*"; inherits: false; initial-value: solid;}@property --tw-blur{syntax: "*"; inherits: false;}@property --tw-brightness{syntax: "*"; inherits: false;}@property --tw-contrast{syntax: "*"; inherits: false;}@property --tw-grayscale{syntax: "*"; inherits: false;}@property --tw-hue-rotate{syntax: "*"; inherits: false;}@property --tw-invert{syntax: "*"; inherits: false;}@property --tw-opacity{syntax: "*"; inherits: false;}@property --tw-saturate{syntax: "*"; inherits: false;}@property --tw-sepia{syntax: "*"; inherits: false;}@property --tw-drop-shadow{syntax: "*"; inherits: false;}@property --tw-drop-shadow-color{syntax: "*"; inherits: false;}@property --tw-drop-shadow-alpha{syntax: "<percentage>"; inherits: false; initial-value: 100%;}@property --tw-drop-shadow-size{syntax: "*"; inherits: false;}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}@layer properties{@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x: 0;--tw-translate-y: 0;--tw-translate-z: 0;--tw-rotate-x: initial;--tw-rotate-y: initial;--tw-rotate-z: initial;--tw-skew-x: initial;--tw-skew-y: initial;--tw-space-y-reverse: 0;--tw-divide-y-reverse: 0;--tw-border-style: solid;--tw-leading: initial;--tw-font-weight: initial;--tw-tracking: initial;--tw-ordinal: initial;--tw-slashed-zero: initial;--tw-numeric-figure: initial;--tw-numeric-spacing: initial;--tw-numeric-fraction: initial;--tw-shadow: 0 0 #0000;--tw-shadow-color: initial;--tw-shadow-alpha: 100%;--tw-inset-shadow: 0 0 #0000;--tw-inset-shadow-color: initial;--tw-inset-shadow-alpha: 100%;--tw-ring-color: initial;--tw-ring-shadow: 0 0 #0000;--tw-inset-ring-color: initial;--tw-inset-ring-shadow: 0 0 #0000;--tw-ring-inset: initial;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-offset-shadow: 0 0 #0000;--tw-outline-style: solid;--tw-blur: initial;--tw-brightness: initial;--tw-contrast: initial;--tw-grayscale: initial;--tw-hue-rotate: initial;--tw-invert: initial;--tw-opacity: initial;--tw-saturate: initial;--tw-sepia: initial;--tw-drop-shadow: initial;--tw-drop-shadow-color: initial;--tw-drop-shadow-alpha: 100%;--tw-drop-shadow-size: initial}}}
@@ -0,0 +1,24 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>PowerSync</title>
7
+ <style>
8
+ html,
9
+ body {
10
+ height: 100%;
11
+ margin: 0;
12
+ }
13
+ </style>
14
+ <!-- Tells the Rozenite client it runs in a panel, not in the app. -->
15
+ <script>
16
+ var __ROZENITE_PANEL__ = true;
17
+ </script>
18
+ <script type="module" crossorigin src="./assets/powersync-B1PBHXj2.js"></script>
19
+ <link rel="stylesheet" crossorigin href="./assets/powersync-CpTiA65L.css">
20
+ </head>
21
+ <body>
22
+ <div id="app"></div>
23
+ </body>
24
+ </html>
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@powersync/diagnostics",
3
+ "version": "0.1.0",
4
+ "description": "PowerSync DevTools: sync status, buckets, streams, local data, schema, and logs.",
5
+ "panels": [
6
+ {
7
+ "name": "PowerSync",
8
+ "source": "/devtools/powersync.html"
9
+ }
10
+ ],
11
+ "integrations": [
12
+ "react-native"
13
+ ]
14
+ }
@@ -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":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,gBAAgB,CAAC;AAYxB;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAsB;IACtD,MAAM,MAAM,GAAG,IAAI,GAAG,EAA8D,CAAC;IACrF,wEAAwE;IACxE,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE;QACjC,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE;YAAE,KAAK,GAAG,CAAC,SAAS,CAAC,0BAA0B,EAAE,QAAQ,CAAC,CAAC;IACjG,CAAC,EAAE,YAAY,CAAC,CAAC;IAChB,SAAoC,CAAC,KAAK,EAAE,EAAE,CAAC;IAEhD,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAkB,E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sB,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;YAC9D,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,QAAQ;YACpB,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACnC,IAAI,CAAC,KAAK;gBAAE,OAAO;YACnB,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YACxB,KAAK,CAAC,IAAI,EAAE,CAAC;YACb,MAAM,KAAK,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;YAChC,MAAM,GAAG,CAAC,IAAI,CAAC,2BAA2B,EAAE,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QACxE,CAAC;QACD,KAAK,CAAC,KAAK;YACT,aAAa,CAAC,SAAS,CAAC,CAAC;YACzB,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;gBAC1C,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,24 +1,13 @@
1
1
  /**
2
- * Pieces shared by every JavaScript host: building the agent over a live database, and serving
3
- * agents to a devframe node side over an RPC client (a dock script in a web page, or a node process).
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.
4
5
  */
5
- import type { DevframeRpcClient } from 'devframe/client';
6
6
  import type { CommonPowerSyncDatabase } from '@powersync/common';
7
7
  import type { SdkIntegration } from '@powersync/diagnostics-core';
8
- import './rpc-types.js';
9
- /** Builds the JavaScript integration over a live database. */
8
+ export { attachIframe } from '@powersync/diagnostics-core';
9
+ export type { ActionRequest, AttachIframeOptions, DiagnosticsEvent, SdkIntegration, SyncState } from '@powersync/diagnostics-core';
10
+ /** The SDK label for the database, or `fallback` on SDK releases that do not report it. */
11
+ export declare function databaseSdk(database: CommonPowerSyncDatabase, fallback: string): string;
12
+ /** Builds the JavaScript integration over a live database. The agent reads the connection from the database itself. */
10
13
  export declare function createIntegration(database: CommonPowerSyncDatabase, sdk: string): SdkIntegration;
11
- /** Serves integrations to the node side over one RPC client. */
12
- export interface AgentServer {
13
- /** Announces `integration` as `sourceId` and starts forwarding its events. */
14
- serve(sourceId: string, integration: SdkIntegration, sdk: string): Promise<void>;
15
- /** Withdraws a served integration. */
16
- release(sourceId: string): Promise<void>;
17
- /** Releases everything served through this client. */
18
- close(): Promise<void>;
19
- }
20
- /**
21
- * Registers the page-side functions the node side calls (`powersync:page-*`) on `rpc`, and returns
22
- * a server that announces integrations to it. Call once per RPC client.
23
- */
24
- export declare function createAgentServer(rpc: DevframeRpcClient): AgentServer;
package/lib/src/agent.js CHANGED
@@ -1,8 +1,12 @@
1
- import { HEARTBEAT_MS } from './constants.js';
2
1
  import { JsAgent } from './js-agent.js';
3
- import './rpc-types.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
4
  /** The sync client broadcasts core diagnostics events on this channel (see `emitDiagnostics`). */
5
5
  const CORE_EVENTS_CHANNEL = 'powersync-diagnostics-events';
6
+ /** The SDK label for the database, or `fallback` on SDK releases that do not report it. */
7
+ export function databaseSdk(database, fallback) {
8
+ return database.sdkName ?? fallback;
9
+ }
6
10
  /** Consumes the core diagnostics events the sync client broadcasts (from a worker or in-process). */
7
11
  class BroadcastCoreEvents {
8
12
  channel = new BroadcastChannel(CORE_EVENTS_CHANNEL);
@@ -15,64 +19,40 @@ class BroadcastCoreEvents {
15
19
  this.channel.close();
16
20
  }
17
21
  }
18
- /** Builds the JavaScript integration over a live database. */
22
+ function hasDiagnosticsListener(database) {
23
+ return typeof database.registerDiagnosticsListener === 'function';
24
+ }
25
+ /** Consumes the core diagnostics events a database hands to its listeners. */
26
+ class ListenerCoreEvents {
27
+ database;
28
+ removers = new Set();
29
+ constructor(database) {
30
+ this.database = database;
31
+ }
32
+ onEvent(handler) {
33
+ const remove = this.database.registerDiagnosticsListener(handler);
34
+ this.removers.add(remove);
35
+ return () => {
36
+ this.removers.delete(remove);
37
+ remove();
38
+ };
39
+ }
40
+ dispose() {
41
+ for (const remove of this.removers)
42
+ remove();
43
+ this.removers.clear();
44
+ }
45
+ }
46
+ function coreEventSource(database) {
47
+ if (hasDiagnosticsListener(database))
48
+ return new ListenerCoreEvents(database);
49
+ if (typeof BroadcastChannel === 'function')
50
+ return new BroadcastCoreEvents();
51
+ return undefined;
52
+ }
53
+ /** Builds the JavaScript integration over a live database. The agent reads the connection from the database itself. */
19
54
  export function createIntegration(database, sdk) {
20
55
  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
- /**
31
- * Registers the page-side functions the node side calls (`powersync:page-*`) on `rpc`, and returns
32
- * a server that announces integrations to it. Call once per RPC client.
33
- */
34
- export function createAgentServer(rpc) {
35
- const served = new Map();
36
- // The node side only knows this client is alive while it hears from it.
37
- const heartbeat = setInterval(() => {
38
- for (const sourceId of served.keys())
39
- void rpc.callEvent('powersync:page-heartbeat', sourceId);
40
- }, HEARTBEAT_MS);
41
- heartbeat.unref?.();
42
- const integrationFor = (sourceId) => {
43
- const entry = served.get(sourceId);
44
- if (!entry)
45
- throw new Error(`No database "${sourceId}" is served here.`);
46
- return entry.integration;
47
- };
48
- const register = (name, handler) => rpc.client.register({ name, type: 'action', jsonSerializable: true, handler }, true);
49
- register('powersync:page-query', (id, params) => integrationFor(id).runQuery(params));
50
- register('powersync:page-schema', (id) => integrationFor(id).getSchema());
51
- register('powersync:page-info', (id) => integrationFor(id).getInfo());
52
- register('powersync:page-action', (id, request) => integrationFor(id).action(request));
53
- return {
54
- async serve(sourceId, integration, sdk) {
55
- await rpc.call('powersync:page-register', sourceId, sdk);
56
- const stop = await integration.observeEvents((event) => {
57
- void rpc.callEvent('powersync:page-event', sourceId, event);
58
- });
59
- served.set(sourceId, { integration, stop });
60
- },
61
- async release(sourceId) {
62
- const entry = served.get(sourceId);
63
- if (!entry)
64
- return;
65
- served.delete(sourceId);
66
- entry.stop();
67
- await entry.integration.close();
68
- await rpc.call('powersync:page-unregister', sourceId).catch(() => { });
69
- },
70
- async close() {
71
- clearInterval(heartbeat);
72
- for (const sourceId of [...served.keys()]) {
73
- await this.release(sourceId);
74
- }
75
- }
76
- };
56
+ return new JsAgent(db, { sdk, coreEvents: coreEventSource(db) });
77
57
  }
78
58
  //# sourceMappingURL=agent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/agent.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAwB,MAAM,eAAe,CAAC;AAC9D,OAAO,gBAAgB,CAAC;AAExB,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,E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GAAG,QAAiC,CAAC;IAC7C,OAAO,IAAI,OAAO,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,eAAe,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACnE,CAAC"}
package/lib/src/client.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { observeRegisteredDatabases } from '@powersync/web/devtools';
2
- import { createAgentServer, createIntegration } from './agent.js';
3
- const SDK = '@powersync/web';
2
+ import { createIntegration, databaseSdk } from './agent.js';
3
+ import { createAgentServer } from './agent-server.js';
4
4
  export default function setup(context) {
5
5
  const server = createAgentServer(context.rpc);
6
6
  let counter = 0;
@@ -22,8 +22,9 @@ export default function setup(context) {
22
22
  }
23
23
  if (currentId)
24
24
  return;
25
- currentId = `web-${++counter}`;
26
- void server.serve(currentId, createIntegration(database, SDK), SDK);
25
+ const sdk = databaseSdk(database, '@powersync/web');
26
+ currentId = `${sdk.replace(/^@powersync\//, '')}-${++counter}`;
27
+ void server.serve(currentId, createIntegration(database, sdk), sdk);
27
28
  });
28
29
  }
29
30
  //# sourceMappingURL=client.js.map
@@ -1 +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,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAElE,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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C;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,MAAM,GAAG,GAAG,WAAW,CAAC,QAAQ,EAAE,gBAAgB,CAAC,CAAC;QACpD,SAAS,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;QAC/D,KAAK,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,iBAAiB,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -12,6 +12,7 @@ import { dirname, join } from 'node:path';
12
12
  import { defineDevframe, defineRpcFunction } from 'devframe';
13
13
  import { z } from 'zod';
14
14
  import { DEVFRAME_ID, HEARTBEAT_MS, UI_ROUTE } from './constants.js';
15
+ import { ACTION_NAMES, ARGUMENT_DESCRIPTIONS, TOOL_DESCRIPTIONS } from './tools.js';
15
16
  /** Event types replayed to a UI that subscribes late. `logs` and `core` are not replayed. */
16
17
  const SNAPSHOT_TYPES = new Set(['status', 'streams', 'buckets', 'uploadQueue']);
17
18
  /**
@@ -199,20 +200,13 @@ const sourceIdArg = z
199
200
  .describe('Id of the attached database, from powersync_sources. Null for the first one.');
200
201
  const queryParamsArg = z
201
202
  .object({
202
- sql: z.string().describe('SQL to run against the local SQLite database.'),
203
- params: z.array(z.unknown()).optional().describe('Positional parameters for `?` placeholders.')
203
+ sql: z.string().describe(ARGUMENT_DESCRIPTIONS.sql),
204
+ params: z.array(z.unknown()).optional().describe(ARGUMENT_DESCRIPTIONS.params)
204
205
  })
205
206
  .describe('The query.');
206
207
  const actionRequestArg = z
207
208
  .object({
208
- action: z.enum([
209
- 'reconnect',
210
- 'disconnect',
211
- 'clearData',
212
- 'requestCheckpoint',
213
- 'subscribeStream',
214
- 'unsubscribeStream'
215
- ]),
209
+ action: z.enum(ACTION_NAMES),
216
210
  args: z
217
211
  .object({
218
212
  name: z.string(),
@@ -221,7 +215,7 @@ const actionRequestArg = z
221
215
  priority: z.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3)]).optional()
222
216
  })
223
217
  .optional()
224
- .describe('Stream name and options, for the stream actions only.')
218
+ .describe(ARGUMENT_DESCRIPTIONS.actionArgs)
225
219
  })
226
220
  .describe('The action to run.');
227
221
  const anyResult = z.unknown();
@@ -327,7 +321,7 @@ export const definition = defineDevframe({
327
321
  args: [queryParamsArg, sourceIdArg],
328
322
  returns: anyResult,
329
323
  agent: {
330
- description: 'Run SQL against the attached PowerSync SQLite database. App tables are views; the sync client state is in the ps_* tables (ps_buckets, ps_oplog, ps_crud, ps_stream_subscriptions). Returns columns and rows. Arguments: arg0 = { sql, params? }, arg1 = database id or null for the first one.',
324
+ description: `${TOOL_DESCRIPTIONS.query} Arguments: arg0 = { sql, params? }, arg1 = database id or null for the first one.`,
331
325
  safety: 'action'
332
326
  },
333
327
  handler: (params, sourceId) => pickSource(sourceId).integration.runQuery(params)
@@ -339,7 +333,7 @@ export const definition = defineDevframe({
339
333
  args: [sourceIdArg],
340
334
  returns: anyResult,
341
335
  agent: {
342
- description: 'The client schema as the PowerSync SQLite core receives it: tables, columns, indexes. Argument: arg0 = database id or null for the first one.'
336
+ description: `${TOOL_DESCRIPTIONS.schema} Argument: arg0 = database id or null for the first one.`
343
337
  },
344
338
  handler: (sourceId) => pickSource(sourceId).integration.getSchema()
345
339
  }));
@@ -350,7 +344,7 @@ export const definition = defineDevframe({
350
344
  args: [sourceIdArg],
351
345
  returns: anyResult,
352
346
  agent: {
353
- description: 'Connection info of the PowerSync client: endpoint, user id, client id, connection method, core version. Argument: arg0 = database id or null for the first one.'
347
+ description: `${TOOL_DESCRIPTIONS.info} Argument: arg0 = database id or null for the first one.`
354
348
  },
355
349
  handler: (sourceId) => pickSource(sourceId).integration.getInfo()
356
350
  }));
@@ -361,7 +355,7 @@ export const definition = defineDevframe({
361
355
  args: [sourceIdArg],
362
356
  returns: anyResult,
363
357
  agent: {
364
- description: 'The latest sync status the PowerSync client reported: connected, downloading, progress, last sync, errors. Null until it has reported. Argument: arg0 = database id or null for the first one.'
358
+ description: `${TOOL_DESCRIPTIONS.status} Argument: arg0 = database id or null for the first one.`
365
359
  },
366
360
  handler: async (sourceId) => latestSnapshot(sourceId, 'status')
367
361
  }));
@@ -372,7 +366,7 @@ export const definition = defineDevframe({
372
366
  args: [sourceIdArg],
373
367
  returns: anyResult,
374
368
  agent: {
375
- description: 'Pending local changes waiting to upload, as last reported: count and size. Null until reported. Argument: arg0 = database id or null for the first one.'
369
+ description: `${TOOL_DESCRIPTIONS['upload-queue']} Argument: arg0 = database id or null for the first one.`
376
370
  },
377
371
  handler: async (sourceId) => latestSnapshot(sourceId, 'uploadQueue')
378
372
  }));
@@ -383,7 +377,7 @@ export const definition = defineDevframe({
383
377
  args: [actionRequestArg, sourceIdArg],
384
378
  returns: anyResult,
385
379
  agent: {
386
- description: 'Run a control action on the PowerSync client: reconnect, disconnect, clearData (wipes local data and re-syncs), requestCheckpoint, subscribeStream, unsubscribeStream. Arguments: arg0 = { action, args? }, arg1 = database id or null for the first one.',
380
+ description: `${TOOL_DESCRIPTIONS.action} Arguments: arg0 = { action, args? }, arg1 = database id or null for the first one.`,
387
381
  safety: 'destructive'
388
382
  },
389
383
  handler: (request, sourceId) => pickSource(sourceId).integration.action(request)
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/definition.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAA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,CAAC,GAAG,CAAC,QAAQ,CACb,iBAAiB,CAAC;YAChB,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE,QAAQ;YACd,gBAAgB,EAAE,IAAI;YACtB,OAAO,EAAE,GAAG,EAAE;gBACZ,SAAS,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC7C,CAAC;SACF,CAAC,CACH,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -1,27 +1,19 @@
1
- import type { CommonPowerSyncDatabase, PowerSyncBackendConnector, SyncOptions } from '@powersync/common';
2
1
  import type { ActionRequest, CoreDiagnosticsEvent, DiagnosticsEvent, ProtocolInfo, QueryParams, QueryResult, SchemaPayload, SdkIntegration, Unsubscribe } from '@powersync/diagnostics-core';
2
+ import type { BasePowerSyncDatabase } from '@powersync/shared-internals';
3
3
  /** Delivers the SQLite core's diagnostics events to the agent. How they arrive is runtime-specific. */
4
4
  export interface CoreEventSource {
5
5
  onEvent(handler: (event: CoreDiagnosticsEvent) => void): Unsubscribe;
6
6
  dispose(): void;
7
7
  }
8
- /**
9
- * Read access to the live connection. The connector and options are not on the database's public
10
- * interface, so the code that installs the agent (which can see the concrete database) hands them in.
11
- */
12
- export interface ConnectionAccess {
13
- getConnector(): PowerSyncBackendConnector | null;
14
- getConnectionOptions(): SyncOptions | null;
15
- }
16
8
  export interface JsAgentOptions {
17
9
  /** A label for the SDK behind this agent, e.g. `@powersync/web`. */
18
10
  sdk?: string;
11
+ /** If known, the path to the database */
12
+ databasePath?: string;
19
13
  /** Debounce for re-reading bucket stats after internal-table changes. */
20
14
  bucketThrottleMs?: number;
21
15
  /** Core diagnostics events (per-bucket `target_count`). Omit when core diagnostics are off. */
22
16
  coreEvents?: CoreEventSource;
23
- /** Read access to the live connection; omit if the runtime cannot expose it. */
24
- connection?: ConnectionAccess;
25
17
  }
26
18
  /**
27
19
  * The JavaScript `SdkIntegration`: runs next to a live PowerSync database and answers the protocol
@@ -29,7 +21,7 @@ export interface JsAgentOptions {
29
21
  * live client. Hosts reach it through a bridge or call it directly when they share the page.
30
22
  */
31
23
  export declare class JsAgent implements SdkIntegration {
32
- private db;
24
+ private readonly db;
33
25
  private options;
34
26
  private handlers;
35
27
  private disposers;
@@ -39,8 +31,9 @@ export declare class JsAgent implements SdkIntegration {
39
31
  private lastConnector;
40
32
  private lastConnectionOptions;
41
33
  private bucketTargets;
42
- constructor(db: CommonPowerSyncDatabase, options?: JsAgentOptions);
34
+ constructor(db: BasePowerSyncDatabase, options?: JsAgentOptions);
43
35
  runQuery({ sql, params }: QueryParams): Promise<QueryResult>;
36
+ private queryRecords;
44
37
  getSchema(): Promise<SchemaPayload>;
45
38
  getInfo(): Promise<ProtocolInfo>;
46
39
  observeEvents(handler: (event: DiagnosticsEvent) => void): Promise<Unsubscribe>;